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

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/DeviceTab/wgtMsgPanel.h>

Inheritance diagram for Slic3r::GUI::wgtMsgPanel:
Collaboration diagram for Slic3r::GUI::wgtMsgPanel:

Public Member Functions

 wgtMsgPanel (wxWindow *parent)
 ~wgtMsgPanel () override=default
void AddMessage (const wxString &text, const wxColour &colour, const wxString &wiki_url=wxEmptyString)
void Clear ()
int GetMessageCount () const

Private Member Functions

void CreateGui ()

Private Attributes

Label * m_label_title { nullptr }
wxBoxSizer * m_list_sizer { nullptr }

Detailed Description

Constructor & Destructor Documentation

◆ wgtMsgPanel()

Slic3r::GUI::wgtMsgPanel::wgtMsgPanel ( wxWindow * parent)
explicit
112 : wxPanel(parent, wxID_ANY)
113{
114 CreateGui();
115}
void CreateGui()
Definition wgtMsgPanel.cpp:117

References CreateGui().

Here is the call graph for this function:

◆ ~wgtMsgPanel()

Slic3r::GUI::wgtMsgPanel::~wgtMsgPanel ( )
overridedefault

Member Function Documentation

◆ AddMessage()

void Slic3r::GUI::wgtMsgPanel::AddMessage ( const wxString & text,
const wxColour & colour,
const wxString & wiki_url = wxEmptyString )
137{
138 if (!m_list_sizer) return;
139
140 auto* label = new ::Label(this, wxString::Format("%d. ", GetMessageCount() + 1));
141 label->SetFont(::Label::Body_14);
142 label->SetBackgroundColour(StateColor::darkModeColorFor(wxColour(*wxWHITE)));
143 label->SetForegroundColour(colour);
144
145 auto* item = new wgtMsgPanelItem(this, colour, text, GetSize().GetWidth(), wiki_url);
146 auto h_sizer = new wxBoxSizer(wxHORIZONTAL);
147 h_sizer->Add(label, 0, wxEXPAND);
148 h_sizer->Add(item, 0, wxEXPAND);
149 m_list_sizer->Add(h_sizer, 0, wxEXPAND | wxTOP | wxBOTTOM, FromDIP(2));
150 Layout();
151}
static wxFont Body_14
Definition Label.hpp:53
wxBoxSizer * m_list_sizer
Definition wgtMsgPanel.h:71
int GetMessageCount() const
Definition wgtMsgPanel.h:64
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219

References Label::Body_14, StateColor::darkModeColorFor(), GetMessageCount(), and m_list_sizer.

Here is the call graph for this function:

◆ Clear()

void Slic3r::GUI::wgtMsgPanel::Clear ( )
154{
155 if (!m_list_sizer) return;
156
157 Freeze();
158 wxSizerItemList children = m_list_sizer->GetChildren();
159 for (auto it = children.begin(); it != children.end(); ++it) {
160 if (wxWindow* win = (*it)->GetWindow()) {
161 win->Destroy();
162 }
163 }
164 m_list_sizer->Clear(true);
165 Thaw();
166 Layout();
167}

References m_list_sizer.

◆ CreateGui()

void Slic3r::GUI::wgtMsgPanel::CreateGui ( )
private
118{
119 SetBackgroundColour(StateColor::darkModeColorFor(wxColour(*wxWHITE)));
120
121 wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
122
123 m_label_title = new Label(this, _L("Note:"));
125 main_sizer->Add(m_label_title, 0, wxEXPAND | wxALL, FromDIP(4));
126
127 m_list_sizer = new wxBoxSizer(wxVERTICAL);
128 main_sizer->Add(m_list_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(4));
129
130 SetSizer(main_sizer);
131 Layout();
132}
#define _L(s)
Definition OBJ.cpp:34
Label * m_label_title
Definition wgtMsgPanel.h:70

References _L, Label::Body_14, StateColor::darkModeColorFor(), m_label_title, and m_list_sizer.

Referenced by wgtMsgPanel().

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

◆ GetMessageCount()

int Slic3r::GUI::wgtMsgPanel::GetMessageCount ( ) const
inline
64{ return m_list_sizer ? m_list_sizer->GetItemCount() : 0; }

References m_list_sizer.

Referenced by AddMessage().

Here is the caller graph for this function:

Member Data Documentation

◆ m_label_title

Label* Slic3r::GUI::wgtMsgPanel::m_label_title { nullptr }
private
70{ nullptr };

Referenced by CreateGui().

◆ m_list_sizer

wxBoxSizer* Slic3r::GUI::wgtMsgPanel::m_list_sizer { nullptr }
private
71{ nullptr };

Referenced by AddMessage(), Clear(), CreateGui(), and GetMessageCount().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/DeviceTab/wgtMsgPanel.h
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/DeviceTab/wgtMsgPanel.cpp