Added workaround for the non-editable wxBitmapComboBoxs under OSXDisableAllSmartSubstitutions

+ experiments with Linux
This commit is contained in:
YuSanka 2019-03-20 11:54:48 +01:00
parent b36e4fa512
commit e2349bdd2e
3 changed files with 21 additions and 9 deletions

View file

@ -515,8 +515,20 @@ void Choice::BUILD() {
m_is_editable = true; m_is_editable = true;
temp = new wxBitmapComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size); temp = new wxBitmapComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size);
} }
else else {
temp = new wxBitmapComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY); #ifdef __WXOSX__
/* wxBitmapComboBox with wxCB_READONLY style return NULL for GetTextCtrl(),
* so ToolTip doesn't shown.
* Next workaround helps to solve this problem
*/
temp = new wxBitmapComboBox();
temp->SetTextCtrlStyle(wxTE_READONLY);
temp->Create(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr);
#else
temp = new wxBitmapComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY);
#endif //__WXOSX__
}
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
temp->SetBackgroundStyle(wxBG_STYLE_PAINT); temp->SetBackgroundStyle(wxBG_STYLE_PAINT);

View file

@ -138,7 +138,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
option_set.front().opt.sidetext.size() == 0 && option_set.front().side_widget == nullptr && option_set.front().opt.sidetext.size() == 0 && option_set.front().side_widget == nullptr &&
line.get_extra_widgets().size() == 0) { line.get_extra_widgets().size() == 0) {
wxSizer* tmp_sizer; wxSizer* tmp_sizer;
#ifdef __WXGTK__ #if 0//#ifdef __WXGTK__
tmp_sizer = new wxBoxSizer(wxVERTICAL); tmp_sizer = new wxBoxSizer(wxVERTICAL);
m_panel->SetSizer(tmp_sizer); m_panel->SetSizer(tmp_sizer);
m_panel->Layout(); m_panel->Layout();
@ -160,7 +160,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
} }
auto grid_sizer = m_grid_sizer; auto grid_sizer = m_grid_sizer;
#ifdef __WXGTK__ #if 0//#ifdef __WXGTK__
m_panel->SetSizer(m_grid_sizer); m_panel->SetSizer(m_grid_sizer);
m_panel->Layout(); m_panel->Layout();
#endif /* __WXGTK__ */ #endif /* __WXGTK__ */
@ -443,7 +443,7 @@ void ConfigOptionsGroup::Hide()
void ConfigOptionsGroup::Show(const bool show) void ConfigOptionsGroup::Show(const bool show)
{ {
sizer->ShowItems(show); sizer->ShowItems(show);
#ifdef __WXGTK__ #if 0//#ifdef __WXGTK__
m_panel->Show(show); m_panel->Show(show);
m_grid_sizer->Show(show); m_grid_sizer->Show(show);
#endif /* __WXGTK__ */ #endif /* __WXGTK__ */

View file

@ -100,13 +100,13 @@ public:
/// 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 { inline wxWindow* parent() const {
#ifdef __WXGTK__ #if 0//#ifdef __WXGTK__
return m_panel; return m_panel;
#else #else
return m_parent; return m_parent;
#endif /* __WXGTK__ */ #endif /* __WXGTK__ */
} }
#ifdef __WXGTK__ #if 0//#ifdef __WXGTK__
wxWindow* get_parent() const { wxWindow* get_parent() const {
return m_parent; return m_parent;
} }
@ -176,7 +176,7 @@ public:
m_grid_sizer = new wxFlexGridSizer(0, num_columns, 1,0); m_grid_sizer = new wxFlexGridSizer(0, num_columns, 1,0);
static_cast<wxFlexGridSizer*>(m_grid_sizer)->SetFlexibleDirection(wxBOTH/*wxHORIZONTAL*/); static_cast<wxFlexGridSizer*>(m_grid_sizer)->SetFlexibleDirection(wxBOTH/*wxHORIZONTAL*/);
static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(label_width == 0 ? 0 : !extra_column ? 1 : 2 ); static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(label_width == 0 ? 0 : !extra_column ? 1 : 2 );
#ifdef __WXGTK__ #if 0//#ifdef __WXGTK__
m_panel = new wxPanel( _parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel = new wxPanel( _parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
sizer->Fit(m_panel); sizer->Fit(m_panel);
sizer->Add(m_panel, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5); sizer->Add(m_panel, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5);
@ -204,7 +204,7 @@ protected:
// This panel is needed for correct showing of the ToolTips for Button, StaticText and CheckBox // 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 // Tooltips on GTK doesn't work inside wxStaticBoxSizer unless you insert a panel
// inside it before you insert the other controls. // inside it before you insert the other controls.
#ifdef __WXGTK__ #if 0//#ifdef__WXGTK__
wxPanel* m_panel {nullptr}; wxPanel* m_panel {nullptr};
#endif /* __WXGTK__ */ #endif /* __WXGTK__ */