ToolTips are showing on GTK
This commit is contained in:
parent
bb4c4d9ecf
commit
43d2027b76
@ -22,13 +22,13 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
|||||||
// is the normal type.
|
// is the normal type.
|
||||||
if (opt.gui_type.compare("select") == 0) {
|
if (opt.gui_type.compare("select") == 0) {
|
||||||
} else if (opt.gui_type.compare("select_open") == 0) {
|
} else if (opt.gui_type.compare("select_open") == 0) {
|
||||||
m_fields.emplace(id, STDMOVE(Choice::Create<Choice>(m_parent, opt, id)));
|
m_fields.emplace(id, STDMOVE(Choice::Create<Choice>(parent(), opt, id)));
|
||||||
} else if (opt.gui_type.compare("color") == 0) {
|
} else if (opt.gui_type.compare("color") == 0) {
|
||||||
m_fields.emplace(id, STDMOVE(ColourPicker::Create<ColourPicker>(m_parent, opt, id)));
|
m_fields.emplace(id, STDMOVE(ColourPicker::Create<ColourPicker>(parent(), opt, id)));
|
||||||
} else if (opt.gui_type.compare("f_enum_open") == 0 ||
|
} else if (opt.gui_type.compare("f_enum_open") == 0 ||
|
||||||
opt.gui_type.compare("i_enum_open") == 0 ||
|
opt.gui_type.compare("i_enum_open") == 0 ||
|
||||||
opt.gui_type.compare("i_enum_closed") == 0) {
|
opt.gui_type.compare("i_enum_closed") == 0) {
|
||||||
m_fields.emplace(id, STDMOVE(Choice::Create<Choice>(m_parent, opt, id)));
|
m_fields.emplace(id, STDMOVE(Choice::Create<Choice>(parent(), opt, id)));
|
||||||
} else if (opt.gui_type.compare("slider") == 0) {
|
} else if (opt.gui_type.compare("slider") == 0) {
|
||||||
} else if (opt.gui_type.compare("i_spin") == 0) { // Spinctrl
|
} else if (opt.gui_type.compare("i_spin") == 0) { // Spinctrl
|
||||||
} else {
|
} else {
|
||||||
@ -40,21 +40,21 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
|||||||
case coPercents:
|
case coPercents:
|
||||||
case coString:
|
case coString:
|
||||||
case coStrings:
|
case coStrings:
|
||||||
m_fields.emplace(id, STDMOVE(TextCtrl::Create<TextCtrl>(m_parent, opt, id)));
|
m_fields.emplace(id, STDMOVE(TextCtrl::Create<TextCtrl>(parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coBool:
|
case coBool:
|
||||||
case coBools:
|
case coBools:
|
||||||
m_fields.emplace(id, STDMOVE(CheckBox::Create<CheckBox>(m_parent, opt, id)));
|
m_fields.emplace(id, STDMOVE(CheckBox::Create<CheckBox>(parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coInt:
|
case coInt:
|
||||||
case coInts:
|
case coInts:
|
||||||
m_fields.emplace(id, STDMOVE(SpinCtrl::Create<SpinCtrl>(m_parent, opt, id)));
|
m_fields.emplace(id, STDMOVE(SpinCtrl::Create<SpinCtrl>(parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coEnum:
|
case coEnum:
|
||||||
m_fields.emplace(id, STDMOVE(Choice::Create<Choice>(m_parent, opt, id)));
|
m_fields.emplace(id, STDMOVE(Choice::Create<Choice>(parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coPoints:
|
case coPoints:
|
||||||
m_fields.emplace(id, STDMOVE(PointCtrl::Create<PointCtrl>(m_parent, opt, id)));
|
m_fields.emplace(id, STDMOVE(PointCtrl::Create<PointCtrl>(parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coNone: break;
|
case coNone: break;
|
||||||
default:
|
default:
|
||||||
|
@ -94,7 +94,13 @@ public:
|
|||||||
/// Returns a copy of the pointer of the parent wxWindow.
|
/// Returns a copy of the pointer of the parent wxWindow.
|
||||||
/// Accessor function is because users are not allowed to change the parent
|
/// Accessor function is because users are not allowed to change the parent
|
||||||
/// but defining it as const means a lot of const_casts to deal with wx functions.
|
/// but defining it as const means a lot of const_casts to deal with wx functions.
|
||||||
inline wxWindow* parent() const { return m_parent; }
|
inline wxWindow* parent() const {
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
return m_panel;
|
||||||
|
#else
|
||||||
|
return m_parent;
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
void append_line(const Line& line, wxStaticText** colored_Label = nullptr);
|
void append_line(const Line& line, wxStaticText** colored_Label = nullptr);
|
||||||
Line create_single_option_line(const Option& option) const;
|
Line create_single_option_line(const Option& option) const;
|
||||||
@ -130,8 +136,15 @@ public:
|
|||||||
m_grid_sizer = new wxFlexGridSizer(0, num_columns, 0,0);
|
m_grid_sizer = new wxFlexGridSizer(0, num_columns, 0,0);
|
||||||
static_cast<wxFlexGridSizer*>(m_grid_sizer)->SetFlexibleDirection(wxHORIZONTAL);
|
static_cast<wxFlexGridSizer*>(m_grid_sizer)->SetFlexibleDirection(wxHORIZONTAL);
|
||||||
static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(label_width != 0);
|
static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(label_width != 0);
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
m_panel = new wxPanel( _parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
|
m_panel->SetSizer(m_grid_sizer);
|
||||||
|
m_panel->Layout();
|
||||||
|
sizer->Fit(m_panel);
|
||||||
|
sizer->Add(m_panel, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5);
|
||||||
|
#else
|
||||||
sizer->Add(m_grid_sizer, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5);
|
sizer->Add(m_grid_sizer, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5);
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -147,6 +160,13 @@ protected:
|
|||||||
// "true" if option is created in preset tabs
|
// "true" if option is created in preset tabs
|
||||||
bool m_is_tab_opt{ false };
|
bool m_is_tab_opt{ false };
|
||||||
|
|
||||||
|
// This panel is needed for correct showing of the ToolTips for Button, StaticText and CheckBox
|
||||||
|
// Tooltips on GTK doesn't work inside wxStaticBoxSizer unless you insert a panel
|
||||||
|
// inside it before you insert the other controls.
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
wxPanel* m_panel {nullptr};
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
|
||||||
/// Generate a wxSizer or wxWindow from a configuration option
|
/// Generate a wxSizer or wxWindow from a configuration option
|
||||||
/// Precondition: opt resolves to a known ConfigOption
|
/// Precondition: opt resolves to a known ConfigOption
|
||||||
/// Postcondition: fields contains a wx gui object.
|
/// Postcondition: fields contains a wx gui object.
|
||||||
|
Loading…
Reference in New Issue
Block a user