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

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

Inheritance diagram for Slic3r::GUI::LayerNumberTextInput:
Collaboration diagram for Slic3r::GUI::LayerNumberTextInput:

Public Types

enum class  Type { Begin , End }
enum class  ValueType { Custom , End }

Public Member Functions

 LayerNumberTextInput (wxWindow *parent, int layer_number, wxSize size, Type type, ValueType value_type=ValueType::Custom)
void link (LayerNumberTextInput *layer_input)
void set_layer_number (int layer_number)
int get_layer_number ()
Type get_input_type ()
ValueType get_value_type ()
bool is_layer_number_valid ()
DropDown & GetDropDown ()
void SetKeepDropArrow (bool keep)
virtual bool SetFont (wxFont const &font) override
int Append (const wxString &item, const wxBitmap &bitmap=wxNullBitmap, int item_style=0)
int Append (const wxString &item, const wxBitmap &bitmap, void *clientData, int item_style=0)
int Append (const wxString &item, const wxBitmap &bitmap, const wxString &group, void *clientData=nullptr, int item_style=0)
int Append (const wxString &item, const wxBitmap &bitmap, const wxString &group_key, const wxString &group_label, void *clientData=nullptr, int item_style=0)
int SetItems (const std::vector< DropDown::Item > &the_items)
void set_replace_text (wxString text, wxString image_name)
unsigned int GetCount () const override
int GetSelection () const override
void SetSelection (int n) override
void SelectAndNotify (int n)
virtual void Rescale () override
wxString GetValue () const
void SetValue (const wxString &value)
void SetLabel (const wxString &label) override
wxString GetLabel () const override
int GetFlag (unsigned int n)
void SetFlag (unsigned int n, int value)
void SetTextLabel (const wxString &label)
wxString GetTextLabel () const
wxString GetString (unsigned int n) const override
void SetString (unsigned int n, wxString const &value) override
wxString GetItemTooltip (unsigned int n) const
void SetItemTooltip (unsigned int n, wxString const &value)
wxString GetItemAlias (unsigned int n) const
void SetItemAlias (unsigned int n, wxString const &value)
wxBitmap GetItemBitmap (unsigned int n)
void SetItemBitmap (unsigned int n, wxBitmap const &bitmap)
void SetItemActionBitmap (unsigned int n, wxBitmap const &bitmap)
bool is_drop_down ()
void DeleteOneItem (unsigned int pos)
void ForceDropdownOpen ()
void CloseDropdown ()

Protected Member Functions

void update_label ()
virtual int DoInsertItems (const wxArrayStringsAdapter &items, unsigned int pos, void **clientData, wxClientDataType type) override
virtual void DoClear () override
void DoDeleteOneItem (unsigned int pos) override
void * DoGetItemClientData (unsigned int n) const override
void DoSetItemClientData (unsigned int n, void *data) override
void OnEdit () override
void sendComboBoxEvent ()

Private Types

typedef DropDown::Item Item

Private Member Functions

void mouseDown (wxMouseEvent &event)
void mouseWheelMoved (wxMouseEvent &event)
void keyDown (wxKeyEvent &event)
void onMove (wxMoveEvent &event)

Private Attributes

LayerNumberTextInput * m_another_layer_input { nullptr }
int m_layer_number
Type m_type
ValueType m_value_type
std::vector< Item > items
DropDown drop
bool drop_down = false
bool text_off = false
bool is_replace_text_to_image = false
bool m_keep_drop_arrow = false
wxString replace_text
wxString image_for_text

Detailed Description

Member Typedef Documentation

◆ Item

typedef DropDown::Item ComboBox::Item
privateinherited

Member Enumeration Documentation

◆ Type

Enumerator
Begin 
End 
40 {
41 Begin,
42 End
43 };

◆ ValueType

Enumerator
Custom 
End 
44 {
45 Custom,
46 End
47 };
@ Custom
Definition CustomGCode.hpp:23

Constructor & Destructor Documentation

◆ LayerNumberTextInput()

Slic3r::GUI::LayerNumberTextInput::LayerNumberTextInput ( wxWindow * parent,
int layer_number,
wxSize size,
Type type,
ValueType value_type = ValueType::Custom )
55 :ComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, size, 0, NULL)
56 , m_layer_number(layer_number)
57 , m_type(type)
58 , m_value_type(value_type)
59{
60 GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_DIGITS));
61 GetTextCtrl()->SetFont(::Label::Body_14);
62 Append(_L_CONTEXT("End", "Layer range"));
63 Append(_L("Customize"));
65 SetSelection(0);
67 SetSelection(1);
69 }
70
71 Bind(wxEVT_TEXT, [this](auto& evt) {
73 // TextCtrl->SetValue() will generate a wxEVT_TEXT event
74 GetTextCtrl()->ChangeValue(_L_CONTEXT("End", "Layer range"));
75 return;
76 }
77 evt.Skip();
78 });
79
80 auto validate_input_value = [this](int gui_value) {
81 // value should not be less than MIN_LAYER_VALUE, and should not be greater than MAX_LAYER_VALUE
82 gui_value = std::clamp(gui_value, MIN_LAYER_VALUE, MAX_LAYER_VALUE);
83
84 int begin_value = 0;
85 int end_value = 0;
86 LayerNumberTextInput* end_layer_input = nullptr;
87 if (this->m_type == Type::Begin) {
88 begin_value = gui_value;
89 end_value = m_another_layer_input->get_layer_number();
90 end_layer_input = m_another_layer_input;
91 }
92 if (this->m_type == Type::End) {
93 begin_value = m_another_layer_input->get_layer_number();
94 end_value = gui_value;
95 end_layer_input = this;
96 }
97
98 // end value should not be less than begin value
99 if (begin_value > end_value) {
100 // set new value for end_layer_input
101 if (this->m_type == Type::Begin) {
102 if (end_layer_input->is_layer_number_valid()) {
103 end_layer_input->set_layer_number(begin_value);
104 }
105 }
106 if (this->m_type == Type::End) {
107 if (!this->is_layer_number_valid()) {
108 this->set_layer_number(begin_value);
109 wxCommandEvent evt(EVT_NEED_RESORT_LAYERS);
110 wxPostEvent(m_parent, evt);
111 }
112 else {
113 // do nothing
114 // reset to the last value for end_layer_input
115 }
116 return;
117 }
118 }
119 m_layer_number = gui_value;
120 wxCommandEvent evt(EVT_NEED_RESORT_LAYERS);
121 wxPostEvent(m_parent, evt);
122 };
123 auto commit_layer_number_from_gui = [this, validate_input_value]() {
125 return;
126
127 auto gui_str = GetTextCtrl()->GetValue().ToStdString();
128 if (gui_str.empty()) {
129 m_layer_number = -1;
130 wxCommandEvent evt(EVT_NEED_RESORT_LAYERS);
131 wxPostEvent(m_parent, evt);
132 }
133 if (!gui_str.empty()) {
134 int gui_value = atoi(gui_str.c_str());
135 validate_input_value(gui_value);
136 }
137 update_label();
138 };
139 Bind(wxEVT_TEXT_ENTER, [commit_layer_number_from_gui](wxEvent& evt) {
140 commit_layer_number_from_gui();
141 evt.Skip();
142 });
143 Bind(wxEVT_KILL_FOCUS, [commit_layer_number_from_gui](wxFocusEvent& evt) {
144 commit_layer_number_from_gui();
145 evt.Skip();
146 });
147
148 Bind(wxEVT_COMBOBOX, [this](auto& e) {
149 if (e.GetSelection() == 0) {
151 }
152 else if (e.GetSelection() == 1) {
154 m_layer_number = -1;
155 update_label();
156 }
157 e.Skip();
158 });
159}
#define _L(s)
Definition OBJ.cpp:34
ComboBox(wxWindow *parent, wxWindowID id, const wxString &value=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, long style=0)
Definition ComboBox.cpp:47
void SetSelection(int n) override
Definition ComboBox.cpp:102
int Append(const wxString &item, const wxBitmap &bitmap=wxNullBitmap, int item_style=0)
Definition ComboBox.cpp:227
static wxFont Body_14
Definition Label.hpp:53
void set_layer_number(int layer_number)
Definition PlateSettingsDialog.cpp:173
bool is_layer_number_valid()
Definition PlateSettingsDialog.cpp:194
LayerNumberTextInput * m_another_layer_input
Definition PlateSettingsDialog.hpp:63
Type m_type
Definition PlateSettingsDialog.hpp:65
void update_label()
Definition PlateSettingsDialog.cpp:161
int m_layer_number
Definition PlateSettingsDialog.hpp:64
ValueType m_value_type
Definition PlateSettingsDialog.hpp:66
@ End
Definition PlateSettingsDialog.hpp:46
@ Custom
Definition PlateSettingsDialog.hpp:45
LayerNumberTextInput(wxWindow *parent, int layer_number, wxSize size, Type type, ValueType value_type=ValueType::Custom)
Definition PlateSettingsDialog.cpp:54
@ Begin
Definition PlateSettingsDialog.hpp:41
@ End
Definition PlateSettingsDialog.hpp:42
static constexpr int MAX_LAYER_VALUE
Definition PlateSettingsDialog.cpp:33
static constexpr int MIN_LAYER_VALUE
Definition PlateSettingsDialog.cpp:32
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15

References ComboBox::ComboBox(), LayerNumberTextInput(), _L, _L_CONTEXT, ComboBox::Append(), Begin, Label::Body_14, Custom, End, is_layer_number_valid(), m_another_layer_input, m_layer_number, m_type, m_value_type, Slic3r::GUI::MAX_LAYER_VALUE, Slic3r::GUI::MIN_LAYER_VALUE, set_layer_number(), ComboBox::SetSelection(), and update_label().

Referenced by LayerNumberTextInput(), and link().

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

Member Function Documentation

◆ Append() [1/4]

int ComboBox::Append ( const wxString & item,
const wxBitmap & bitmap,
const wxString & group,
void * clientData = nullptr,
int item_style = 0 )
inherited
247{
248 return Append(text, bitmap, group, group, clientData, style);
249}
#define style
Definition WipeTowerDialog.cpp:101

References Append(), and style.

Here is the call graph for this function:

◆ Append() [2/4]

int ComboBox::Append ( const wxString & item,
const wxBitmap & bitmap,
const wxString & group_key,
const wxString & group_label,
void * clientData = nullptr,
int item_style = 0 )
inherited
257{
258 auto valid_bit_map = bitmap.IsOk() ? bitmap : wxNullBitmap;
259 Item item{text, wxEmptyString, valid_bit_map, valid_bit_map, wxNullBitmap, clientData, group_key, group_label};
260 item.style = style;
261 items.push_back(item);
262 SetClientDataType(wxClientData_Void);
263 drop.Invalidate();
264 return items.size() - 1;
265}
DropDown::Item Item
Definition ComboBox.hpp:22
std::vector< Item > items
Definition ComboBox.hpp:23
DropDown drop
Definition ComboBox.hpp:25

References drop, items, DropDown::Item::style, and style.

◆ Append() [3/4]

int ComboBox::Append ( const wxString & item,
const wxBitmap & bitmap,
void * clientData,
int item_style = 0 )
inherited
239{
240 if (bitmap.IsOk()) {
241 return Append(text, bitmap, wxString{}, clientData, style);
242 }
243 return Append(text, wxNullBitmap, wxString{}, clientData, style);
244}

References Append(), and style.

Here is the call graph for this function:

◆ Append() [4/4]

int ComboBox::Append ( const wxString & item,
const wxBitmap & bitmap = wxNullBitmap,
int item_style = 0 )
inherited

◆ CloseDropdown()

void ComboBox::CloseDropdown ( )
inherited
306{
307 if (drop.IsShown())
308 drop.DismissAndNotify();
309}

References drop.

◆ DeleteOneItem()

void ComboBox::DeleteOneItem ( unsigned int pos)
inlineinherited
101{ DoDeleteOneItem(pos); }
void DoDeleteOneItem(unsigned int pos) override
Definition ComboBox.cpp:281

References DoDeleteOneItem().

Here is the call graph for this function:

◆ DoClear()

void ComboBox::DoClear ( )
overrideprotectedvirtualinherited
275{
276 SetIcon("drop_down");
277 items.clear();
278 drop.Invalidate(true);
279}

References drop, and items.

◆ DoDeleteOneItem()

void ComboBox::DoDeleteOneItem ( unsigned int pos)
overrideprotectedinherited
282{
283 if (pos >= items.size()) return;
284 items.erase(items.begin() + pos);
285 drop.Invalidate(true);
286}

References drop, and items.

Referenced by DeleteOneItem().

Here is the caller graph for this function:

◆ DoGetItemClientData()

void * ComboBox::DoGetItemClientData ( unsigned int n) const
overrideprotectedinherited
386{ return n < items.size() ? items[n].data : NULL; }

References items.

◆ DoInsertItems()

int ComboBox::DoInsertItems ( const wxArrayStringsAdapter & items,
unsigned int pos,
void ** clientData,
wxClientDataType type )
overrideprotectedvirtualinherited
375{
376 if (pos > this->items.size()) return -1;
377 for (int i = 0; i < items.GetCount(); ++i) {
378 Item item { items[i], wxEmptyString, wxNullBitmap, wxNullBitmap, wxNullBitmap, clientData ? clientData[i] : NULL };
379 this->items.insert(this->items.begin() + pos, item);
380 ++pos;
381 }
382 drop.Invalidate(true);
383 return pos - 1;
384}
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16

References drop, and items.

◆ DoSetItemClientData()

void ComboBox::DoSetItemClientData ( unsigned int n,
void * data )
overrideprotectedinherited
389{
390 if (n < items.size())
391 items[n].data = data;
392}

References items.

◆ ForceDropdownOpen()

void ComboBox::ForceDropdownOpen ( )
inherited
289{
290 if (!IsEnabled() || items.empty())
291 return;
292
293 if (!drop_down) {
294 drop.need_sync = true;
295 drop.messureSize();
296 drop.autoPosition();
297 drop_down = true;
298 drop.Popup(&drop);
299
300 wxCommandEvent e(wxEVT_COMBOBOX_DROPDOWN);
301 GetEventHandler()->ProcessEvent(e);
302 }
303}
bool drop_down
Definition ComboBox.hpp:26
bool IsEnabled()
Definition dark_mode.cpp:32

References drop, drop_down, and items.

Referenced by BitmapChoiceRenderer::CreateEditorCtrl().

Here is the caller graph for this function:

◆ get_input_type()

Type Slic3r::GUI::LayerNumberTextInput::get_input_type ( )
inline
55{ return m_type; }

References m_type.

◆ get_layer_number()

int Slic3r::GUI::LayerNumberTextInput::get_layer_number ( )

◆ get_value_type()

ValueType Slic3r::GUI::LayerNumberTextInput::get_value_type ( )
inline
56{ return m_value_type; }

References m_value_type.

◆ GetCount()

◆ GetDropDown()

DropDown & ComboBox::GetDropDown ( )
inlineinherited
43{ return drop; }

References drop.

Referenced by Slic3r::GUI::PlaterPresetComboBox::PlaterPresetComboBox(), Slic3r::GUI::TabPresetComboBox::TabPresetComboBox(), Slic3r::GUI::Choice::BUILD(), Slic3r::GUI::PrinterAgentChoice::BUILD(), BitmapChoiceRenderer::CreateEditorCtrl(), and Slic3r::GUI::use_nozzle_row_font().

Here is the caller graph for this function:

◆ GetFlag()

int ComboBox::GetFlag ( unsigned int n)
inherited
197{
198 if (n >= items.size())
199 return -1;
200 return items[n].flag;
201}

References items.

Referenced by Slic3r::anonymous_namespace{PluginHostPresets.cpp}::bind_filament_target(), Slic3r::GUI::Plater::priv::on_select_preset(), and Slic3r::GUI::PlaterPresetComboBox::update_badge_according_flag().

Here is the caller graph for this function:

◆ GetItemAlias()

wxString ComboBox::GetItemAlias ( unsigned int n) const
inherited
344{
345 if (n >= items.size()) return wxString();
346 return items[n].alias;
347}

References items.

Referenced by Slic3r::anonymous_namespace{PluginHostPresets.cpp}::combo_item_for_preset(), Slic3r::GUI::Plater::priv::on_select_preset(), Slic3r::anonymous_namespace{PluginHostPresets.cpp}::resolve_combo_preset(), and Slic3r::GUI::PresetComboBox::update_ams_color().

Here is the caller graph for this function:

◆ GetItemBitmap()

wxBitmap ComboBox::GetItemBitmap ( unsigned int n)
inherited
355{ return items[n].icon; }

References items.

◆ GetItemTooltip()

wxString ComboBox::GetItemTooltip ( unsigned int n) const
inherited
332{
333 if (n >= items.size()) return wxString();
334 return items[n].tip;
335}

References items.

◆ GetLabel()

wxString ComboBox::GetLabel ( ) const
overrideinherited
189{
190 if (GetTextCtrl()->IsShown() || text_off)
191 return GetTextCtrl()->GetValue();
192 else
193 return TextInput::GetLabel();
194}
bool text_off
Definition ComboBox.hpp:27

References text_off.

Referenced by GetValue().

Here is the caller graph for this function:

◆ GetSelection()

◆ GetString()

◆ GetTextLabel()

wxString ComboBox::GetTextLabel ( ) const
inherited
215{
216 return TextInput::GetLabel();
217}

◆ GetValue()

wxString ComboBox::GetValue ( ) const
inherited
141{
142 return drop.GetSelection() >= 0 ? drop.GetValue() : GetLabel();
143}
wxString GetLabel() const override
Definition ComboBox.cpp:188

References drop, and GetLabel().

Referenced by Slic3r::GUI::PlaterPresetComboBox::PlaterPresetComboBox(), Slic3r::GUI::Choice::BUILD(), Slic3r::GUI::PrinterAgentChoice::BUILD(), Slic3r::GUI::GridCellChoiceEditor::EndEdit(), Slic3r::GUI::GridCellFilamentsEditor::EndEdit(), Slic3r::GUI::IMEXModesCtrl::fix_row_name(), Slic3r::GUI::Choice::get_value(), Slic3r::GUI::IMEXModesCtrl::snapshot_row(), Slic3r::GUI::TabPrint::toggle_options(), Slic3r::GUI::CalibrateFilamentComboBox::update(), and Slic3r::GUI::PresetComboBox::update_ams_color().

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

◆ is_drop_down()

bool ComboBox::is_drop_down ( )
inlineinherited
100{return drop_down;}

References drop_down.

◆ is_layer_number_valid()

bool Slic3r::GUI::LayerNumberTextInput::is_layer_number_valid ( )
195{
197 return true;
199}

References End, m_layer_number, m_value_type, and Slic3r::GUI::MIN_LAYER_VALUE.

Referenced by LayerNumberTextInput(), and update_label().

Here is the caller graph for this function:

◆ keyDown()

void ComboBox::keyDown ( wxKeyEvent & event)
privateinherited
423{
424 switch (event.GetKeyCode()) {
425 case WXK_RETURN:
426 case WXK_SPACE:
427 if (drop_down) {
428 drop.DismissAndNotify();
429 } else if (!items.empty() && drop.HasDismissLongTime()) {
430 drop.autoPosition();
431 drop_down = true;
432 drop.Popup();
433 wxCommandEvent e(wxEVT_COMBOBOX_DROPDOWN);
434 GetEventHandler()->ProcessEvent(e);
435 }
436 break;
437 case WXK_UP:
438 case WXK_DOWN:
439 case WXK_LEFT:
440 case WXK_RIGHT: {
441 // Step over disabled rows: the mouse cannot select them either.
442 const int step = (event.GetKeyCode() == WXK_UP || event.GetKeyCode() == WXK_LEFT) ? -1 : 1;
443 int n = GetSelection() + step;
444 while (n >= 0 && n < int(items.size()) && (items[n].style & DD_ITEM_STYLE_DISABLED))
445 n += step;
446 if (n < 0 || n >= int(items.size()))
447 break;
448 SetSelection(n);
450 break;
451 }
452 case WXK_TAB:
453 HandleAsNavigationKey(event);
454 break;
455 default:
456 event.Skip();
457 break;
458 }
459}
#define DD_ITEM_STYLE_DISABLED
Definition DropDown.hpp:27
void sendComboBoxEvent()
Definition ComboBox.cpp:485
int GetSelection() const override
Definition ComboBox.cpp:98
void step(Coord &crd, const Dir d, const long n=1)
Definition MarchingSquares.hpp:213

References DD_ITEM_STYLE_DISABLED, drop, drop_down, GetSelection(), items, sendComboBoxEvent(), and SetSelection().

Here is the call graph for this function:

◆ link()

void Slic3r::GUI::LayerNumberTextInput::link ( LayerNumberTextInput * layer_input)
inline
49 {
50 if (m_another_layer_input) return;
51 m_another_layer_input = layer_input;
52 layer_input->link(this); }

References LayerNumberTextInput(), link(), and m_another_layer_input.

Referenced by Slic3r::GUI::OtherLayersSeqPanel::append_layer(), and link().

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

◆ mouseDown()

void ComboBox::mouseDown ( wxMouseEvent & event)
privateinherited
395{
396 if (!IsEnabled()) { return; } /*on mac, the event may triggered even disabled*/
397
398 SetFocus();
399 if (drop_down) {
400 drop.Hide();
401 } else if (!items.empty() && drop.HasDismissLongTime()) { // DropDown paints nothing for an empty list
402 drop.autoPosition();
403 drop_down = true;
404 drop.Popup(&drop);
405 wxCommandEvent e(wxEVT_COMBOBOX_DROPDOWN);
406 GetEventHandler()->ProcessEvent(e);
407 }
408}

References drop, drop_down, and items.

◆ mouseWheelMoved()

void ComboBox::mouseWheelMoved ( wxMouseEvent & event)
privateinherited
411{
412 event.Skip();
413 if (drop_down) return;
414 auto delta = event.GetWheelRotation() < 0 ? 1 : -1;
415 unsigned int n = GetSelection() + delta;
416 if (n < GetCount()) {
417 SetSelection((int) n);
419 }
420}
unsigned int GetCount() const override
Definition ComboBox.cpp:311

References drop_down, GetCount(), GetSelection(), sendComboBoxEvent(), and SetSelection().

Here is the call graph for this function:

◆ OnEdit()

void ComboBox::OnEdit ( )
overrideprotectedinherited
468{
469 auto value = GetTextCtrl()->GetValue();
470 SetValue(value);
471}
void SetValue(const wxString &value)
Definition ComboBox.cpp:145

References SetValue().

Here is the call graph for this function:

◆ onMove()

void ComboBox::onMove ( wxMoveEvent & event)
privateinherited
462{
463 event.Skip();
464 drop.Hide();
465}

References drop.

Referenced by ComboBox().

Here is the caller graph for this function:

◆ Rescale()

void ComboBox::Rescale ( )
overridevirtualinherited
135{
137 drop.Rescale();
138}
virtual void Rescale()
Definition TextInput.cpp:175

References drop, and TextInput::Rescale().

Referenced by Slic3r::GUI::PresetComboBox::msw_rescale().

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

◆ SelectAndNotify()

void ComboBox::SelectAndNotify ( int n)
inherited
129 {
130 SetSelection(n);
132}

References sendComboBoxEvent(), and SetSelection().

Here is the call graph for this function:

◆ sendComboBoxEvent()

void ComboBox::sendComboBoxEvent ( )
protectedinherited
486{
487 wxCommandEvent event(wxEVT_COMBOBOX, GetId());
488 event.SetEventObject(this);
489 event.SetInt(drop.GetSelection());
490 event.SetString(drop.GetValue());
491 GetEventHandler()->ProcessEvent(event);
492}

References drop.

Referenced by keyDown(), mouseWheelMoved(), and SelectAndNotify().

Here is the caller graph for this function:

◆ set_layer_number()

void Slic3r::GUI::LayerNumberTextInput::set_layer_number ( int layer_number)
174{
175 m_layer_number = layer_number;
176 if (layer_number == MAX_LAYER_VALUE)
178 else
180
182 SetSelection(0);
184 SetSelection(1);
185 update_label();
186 }
187}

References Custom, End, m_layer_number, m_value_type, Slic3r::GUI::MAX_LAYER_VALUE, ComboBox::SetSelection(), and update_label().

Referenced by LayerNumberTextInput(), and Slic3r::GUI::OtherLayersSeqPanel::append_layer().

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

◆ set_replace_text()

void ComboBox::set_replace_text ( wxString text,
wxString image_name )
inherited
314{
315 replace_text = text;
316 image_for_text = image_name;
318}
wxString image_for_text
Definition ComboBox.hpp:31
wxString replace_text
Definition ComboBox.hpp:30
bool is_replace_text_to_image
Definition ComboBox.hpp:28

References image_for_text, is_replace_text_to_image, and replace_text.

Referenced by Slic3r::GUI::PlaterPresetComboBox::update().

Here is the caller graph for this function:

◆ SetFlag()

void ComboBox::SetFlag ( unsigned int n,
int value )
inherited
203 {
204 if (n >= items.size()) return;
205 items[n].flag = value;
206 drop.Invalidate();
207}

References drop, and items.

Referenced by Slic3r::GUI::PresetComboBox::add_ams_filaments(), and Slic3r::GUI::PlaterPresetComboBox::update().

Here is the caller graph for this function:

◆ SetFont()

bool ComboBox::SetFont ( wxFont const & font)
overridevirtualinherited
220{
221 if (GetTextCtrl() && GetTextCtrl()->IsShown())
222 return GetTextCtrl()->SetFont(font);
223 else
224 return TextInput::SetFont(font);
225}

Referenced by Slic3r::GUI::PresetComboBox::PresetComboBox(), Slic3r::GUI::GridCellChoiceEditor::Create(), and Slic3r::GUI::use_nozzle_row_font().

Here is the caller graph for this function:

◆ SetItemActionBitmap()

void ComboBox::SetItemActionBitmap ( unsigned int n,
wxBitmap const & bitmap )
inherited
365{
366 if (n >= items.size()) return;
367 items[n].action_icon = bitmap.IsOk() ? bitmap : wxNullBitmap;
368 drop.Invalidate();
369}

References drop, and items.

◆ SetItemAlias()

void ComboBox::SetItemAlias ( unsigned int n,
wxString const & value )
inherited
350{
351 if (n >= items.size()) return;
352 items[n].alias = value;
353}

References items.

Referenced by Slic3r::GUI::PlaterPresetComboBox::update(), and Slic3r::GUI::TabPresetComboBox::update().

Here is the caller graph for this function:

◆ SetItemBitmap()

void ComboBox::SetItemBitmap ( unsigned int n,
wxBitmap const & bitmap )
inherited
358{
359 if (n >= items.size()) return;
360 items[n].icon = bitmap.IsOk() ? bitmap : wxNullBitmap;
361 drop.Invalidate();
362}

References drop, and items.

Referenced by Slic3r::GUI::TabPresetComboBox::update_dirty().

Here is the caller graph for this function:

◆ SetItems()

int ComboBox::SetItems ( const std::vector< DropDown::Item > & the_items)
inherited
268{
269 items = the_items;
270 drop.Invalidate();
271 return items.size() - 1;
272}

References drop, and items.

◆ SetItemTooltip()

void ComboBox::SetItemTooltip ( unsigned int n,
wxString const & value )
inherited
337 {
338 if (n >= items.size()) return;
339 items[n].tip = value;
340 if (n == drop.GetSelection()) drop.SetToolTip(value);
341}

References drop, and items.

Referenced by Slic3r::GUI::PlaterPresetComboBox::update(), and Slic3r::GUI::TabPresetComboBox::update().

Here is the caller graph for this function:

◆ SetKeepDropArrow()

void ComboBox::SetKeepDropArrow ( bool keep)
inlineinherited
48{ m_keep_drop_arrow = keep; }
bool m_keep_drop_arrow
Definition ComboBox.hpp:29

References m_keep_drop_arrow.

◆ SetLabel()

void ComboBox::SetLabel ( const wxString & label)
overrideinherited
170{
171 if (GetTextCtrl()->IsShown() || text_off)
172 GetTextCtrl()->SetValue(value);
173 else {
175 auto new_value = value;
176 if (new_value.starts_with(replace_text)) {
177 new_value.Replace(replace_text, "", false); // replace first text
179 TextInput::SetLabel(new_value);
180 return;
181 }
182 }
184 TextInput::SetLabel(value);
185 }
186}
void SetLabel(const wxString &label) override
Definition TextInput.cpp:113
void SetIcon_1(const wxString &icon)
Definition TextInput.cpp:143

References image_for_text, is_replace_text_to_image, replace_text, TextInput::SetIcon_1(), TextInput::SetLabel(), and text_off.

Referenced by Slic3r::GUI::create_select_filament_preset_checkbox(), SetSelection(), SetString(), SetValue(), and Slic3r::GUI::LayerNumberTextInput::update_label().

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

◆ SetSelection()

void ComboBox::SetSelection ( int n)
overrideinherited
103{
104 if (n == drop.selection)
105 return;
106 drop.SetSelection(n);
107 SetLabel(drop.GetValue());
108 if (drop.selection >= 0 && drop.iconSize.y > 0 && items[drop.selection].icon_textctrl.IsOk()) {
109 if (m_keep_drop_arrow) {
110 SetIcon("drop_down");
111 SetIcon_1(items[drop.selection].icon_textctrl);
112 } else {
113 SetIcon(items[drop.selection].icon_textctrl);
114 }
115 } else {
116 SetIcon("drop_down");
118 SetIcon_1(wxNullBitmap);
119 }
120
121 if (drop.selection >= 0) {
122 SetStaticTips(items[drop.selection].text_static_tips, wxNullBitmap);
123 } else {
124 SetStaticTips(wxEmptyString, wxNullBitmap);
125 }
126
127}
void SetLabel(const wxString &label) override
Definition ComboBox.cpp:169

References drop, items, m_keep_drop_arrow, and SetLabel().

