wxBitmapComboBox under OSX and wxComboBox under other platforms is used on Manipulation panel for coordinate space choice now.

+ Fix of warning on wxBitmap.SetWidth(): deleted meaningless from wxWidgets 3.0 code
This commit is contained in:
YuSanka 2021-01-20 17:34:25 +01:00
parent 6d7d482ca1
commit 59017a7dae
3 changed files with 17 additions and 44 deletions

View file

@ -888,6 +888,7 @@ void SpinCtrl::msw_rescale()
}
#ifdef __WXOSX__
static_assert(wxMAJOR_VERSION >= 3, "Use of wxBitmapComboBox on Settings Tabs requires wxWidgets 3.0 and newer");
using choice_ctrl = wxBitmapComboBox;
#else
using choice_ctrl = wxComboBox;
@ -942,22 +943,6 @@ void Choice::BUILD() {
set_selection();
}
#ifdef __WXOSX__
//#ifndef __WXGTK__
/* Workaround for a correct rendering of the control without Bitmap (under MSW and OSX):
*
* 1. We should create small Bitmap to fill Bitmaps RefData,
* ! in this case wxBitmap.IsOK() return true.
* 2. But then set width to 0 value for no using of bitmap left and right spacing
* 3. Set this empty bitmap to the at list one item and BitmapCombobox will be recreated correct
*
* Note: Set bitmap height to the Font size because of OSX rendering.
*/
wxBitmap empty_bmp(1, temp->GetFont().GetPixelSize().y + 2);
empty_bmp.SetWidth(0);
temp->SetItemBitmap(0, empty_bmp);
#endif
temp->Bind(wxEVT_MOUSEWHEEL, [this](wxMouseEvent& e) {
if (m_suppress_scroll && !m_is_dropped)
e.StopPropagation();
@ -1289,10 +1274,6 @@ void Choice::msw_rescale()
}
}
wxBitmap empty_bmp(1, field->GetFont().GetPixelSize().y + 2);
empty_bmp.SetWidth(0);
field->SetItemBitmap(0, empty_bmp);
idx == m_opt.enum_values.size() ?
field->SetValue(selection) :
field->SetSelection(idx);