#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/TroubleshootDialog.hpp>
|
| std::vector< wxString > | Wrap (wxDC &dc, const wxString &text, int maxW) |
| void | OnPaint (wxPaintEvent &) |
| void | UpdateMinSize () |
| void | OnSize (wxSizeEvent &e) |
◆ CenteredMultiLinePanel()
| Slic3r::GUI::CenteredMultiLinePanel::CenteredMultiLinePanel |
( |
wxWindow * | parent, |
|
|
const std::vector< wxString > & | lines = {} ) |
|
inline |
108 {})
109 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxFULL_REPAINT_ON_RESIZE)
110 {
112 SetBackgroundStyle(wxBG_STYLE_PAINT);
115
117 }
static wxFont Body_14
Definition Label.hpp:53
void SetText(const std::vector< wxString > &lines)
Definition TroubleshootDialog.hpp:119
void OnSize(wxSizeEvent &e)
Definition TroubleshootDialog.hpp:205
void OnPaint(wxPaintEvent &)
Definition TroubleshootDialog.hpp:150
◆ OnPaint()
| void Slic3r::GUI::CenteredMultiLinePanel::OnPaint |
( |
wxPaintEvent & | | ) |
|
|
inlineprivate |
151 {
152 wxAutoBufferedPaintDC dc(this);
153 dc.Clear();
154
155 int cWidth = GetClientSize().GetWidth();
156 if (
m_lines.empty() || cWidth < 50)
return;
157
158 dc.SetTextForeground(GetForegroundColour());
159
160 int y = 0;
161 for (
size_t i = 0; i <
m_lines.size(); ++i) {
162 wxCoord tw, th;
164 line.Trim();
165 line.Trim(false);
166 dc.GetTextExtent(line, &tw, &th);
167 dc.DrawText(line, (cWidth - tw) / 2, y);
169 }
172 }
173 }
static constexpr double m_block_gap
Definition TroubleshootDialog.hpp:103
std::vector< wxString > m_lines
Definition TroubleshootDialog.hpp:105
std::vector< wxString > Wrap(wxDC &dc, const wxString &text, int maxW)
Definition TroubleshootDialog.hpp:128
static constexpr double m_line_height
Definition TroubleshootDialog.hpp:104
References m_block_gap, m_line_height, m_lines, and Wrap().
◆ OnSize()
| void Slic3r::GUI::CenteredMultiLinePanel::OnSize |
( |
wxSizeEvent & | e | ) |
|
|
inlineprivate |
206 {
207 Refresh();
209 e.Skip();
210 }
void UpdateMinSize()
Definition TroubleshootDialog.hpp:175
References UpdateMinSize().
◆ SetText()
| void Slic3r::GUI::CenteredMultiLinePanel::SetText |
( |
const std::vector< wxString > & | lines | ) |
|
|
inline |
◆ UpdateMinSize()
| void Slic3r::GUI::CenteredMultiLinePanel::UpdateMinSize |
( |
| ) |
|
|
inlineprivate |
176 {
177 if (
m_lines.empty() || !GetParent()) {
178 SetMinSize(wxDefaultSize);
179 return;
180 }
181 wxClientDC dc(this);
182 int cWidth = GetClientSize().GetWidth();
183
184
185 if (cWidth < 50) return;
186
187 int y = 0;
188 for (
size_t i = 0; i <
m_lines.size(); ++i) {
189 wxCoord th;
191 dc.GetTextExtent(line, nullptr, &th);
193 }
196 }
197
198 if(GetMinSize().GetHeight() != y){
199 SetMinSize(wxSize(-1, y));
200 if(GetParent())
201 GetParent()->Layout();
202 }
203 }
References m_block_gap, m_line_height, m_lines, and Wrap().
Referenced by OnSize(), and SetText().
◆ Wrap()
| std::vector< wxString > Slic3r::GUI::CenteredMultiLinePanel::Wrap |
( |
wxDC & | dc, |
|
|
const wxString & | text, |
|
|
int | maxW ) |
|
inlineprivate |
129 {
130 std::vector<wxString> out;
131 wxString cur;
132 for (const auto& word : wxSplit(text, ' ', true)) {
133 wxString trial = cur.empty() ? word : cur + " " + word;
134 wxCoord w, h;
135 dc.GetTextExtent(trial, &w, &h);
136 if (w <= maxW)
137 cur = trial;
138 else if (!cur.empty()){
139 out.push_back(cur);
140 cur = word;
141 }
142 else
143 out.push_back(word);
144 }
145 if (!cur.empty())
146 out.push_back(cur);
147 return out;
148 }
Referenced by OnPaint(), and UpdateMinSize().
◆ m_block_gap
| double Slic3r::GUI::CenteredMultiLinePanel::m_block_gap = 0.55 |
|
staticconstexprprivate |
◆ m_line_height
| double Slic3r::GUI::CenteredMultiLinePanel::m_line_height = 1.15 |
|
staticconstexprprivate |
◆ m_lines
| std::vector<wxString> Slic3r::GUI::CenteredMultiLinePanel::m_lines |
|
private |
The documentation for this class was generated from the following file: