#ifndef slic3r_OptionsGroup_hpp_ #define slic3r_OptionsGroup_hpp_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "libslic3r/Config.hpp" #include "libslic3r/PrintConfig.hpp" #include "Field.hpp" #include "I18N.hpp" // Translate the ifdef #ifdef __WXOSX__ #define wxOSX true #else #define wxOSX false #endif #define BORDER(a, b) ((wxOSX ? a : b)) namespace Slic3r { namespace GUI { // Thrown if the building of a parameter page is canceled. class UIBuildCanceled : public std::exception {}; class OG_CustomCtrl; /// Widget type describes a function object that returns a wxWindow (our widget) and accepts a wxWidget (parent window). using widget_t = std::function;//!std::function; /// Wraps a ConfigOptionDef and adds function object for creating a side_widget. struct Option { ConfigOptionDef opt { ConfigOptionDef() }; t_config_option_key opt_id;//! {""}; widget_t side_widget {nullptr}; bool readonly {false}; bool operator==(const Option& rhs) const { return (rhs.opt_id == this->opt_id); } Option(const ConfigOptionDef& _opt, t_config_option_key id) : opt(_opt), opt_id(id) {} }; /// Represents option lines class Line : public UndoValueUIManager { bool m_is_separator{ false }; public: wxString label; wxString label_en; // untranslated English of `label`, searchable by the Speed Dial in any UI language wxString label_tooltip; std::string label_path; bool undo_to_sys{false}; // BBS: object config bool toggle_visible{true}; // BBS: hide some line size_t full_width {0}; widget_t widget {nullptr}; std::function near_label_widget{ nullptr }; wxWindow* near_label_widget_win {nullptr}; wxStaticText* label_widget {nullptr}; wxSizer* widget_sizer {nullptr}; wxSizer* extra_widget_sizer {nullptr}; //BBS: export the extra colume widget wxWindow* extra_widget_win {nullptr}; //BBS: add api to get the first option's key std::string& get_first_option_key() { return m_options[0].opt_id; } void append_option(const Option& option) { m_options.push_back(option); } void append_widget(const widget_t widget) { m_extra_widgets.push_back(widget); } // `label` and `tooltip` are the untranslated English msgids; they are translated for display. Line(wxString label, wxString tooltip) : label(_(label)), label_en(label), label_tooltip(_(tooltip)) {} Line() : m_is_separator(true) {} // `new_label` is the untranslated English msgid (an L("...") string), like the ctor's label: // it is translated for display and kept as label_en. void set_label(const wxString& new_label) { label = _(new_label); label_en = new_label; if (label_widget != nullptr) { label_widget->SetLabel(label + (label.IsEmpty() ? "" : ": ")); label_widget->Refresh(); } } bool is_separator() const { return m_is_separator; } bool has_only_option(const std::string& opt_key) const { return m_options.size() == 1 && m_options[0].opt_id == opt_key; } const std::vector& get_extra_widgets() const {return m_extra_widgets;} const std::vector