OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::PinCodePanel Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/SelectMachinePop.hpp>

Inheritance diagram for Slic3r::GUI::PinCodePanel:
Collaboration diagram for Slic3r::GUI::PinCodePanel:

Public Member Functions

 PinCodePanel (wxWindow *parent, int type, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 ~PinCodePanel ()
void OnPaint (wxPaintEvent &event)
void render (wxDC &dc)
void doRender (wxDC &dc)
void on_mouse_enter (wxMouseEvent &evt)
void on_mouse_leave (wxMouseEvent &evt)
void on_mouse_left_up (wxMouseEvent &evt)

Public Attributes

ScalableBitmap m_bitmap
bool m_hover {false}
int m_type {0}

Detailed Description

Constructor & Destructor Documentation

◆ PinCodePanel()

Slic3r::GUI::PinCodePanel::PinCodePanel ( wxWindow * parent,
int type,
wxWindowID winid = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize )
1026 {
1027 wxPanel::Create(parent, winid, pos);
1028 Bind(wxEVT_PAINT, &PinCodePanel::OnPaint, this);
1029 SetSize(SELECT_MACHINE_ITEM_SIZE);
1030 SetMaxSize(SELECT_MACHINE_ITEM_SIZE);
1031 SetMinSize(SELECT_MACHINE_ITEM_SIZE);
1032
1033 m_type = type;
1034 m_bitmap = ScalableBitmap(this, "bind_device_ping_code",10);
1035
1036 this->Bind(wxEVT_ENTER_WINDOW, &PinCodePanel::on_mouse_enter, this);
1037 this->Bind(wxEVT_LEAVE_WINDOW, &PinCodePanel::on_mouse_leave, this);
1038 this->Bind(wxEVT_LEFT_UP, &PinCodePanel::on_mouse_left_up, this);
1039 }
#define SELECT_MACHINE_ITEM_SIZE
Definition SelectMachinePop.hpp:77
int m_type
Definition SelectMachinePop.hpp:157
void on_mouse_enter(wxMouseEvent &evt)
Definition SelectMachinePop.cpp:1089
void on_mouse_left_up(wxMouseEvent &evt)
Definition SelectMachinePop.cpp:1101
void OnPaint(wxPaintEvent &event)
Definition SelectMachinePop.cpp:1041
ScalableBitmap m_bitmap
Definition SelectMachinePop.hpp:155
void on_mouse_leave(wxMouseEvent &evt)
Definition SelectMachinePop.cpp:1095

References m_bitmap, m_type, on_mouse_enter(), on_mouse_leave(), on_mouse_left_up(), OnPaint(), and SELECT_MACHINE_ITEM_SIZE.

Here is the call graph for this function:

◆ ~PinCodePanel()

Slic3r::GUI::PinCodePanel::~PinCodePanel ( )
inline
153{};

Member Function Documentation

◆ doRender()

void Slic3r::GUI::PinCodePanel::doRender ( wxDC & dc)
1069 {
1070 auto size = GetSize();
1071 dc.DrawBitmap(m_bitmap.bmp(), wxPoint(FromDIP(12), (size.y - m_bitmap.GetBmpSize().y) / 2));
1072 dc.SetFont(::Label::Head_13);
1073 dc.SetTextForeground(StateColor::darkModeColorFor(wxColour("#262E30"))); // ORCA fix text not visible on dark theme
1074 wxString txt;
1075 if (m_type == 0) {txt = _L("Bind with Pin Code");}
1076 else if (m_type == 1) {txt = _L("Bind with Access Code");}
1077
1078 WxFontUtils::get_suitable_font_size(0.5 * size.GetHeight(), dc);
1079 auto txt_size = dc.GetTextExtent(txt);
1080 dc.DrawText(txt, wxPoint(FromDIP(28), (size.y - txt_size.y) / 2));
1081
1082 if (m_hover) {
1083 dc.SetPen(SELECT_MACHINE_BRAND);
1084 dc.SetBrush(*wxTRANSPARENT_BRUSH);
1085 dc.DrawRectangle(0, 0, size.x, size.y);
1086 }
1087 }
#define _L(s)
Definition OBJ.cpp:34
#define SELECT_MACHINE_BRAND
Definition SelectMachinePop.hpp:81
static wxFont Head_13
Definition Label.hpp:46
bool m_hover
Definition SelectMachinePop.hpp:156
static void get_suitable_font_size(int max_height, wxDC &dc)
Definition WxFontUtils.cpp:309
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219

References _L, StateColor::darkModeColorFor(), Slic3r::GUI::WxFontUtils::get_suitable_font_size(), Label::Head_13, m_bitmap, m_hover, m_type, and SELECT_MACHINE_BRAND.

Referenced by render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_mouse_enter()

void Slic3r::GUI::PinCodePanel::on_mouse_enter ( wxMouseEvent & evt)
1090 {
1091 m_hover = true;
1092 Refresh();
1093 }

References m_hover, and Slic3r::GUI::wxMouseEvent.

Referenced by PinCodePanel().

Here is the caller graph for this function:

◆ on_mouse_leave()

void Slic3r::GUI::PinCodePanel::on_mouse_leave ( wxMouseEvent & evt)
1096 {
1097 m_hover = false;
1098 Refresh();
1099 }

References m_hover, and Slic3r::GUI::wxMouseEvent.

Referenced by PinCodePanel().

Here is the caller graph for this function:

◆ on_mouse_left_up()

void Slic3r::GUI::PinCodePanel::on_mouse_left_up ( wxMouseEvent & evt)
1102 {
1103 if (m_type == 0) {
1104 wxGetApp().popup_ping_bind_dialog();
1105 }
1106 else if (m_type == 1) {
1107 InputIpAddressDialog dlgo;
1108 dlgo.ShowModal();
1109 }
1110 }

References m_type, Slic3r::GUI::DPIAware< P >::ShowModal(), and Slic3r::GUI::wxMouseEvent.

Referenced by PinCodePanel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPaint()

void Slic3r::GUI::PinCodePanel::OnPaint ( wxPaintEvent & event)
1042 {
1043 wxPaintDC dc(this);
1044 render(dc);
1045 }
void render(wxDC &dc)
Definition SelectMachinePop.cpp:1047

References render().

Referenced by PinCodePanel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render()

void Slic3r::GUI::PinCodePanel::render ( wxDC & dc)
1048 {
1049#ifdef __WXMSW__
1050 wxSize size = GetSize();
1051 wxMemoryDC memdc;
1052 wxBitmap bmp(size.x, size.y);
1053 memdc.SelectObject(bmp);
1054 memdc.Blit({ 0, 0 }, size, &dc, { 0, 0 });
1055
1056 {
1057 wxGCDC dc2(memdc);
1058 doRender(dc2);
1059 }
1060
1061 memdc.SelectObject(wxNullBitmap);
1062 dc.DrawBitmap(bmp, 0, 0);
1063#else
1064 doRender(dc);
1065#endif
1066 }
void doRender(wxDC &dc)
Definition SelectMachinePop.cpp:1068

References doRender().

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_bitmap

ScalableBitmap Slic3r::GUI::PinCodePanel::m_bitmap

Referenced by PinCodePanel(), and doRender().

◆ m_hover

bool Slic3r::GUI::PinCodePanel::m_hover {false}
156{false};

Referenced by doRender(), on_mouse_enter(), and on_mouse_leave().

◆ m_type

int Slic3r::GUI::PinCodePanel::m_type {0}
157{0};

Referenced by PinCodePanel(), doRender(), and on_mouse_left_up().


The documentation for this class was generated from the following files: