mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 01:37:53 -06:00
Code refactoring of the OptionsGroup class:
Controls are created only for the active page now
This commit is contained in:
parent
aedb3892ba
commit
398ff9053d
11 changed files with 568 additions and 386 deletions
|
@ -48,6 +48,7 @@ public:
|
|||
wxString label {wxString("")};
|
||||
wxString label_tooltip {wxString("")};
|
||||
size_t full_width {0};
|
||||
wxStaticText** full_Label {nullptr};
|
||||
wxSizer* sizer {nullptr};
|
||||
widget_t widget {nullptr};
|
||||
std::function<wxWindow*(wxWindow*)> near_label_widget{ nullptr };
|
||||
|
@ -119,7 +120,15 @@ public:
|
|||
return this->stb ? (wxWindow*)this->stb : this->parent();
|
||||
}
|
||||
|
||||
void append_line(const Line& line, wxStaticText** full_Label = nullptr);
|
||||
void append_line(const Line& line);
|
||||
// create controls for the option group
|
||||
void activate_line(Line& line);
|
||||
|
||||
// create all controls for the option group from the m_lines
|
||||
void activate();
|
||||
// delete all controls from the option group
|
||||
void clear();
|
||||
|
||||
Line create_single_option_line(const Option& option) const;
|
||||
void append_single_option_line(const Option& option) { append_line(create_single_option_line(option)); }
|
||||
|
||||
|
@ -170,11 +179,7 @@ public:
|
|||
|
||||
void clear_fields_except_of(const std::vector<std::string> left_fields);
|
||||
|
||||
void hide_labels() {
|
||||
label_width = 0;
|
||||
m_grid_sizer->SetCols(m_grid_sizer->GetEffectiveColsCount()-1);
|
||||
static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(!extra_column ? 0 : 1);
|
||||
}
|
||||
void hide_labels() { label_width = 0; }
|
||||
|
||||
OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false,
|
||||
column_t extra_clmn = nullptr);
|
||||
|
@ -188,6 +193,8 @@ protected:
|
|||
std::vector<wxWindow*> m_extra_column_item_ptrs;
|
||||
std::vector<wxWindow*> m_near_label_widget_ptrs;
|
||||
|
||||
std::vector<Line> m_lines;
|
||||
|
||||
/// Field list, contains unique_ptrs of the derived type.
|
||||
/// using types that need to know what it is beyond the public interface
|
||||
/// need to cast based on the related ConfigOptionDef.
|
||||
|
@ -210,7 +217,7 @@ protected:
|
|||
const t_field& build_field(const t_config_option_key& id, const ConfigOptionDef& opt, wxStaticText* label = nullptr);
|
||||
const t_field& build_field(const t_config_option_key& id, wxStaticText* label = nullptr);
|
||||
const t_field& build_field(const Option& opt, wxStaticText* label = nullptr);
|
||||
void add_undo_buttuns_to_sizer(wxSizer* sizer, const t_field& field);
|
||||
void add_undo_buttons_to_sizer(wxSizer* sizer, const t_field& field);
|
||||
|
||||
virtual void on_kill_focus(const std::string& opt_key) {};
|
||||
virtual void on_set_focus(const std::string& opt_key);
|
||||
|
@ -259,6 +266,7 @@ public:
|
|||
// return value shows visibility : false => all options are hidden
|
||||
void Hide();
|
||||
void Show(const bool show);
|
||||
bool is_visible(ConfigOptionMode mode);
|
||||
bool update_visibility(ConfigOptionMode mode);
|
||||
void msw_rescale();
|
||||
void sys_color_changed();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue