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

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

Inheritance diagram for Slic3r::GUI::UiStyledAMSPanel:
Collaboration diagram for Slic3r::GUI::UiStyledAMSPanel:

Public Member Functions

 UiStyledAMSPanel (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, const wxColour &borderColor=wxColour(200, 200, 200), const wxColour &bgColor=wxColour(255, 255, 255), bool borderDashed=true, wxString name="", bool isTop=false)

Protected Member Functions

void OnPaint (wxPaintEvent &event)

Private Attributes

bool m_borderDashed
int m_borderWidth
int m_radius
wxColour m_borderColor
wxColour m_bgColor
wxString m_name
bool m_isTop

Detailed Description

Constructor & Destructor Documentation

◆ UiStyledAMSPanel()

Slic3r::GUI::UiStyledAMSPanel::UiStyledAMSPanel ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
const wxColour & borderColor = wxColour(200, 200, 200),
const wxColour & bgColor = wxColour(255, 255, 255),
bool borderDashed = true,
wxString name = "",
bool isTop = false )
59 : wxPanel(parent, id, pos, size),
60 m_borderDashed(borderDashed),
61 m_borderColor(borderColor),
62 m_bgColor(bgColor),
63 m_name(name),
64 m_isTop(isTop)
65{
66 SetDoubleBuffered(true);
67 SetBackgroundStyle(wxBG_STYLE_PAINT);
68
69 Bind(wxEVT_PAINT, &UiStyledAMSPanel::OnPaint, this);
70}
wxColour m_bgColor
Definition uiAMSBestPositionPopup.hpp:57
bool m_borderDashed
Definition uiAMSBestPositionPopup.hpp:53
void OnPaint(wxPaintEvent &event)
Definition uiAMSBestPositionPopup.cpp:73
wxString m_name
Definition uiAMSBestPositionPopup.hpp:58
wxColour m_borderColor
Definition uiAMSBestPositionPopup.hpp:56
bool m_isTop
Definition uiAMSBestPositionPopup.hpp:59

References m_bgColor, m_borderColor, m_borderDashed, m_isTop, m_name, and OnPaint().

Referenced by Slic3r::GUI::UiAMS::UiAMS().

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

Member Function Documentation

◆ OnPaint()

void Slic3r::GUI::UiStyledAMSPanel::OnPaint ( wxPaintEvent & event)
protected
74{
75
76 wxPaintDC dc(this);
77 dc.Clear();
78 m_borderWidth = FromDIP(2);
79 m_radius = FromDIP(5);
80 wxSize clientSize = GetClientSize();
81 int width = clientSize.GetWidth();
82 int height = clientSize.GetHeight();
83
84
85 dc.SetBrush(wxBrush(m_bgColor));
86 dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
87 dc.DrawRectangle(wxRect(0, 0, width, height));
88 // dc.DrawRoundedRectangle(wxRect(0, 0, width, height), m_radius);
89
90
91 wxPen borderPen;
93 {
94
95 borderPen = wxPen(m_borderColor, m_borderWidth, wxPENSTYLE_SHORT_DASH);
96 }
97 else
98 {
99
100 borderPen = wxPen(m_borderColor, m_borderWidth, wxPENSTYLE_SOLID);
101 }
102 dc.SetPen(borderPen);
103
104 int offset = m_borderWidth;
105 dc.DrawRoundedRectangle(wxRect(offset, offset, width - 2 * offset, height - 2 * offset), m_radius);
106
107
108 int labelX = offset;
109 int labelY = m_isTop ? offset : (height - offset - FromDIP(27)); // true=top, false=bottom
110
111
112 wxRect labelRect(labelX, labelY, width - 2 * offset, FromDIP(10));
113 wxRect labelRoundRect(labelX, labelY, width - 2 * offset, FromDIP(27));
114 dc.SetBrush(wxBrush(m_borderColor));
115 dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
116 dc.DrawRoundedRectangle(labelRoundRect, m_radius);
117 dc.DrawRectangle(labelRect);
118
119
120 wxFont font12(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
121 dc.SetTextForeground(wxColour("#858585"));
122 // dc.SetFont(font12);
123 dc.SetFont(::Label::Body_12);
124 wxCoord textWidth, textHeight;
125 dc.GetTextExtent(m_name, &textWidth, &textHeight);
126
127 int textPosX = labelX + 4 * offset;
128 int textPosY = labelY + (FromDIP(27) -textHeight ) / 2;
129 dc.DrawText(m_name, textPosX, textPosY);
130
131
132 // event.Skip();
133}
static wxFont Body_12
Definition Label.hpp:55
int m_borderWidth
Definition uiAMSBestPositionPopup.hpp:54
int m_radius
Definition uiAMSBestPositionPopup.hpp:55
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:1184
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:1185
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582

References Label::Body_12, m_bgColor, m_borderColor, m_borderDashed, m_borderWidth, m_isTop, m_name, m_radius, and Slic3r::offset().

Referenced by UiStyledAMSPanel().

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

Member Data Documentation

◆ m_bgColor

wxColour Slic3r::GUI::UiStyledAMSPanel::m_bgColor
private

Referenced by UiStyledAMSPanel(), and OnPaint().

◆ m_borderColor

wxColour Slic3r::GUI::UiStyledAMSPanel::m_borderColor
private

Referenced by UiStyledAMSPanel(), and OnPaint().

◆ m_borderDashed

bool Slic3r::GUI::UiStyledAMSPanel::m_borderDashed
private

Referenced by UiStyledAMSPanel(), and OnPaint().

◆ m_borderWidth

int Slic3r::GUI::UiStyledAMSPanel::m_borderWidth
private

Referenced by OnPaint().

◆ m_isTop

bool Slic3r::GUI::UiStyledAMSPanel::m_isTop
private

Referenced by UiStyledAMSPanel(), and OnPaint().

◆ m_name

wxString Slic3r::GUI::UiStyledAMSPanel::m_name
private

Referenced by UiStyledAMSPanel(), and OnPaint().

◆ m_radius

int Slic3r::GUI::UiStyledAMSPanel::m_radius
private

Referenced by OnPaint().


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