From 999428868883d05ec184c9656786ad5251b5845b Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 16 Jul 2017 19:05:06 +0200 Subject: [PATCH] Fix positioning of ComboBoxEditor in wxPG (wxGTK) 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 | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 469dd9f680..f2a402e8fc 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -169,7 +169,7 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ #define TRANSIENT_POPUPWIN_IS_PERFECT 1 // wxPopupTransientWindow works, its child can have focus, and common // native controls work on it like normal. #define POPUPWIN_IS_PERFECT 1 // 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 // No focus ring on wxGTK #elif defined(__WXMAC__) diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 27cac190ae..b04a873ba6 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -701,6 +701,20 @@ public: return rect.width; } +#if defined(__WXMSW__) +#define wxPG_TEXTCTRLXADJUST3 0 +#elif defined(__WXGTK__) + #if defined(__WXGTK3__) + #define wxPG_TEXTCTRLXADJUST3 2 + #else + #define wxPG_TEXTCTRLXADJUST3 0 + #endif // wxGTK3/!wxGTK3 +#elif defined(__WXOSX__) +#define wxPG_TEXTCTRLXADJUST3 0 +#else +#define wxPG_TEXTCTRLXADJUST3 0 +#endif + virtual void PositionTextCtrl( int textCtrlXAdjust, int WXUNUSED(textCtrlYAdjust) ) wxOVERRIDE { @@ -709,8 +723,8 @@ public: (wxPG_XBEFOREWIDGET+wxPG_CONTROL_MARGIN+1) - 1, #endif wxOwnerDrawnComboBox::PositionTextCtrl( - textCtrlXAdjust, - 0 // Under MSW vertical position is already properly adjusted. + textCtrlXAdjust + wxPG_TEXTCTRLXADJUST3, + 0 // Under MSW, GTK vertical position is already properly adjusted. // Note: This parameter is not used by other ports. ); }