OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
ErrorMsgStaticText Class Reference

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

Inheritance diagram for ErrorMsgStaticText:
Collaboration diagram for ErrorMsgStaticText:

Public Member Functions

 ErrorMsgStaticText ()
 ErrorMsgStaticText (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(0, 0))
void paintEvent (wxPaintEvent &evt)
void SetLabel (const wxString &msg) override

Public Attributes

wxString m_msg

Detailed Description

Constructor & Destructor Documentation

◆ ErrorMsgStaticText() [1/2]

ErrorMsgStaticText::ErrorMsgStaticText ( )
9{}

◆ ErrorMsgStaticText() [2/2]

ErrorMsgStaticText::ErrorMsgStaticText ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxSize(0,0) )
15{
16 Create(parent, id, pos, size);
17 Bind(wxEVT_PAINT, &ErrorMsgStaticText::paintEvent, this);
18}
void paintEvent(wxPaintEvent &evt)
Definition ErrorMsgStaticText.cpp:20

References paintEvent().

Here is the call graph for this function:

Member Function Documentation

◆ paintEvent()

void ErrorMsgStaticText::paintEvent ( wxPaintEvent & evt)
21{
22 auto size = GetSize();
23 wxPaintDC dc(this);
24 auto text_height = dc.GetCharHeight();
25 wxString out_txt = m_msg;
26 wxString count_txt = "";
27 int line_count = 1;
28 int new_line_pos = 0;
29 bool is_ch = false;
30
31 if (m_msg[0] > 0x80 && m_msg[1] > 0x80)is_ch = true;
32
33 for (int i = 0; i < m_msg.length(); i++) {
34 auto text_size = dc.GetTextExtent(count_txt);
35 if (text_size.x < (size.x)) {
36 count_txt += m_msg[i];
37 if (m_msg[i] == ' ' ||
38 m_msg[i] == ',' ||
39 m_msg[i] == '.' ||
40 m_msg[i] == '\n')
41 {
42 new_line_pos = i;
43 }
44 } else {
45 if (!is_ch)
46 {
47 out_txt[new_line_pos] = '\n';
48 i = new_line_pos;
49 } else {
50 out_txt.insert(i-1,'\n');
51 }
52 count_txt = "";
53 line_count++;
54 }
55 }
56 SetSize(wxSize(-1, line_count * text_height));
57 SetMinSize(wxSize(-1, line_count * text_height));
58 SetMaxSize(wxSize(-1, line_count * text_height));
59 dc.DrawText(out_txt, 0, 0);
60}
wxString m_msg
Definition ErrorMsgStaticText.hpp:18

References m_msg.

Referenced by ErrorMsgStaticText().

Here is the caller graph for this function:

◆ SetLabel()

void ErrorMsgStaticText::SetLabel ( const wxString & msg)
inlineoverride
27{ m_msg = msg; }

References m_msg.

Member Data Documentation

◆ m_msg

wxString ErrorMsgStaticText::m_msg

Referenced by paintEvent(), and SetLabel().


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