diff --git a/include/wx/propgrid/propgriddefs.h b/include/wx/propgrid/propgriddefs.h index 7ccf8e7d9d..1d8ad0a88e 100644 --- a/include/wx/propgrid/propgriddefs.h +++ b/include/wx/propgrid/propgriddefs.h @@ -30,6 +30,8 @@ // Here are some platform dependent defines // NOTE: More in propertygrid.cpp // +// NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not +// (yet) support wxTextEntry::SetMargins() for the left margin. #if defined(__WXMSW__) @@ -38,6 +40,9 @@ // space between vertical line and value editor control #define wxPG_XBEFOREWIDGET 1 + // left margin can be set with wxTextEntry::SetMargins() + #undef wxPG_TEXTCTRLXADJUST + // comment to use bitmap buttons #define wxPG_ICON_WIDTH 9 // 1 if wxRendererNative should be employed @@ -67,9 +72,8 @@ #define wxPG_XBEFOREWIDGET 1 // x position adjustment for wxTextCtrl (and like) - // NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not - // (yet) support wxTextEntry::SetMargins() for the left margin. - //#define wxPG_TEXTCTRLXADJUST 3 + // left margin can be set with wxTextEntry::SetMargins() + #undef wxPG_TEXTCTRLXADJUST // comment to use bitmap buttons #define wxPG_ICON_WIDTH 9 @@ -100,6 +104,7 @@ #define wxPG_XBEFOREWIDGET 1 // x position adjustment for wxTextCtrl (and like) + // left margin cannot be set with wxTextEntry::SetMargins() #define wxPG_TEXTCTRLXADJUST 0 // comment to use bitmap buttons @@ -131,6 +136,7 @@ #define wxPG_XBEFOREWIDGET 1 // x position adjustment for wxTextCtrl (and like) + // left margin cannot be set with wxTextEntry::SetMargins() #define wxPG_TEXTCTRLXADJUST 3 // comment to use bitmap buttons diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index ccd7137883..27cac190ae 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -1856,6 +1856,20 @@ void wxPropertyGrid::CorrectEditorWidgetPosY() // Fixes position of wxTextCtrl-like control (wxSpinCtrl usually // fits into that category as well). +#ifndef wxPG_TEXTCTRLXADJUST +#if defined(__WXMSW__) +#define wxPG_TEXTCTRLXADJUST2 0 +#elif defined(__WXGTK__) + #if defined(__WXGTK3__) + #define wxPG_TEXTCTRLXADJUST2 (-2) + #else + #define wxPG_TEXTCTRLXADJUST2 0 + #endif // wxGTK3/!wxGTK3 +#else +#error "wxPG_TEXTCTRLXADJUST should be defined for this platform" +#endif +#endif // !wxPG_TEXTCTRLXADJUST + void wxPropertyGrid::FixPosForTextCtrl( wxWindow* ctrl, unsigned int WXUNUSED(forColumn), const wxPoint& offset ) @@ -1872,7 +1886,7 @@ void wxPropertyGrid::FixPosForTextCtrl( wxWindow* ctrl, finalPos.height -= (y_adj+sz_dec); #ifndef wxPG_TEXTCTRLXADJUST - int textCtrlXAdjust = wxPG_XBEFORETEXT - 1; + int textCtrlXAdjust = wxPG_XBEFORETEXT - 1 + wxPG_TEXTCTRLXADJUST2; wxTextCtrl* tc = static_cast(ctrl); tc->SetMargins(0);