From dd9c08447e37c20f4b328d7a52f6c1edd43298be Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 16 Jul 2017 19:13:04 +0200 Subject: [PATCH] Fix positioning of ComboBoxEditor in wxPG (wxOSX) Position of the combo box editor associated with properties having custom bitmaps like e.g. ColourProperty, needs to be adjusted in order to display edited text at the same position as the text which is displayed as a property value prior to the editing. --- src/common/combocmn.cpp | 2 +- src/propgrid/editors.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index f2a402e8fc..90317c26b2 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -199,7 +199,7 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ #define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common // native controls work on it like normal. #define POPUPWIN_IS_PERFECT 0 // Same, but for non-transient popup window. -#define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered +#define TEXTCTRL_TEXT_CENTERED 0 // 1 if text in textctrl is vertically centered #define FOCUS_RING 0 #endif diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index bb93b5d1cb..7288acd256 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -710,7 +710,7 @@ public: #define wxPG_TEXTCTRLXADJUST3 0 #endif // wxGTK3/!wxGTK3 #elif defined(__WXOSX__) -#define wxPG_TEXTCTRLXADJUST3 0 +#define wxPG_TEXTCTRLXADJUST3 6 #else #define wxPG_TEXTCTRLXADJUST3 0 #endif @@ -724,8 +724,7 @@ public: #endif wxOwnerDrawnComboBox::PositionTextCtrl( textCtrlXAdjust + wxPG_TEXTCTRLXADJUST3, - 0 // Under MSW, GTK vertical position is already properly adjusted. - // Note: This parameter is not used by other ports. + 0 ); } @@ -1019,8 +1018,6 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid, wxArrayString labels = choices.GetLabels(); - wxPGComboBox* cb; - wxPoint po(pos); wxSize si(sz); po.y += wxPG_CHOICEYADJUST; @@ -1054,7 +1051,7 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid, labels.Add(propGrid->GetCommonValueLabel(i)); } - cb = new wxPGComboBox(); + wxPGComboBox* cb = new wxPGComboBox(); #ifdef __WXMSW__ cb->Hide(); #endif @@ -1066,7 +1063,11 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid, labels, odcbFlags); + // Under OSX default button seems to look fine + // so there is no need to change it. +#ifndef __WXOSX__ cb->SetButtonPosition(si.y,0,wxRIGHT); +#endif // !__WXOSX__ cb->SetMargins(wxPG_XBEFORETEXT-1); // Set hint text