From f53923dd313ce55baf976e9d8a572323004f9a54 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 5 May 2018 14:56:37 +0200 Subject: [PATCH] Left-align wxSpinCtrl contents by default The default alignment of the text in wxSpinCtrl was changed to "right" in 7e4952db837344e369ff9ccc7ece1f7b8c207cf1, which added alignment support (see #10621), but this made it inconsistent with the native up-down control under MSW and, perhaps more importantly, with spin controls created from XRC as the default style was never modified there and did not include wxALIGN_RIGHT. Resolve this inconsistency by reverting to left-aligning the text by default. --- docs/changes.txt | 1 + include/wx/generic/spinctlg.h | 12 ++++++------ include/wx/gtk/spinctrl.h | 8 ++++---- include/wx/msw/spinctrl.h | 4 ++-- include/wx/qt/spinctrl.h | 8 ++++---- interface/wx/spinctrl.h | 10 +++++----- src/xrc/xh_spin.cpp | 6 +++--- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index cb5d94e75b..daa8c0c192 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -80,6 +80,7 @@ All (GUI): - Improve stock items consistency and aesthetics (dhowland). - Fix bug with missing items in overflowing AUI toolbar (Maarten Bent). +- Revert to left-aligning wxSpinCtrl contents by default. wxGTK: diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index 5651c81ee9..7f5b5de50a 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -52,7 +52,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, double min = 0, double max = 100, double initial = 0, double inc = 1, const wxString& name = wxT("wxSpinCtrl")); @@ -192,7 +192,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, double min = 0, double max = 100, double initial = 0, double inc = 1, const wxString& name = wxT("wxSpinCtrl")) @@ -288,7 +288,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")) { @@ -302,7 +302,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")) { @@ -359,7 +359,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, double min = 0, double max = 100, double initial = 0, double inc = 1, const wxString& name = wxT("wxSpinCtrlDouble")) @@ -375,7 +375,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, double min = 0, double max = 100, double initial = 0, double inc = 1, const wxString& name = wxT("wxSpinCtrlDouble")) diff --git a/include/wx/gtk/spinctrl.h b/include/wx/gtk/spinctrl.h index 4972737cf2..be7e1013eb 100644 --- a/include/wx/gtk/spinctrl.h +++ b/include/wx/gtk/spinctrl.h @@ -97,7 +97,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxS("wxSpinCtrl")) { @@ -111,7 +111,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxS("wxSpinCtrl")) { @@ -159,7 +159,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, double min = 0, double max = 100, double initial = 0, double inc = 1, const wxString& name = wxS("wxSpinCtrlDouble")) @@ -173,7 +173,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, double min = 0, double max = 100, double initial = 0, double inc = 1, const wxString& name = wxS("wxSpinCtrlDouble")) diff --git a/include/wx/msw/spinctrl.h b/include/wx/msw/spinctrl.h index a85b215ce0..85363bf57d 100644 --- a/include/wx/msw/spinctrl.h +++ b/include/wx/msw/spinctrl.h @@ -36,7 +36,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")) { @@ -50,7 +50,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")); diff --git a/include/wx/qt/spinctrl.h b/include/wx/qt/spinctrl.h index f6cf3df2d1..714dc5982b 100644 --- a/include/wx/qt/spinctrl.h +++ b/include/wx/qt/spinctrl.h @@ -61,7 +61,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")); @@ -70,7 +70,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxT("wxSpinCtrl")); virtual int GetBase() const wxOVERRIDE { return m_base; } @@ -97,7 +97,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, double min = 0, double max = 100, double initial = 0, double inc = 1, const wxString& name = wxT("wxSpinCtrlDouble")); @@ -107,7 +107,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, double min = 0, double max = 100, double initial = 0, double inc = 1, const wxString& name = wxT("wxSpinCtrlDouble")); diff --git a/interface/wx/spinctrl.h b/interface/wx/spinctrl.h index ca43744bbd..f06b9b1dd7 100644 --- a/interface/wx/spinctrl.h +++ b/interface/wx/spinctrl.h @@ -21,12 +21,12 @@ for dialog navigation (e.g. activating the default button in the dialog) under MSW. @style{wxALIGN_LEFT} - Same as wxTE_LEFT for wxTextCtrl: the text is left aligned. + Same as wxTE_LEFT for wxTextCtrl: the text is left aligned (this is the + default). @style{wxALIGN_CENTRE_HORIZONTAL} Same as wxTE_CENTRE for wxTextCtrl: the text is centered. @style{wxALIGN_RIGHT} - Same as wxTE_RIGHT for wxTextCtrl: the text is right aligned (this is - the default). + Same as wxTE_RIGHT for wxTextCtrl: the text is right aligned. @endStyleTable @@ -98,7 +98,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = "wxSpinCtrl"); @@ -110,7 +110,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, + long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = "wxSpinCtrl"); diff --git a/src/xrc/xh_spin.cpp b/src/xrc/xh_spin.cpp index 314697d768..db8063c389 100644 --- a/src/xrc/xh_spin.cpp +++ b/src/xrc/xh_spin.cpp @@ -45,7 +45,7 @@ wxObject *wxSpinButtonXmlHandler::DoCreateResource() control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), - GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS), + GetStyle(wxT("style"), wxSP_ARROW_KEYS), GetName()); control->SetValue(GetLong( wxT("value"), DEFAULT_VALUE)); @@ -96,7 +96,7 @@ wxObject *wxSpinCtrlXmlHandler::DoCreateResource() GetID(), GetText(wxT("value")), GetPosition(), GetSize(), - GetStyle(wxT("style"), wxSP_ARROW_KEYS | wxALIGN_RIGHT), + GetStyle(wxT("style"), wxSP_ARROW_KEYS), GetLong(wxT("min"), DEFAULT_MIN), GetLong(wxT("max"), DEFAULT_MAX), GetLong(wxT("value"), DEFAULT_VALUE), @@ -133,7 +133,7 @@ wxObject *wxSpinCtrlDoubleXmlHandler::DoCreateResource() GetID(), GetText(wxS("value")), GetPosition(), GetSize(), - GetStyle(wxS("style"), wxSP_ARROW_KEYS | wxALIGN_RIGHT), + GetStyle(wxS("style"), wxSP_ARROW_KEYS), GetFloat(wxS("min"), (float)DEFAULT_MIN), GetFloat(wxS("max"), (float)DEFAULT_MAX), GetFloat(wxS("value"), (float)DEFAULT_VALUE),