From 5979e21f2c8749dc863e56fae916c1cee587787b Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 13 May 2019 17:01:35 +0200 Subject: [PATCH] Set default width for ModeButtons to correct rendering on OnFocus under OSX --- src/slic3r/GUI/wxExtensions.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 3a36ef9c3..65ed5d5b9 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2456,7 +2456,6 @@ ModeButton::ModeButton( wxWindow * parent, const wxString& mode /* = wxEmptyString*/, const wxSize& size /* = wxDefaultSize*/, const wxPoint& pos /* = wxDefaultPosition*/) : -// wxButton(parent, id, mode, pos, wxDefaultSize/*size*/, wxBU_EXACTFIT | wxNO_BORDER), ScalableButton(parent, id, icon_name, mode, size, pos) { m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode); @@ -2513,7 +2512,14 @@ ModeSizer::ModeSizer(wxWindow *parent, int hgap/* = 10*/) : m_mode_btns.reserve(3); for (const auto& button : buttons) { - m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first)); +#ifdef __WXOSX__ + wxSize sz = parent->GetTextExtent(button.first); + // set default width for ModeButtons to correct rendering on OnFocus under OSX + sz.y += 2 * em_unit(parent); + m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first, sz)); +#else + m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first));; +#endif // __WXOSX__ } for (auto btn : m_mode_btns)