Referenced by ComboBox(), Slic3r::GUI::DesignPanel::DesignPanel(), Slic3r::GUI::LayerNumberTextInput::LayerNumberTextInput(), Slic3r::GUI::GridCellChoiceEditor::BeginEdit(), Slic3r::GUI::GridCellFilamentsEditor::BeginEdit(), BitmapChoiceRenderer::CreateEditorCtrl(), Slic3r::GUI::DesignPanel::fill_body_choice(), Slic3r::GUI::DesignPanel::fill_revolve_axes(), keyDown(), mouseWheelMoved(), Slic3r::GUI::Sidebar::on_filament_count_change(), Slic3r::GUI::CalibrateFilamentComboBox::OnSelect(), Slic3r::GUI::PlaterPresetComboBox::OnSelect(), Slic3r::GUI::PresetComboBox::OnSelect(), Slic3r::GUI::TabPresetComboBox::OnSelect(), Slic3r::GUI::DesignPanel::populate_body_choices(), Slic3r::GUI::DesignPanel::populate_plane_choices(), Slic3r::GUI::DesignPanel::populate_sheet_body_choices(), Slic3r::GUI::select_nozzle_volume(), Slic3r::GUI::DesignPanel::select_sheet_choice(), SelectAndNotify(), Slic3r::GUI::LayerNumberTextInput::set_layer_number(), Slic3r::GUI::Choice::set_selection(), Slic3r::GUI::Choice::set_value(), Slic3r::GUI::Choice::set_value(), Slic3r::GUI::TabPresetComboBox::update_dirty(), Slic3r::GUI::Sidebar::update_presets(), and Slic3r::GUI::PresetComboBox::update_selection().

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

◆ SetString()

void ComboBox::SetString ( unsigned int n,
wxString const & value )
overrideinherited
324{
325 if (n >= items.size()) return;
326 items[n].text = value;
327 drop.Invalidate();
328 if (n == drop.GetSelection()) SetLabel(value);
329}

References drop, items, and SetLabel().

Referenced by Slic3r::GUI::TabPresetComboBox::update_dirty().

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

◆ SetTextLabel()

void ComboBox::SetTextLabel ( const wxString & label)
inherited
210{
211 TextInput::SetLabel(label);
212}

References TextInput::SetLabel().

Referenced by Slic3r::GUI::Choice::BUILD(), and Slic3r::GUI::PrinterAgentChoice::BUILD().

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

◆ SetValue()

void ComboBox::SetValue ( const wxString & value)
inherited
146{
147 drop.SetValue(value);
148 SetLabel(value);
149 if (drop.selection >= 0 && drop.iconSize.y > 0 && items[drop.selection].icon_textctrl.IsOk()) {
150 if (m_keep_drop_arrow) {
151 SetIcon("drop_down");
152 SetIcon_1(items[drop.selection].icon_textctrl);
153 } else {
154 SetIcon(items[drop.selection].icon_textctrl);
155 }
156 } else {
157 SetIcon("drop_down");
159 SetIcon_1(wxNullBitmap);
160 }
161
162 if (drop.selection >= 0) {
163 SetStaticTips(items[drop.selection].text_static_tips, wxNullBitmap);
164 } else {
165 SetStaticTips(wxEmptyString, wxNullBitmap);
166 }
167}

References drop, items, m_keep_drop_arrow, and SetLabel().

Referenced by Slic3r::GUI::CalibrateFilamentComboBox::load_tray(), OnEdit(), Slic3r::GUI::Choice::set_selection(), Slic3r::GUI::Choice::set_value(), and Slic3r::GUI::Choice::set_value().

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

◆ update_label()

void Slic3r::GUI::LayerNumberTextInput::update_label ( )
protected
162{
164 return;
165
166 if (!is_layer_number_valid()) {
167 SetLabel("");
168 }
169 else
170 SetLabel(std::to_string(m_layer_number));
171}

References End, is_layer_number_valid(), m_layer_number, m_value_type, and ComboBox::SetLabel().

Referenced by LayerNumberTextInput(), and set_layer_number().

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

Member Data Documentation

◆ drop

◆ drop_down

bool ComboBox::drop_down = false
privateinherited

◆ image_for_text

wxString ComboBox::image_for_text
privateinherited

Referenced by set_replace_text(), and SetLabel().

◆ is_replace_text_to_image

bool ComboBox::is_replace_text_to_image = false
privateinherited

Referenced by set_replace_text(), and SetLabel().

◆ items

◆ m_another_layer_input

LayerNumberTextInput* Slic3r::GUI::LayerNumberTextInput::m_another_layer_input { nullptr }
private
63{ nullptr };

Referenced by LayerNumberTextInput(), and link().

◆ m_keep_drop_arrow

bool ComboBox::m_keep_drop_arrow = false
privateinherited

◆ m_layer_number

int Slic3r::GUI::LayerNumberTextInput::m_layer_number
private

◆ m_type

Type Slic3r::GUI::LayerNumberTextInput::m_type
private

◆ m_value_type

ValueType Slic3r::GUI::LayerNumberTextInput::m_value_type
private

◆ replace_text

wxString ComboBox::replace_text
privateinherited

Referenced by set_replace_text(), and SetLabel().

◆ text_off

bool ComboBox::text_off = false
privateinherited

Referenced by ComboBox(), GetLabel(), and SetLabel().


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