Left-align wxSpinCtrl contents by default

The default alignment of the text in wxSpinCtrl was changed to "right"
in 7e4952db83, 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.
This commit is contained in:
Vadim Zeitlin
2018-05-05 14:56:37 +02:00
parent 232d123f8d
commit f53923dd31
7 changed files with 25 additions and 24 deletions

View File

@@ -80,6 +80,7 @@ All (GUI):
- Improve stock items consistency and aesthetics (dhowland). - Improve stock items consistency and aesthetics (dhowland).
- Fix bug with missing items in overflowing AUI toolbar (Maarten Bent). - Fix bug with missing items in overflowing AUI toolbar (Maarten Bent).
- Revert to left-aligning wxSpinCtrl contents by default.
wxGTK: wxGTK:

View File

@@ -52,7 +52,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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 min = 0, double max = 100, double initial = 0,
double inc = 1, double inc = 1,
const wxString& name = wxT("wxSpinCtrl")); const wxString& name = wxT("wxSpinCtrl"));
@@ -192,7 +192,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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 min = 0, double max = 100, double initial = 0,
double inc = 1, double inc = 1,
const wxString& name = wxT("wxSpinCtrl")) const wxString& name = wxT("wxSpinCtrl"))
@@ -288,7 +288,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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, int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl")) const wxString& name = wxT("wxSpinCtrl"))
{ {
@@ -302,7 +302,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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, int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl")) const wxString& name = wxT("wxSpinCtrl"))
{ {
@@ -359,7 +359,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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 min = 0, double max = 100, double initial = 0,
double inc = 1, double inc = 1,
const wxString& name = wxT("wxSpinCtrlDouble")) const wxString& name = wxT("wxSpinCtrlDouble"))
@@ -375,7 +375,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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 min = 0, double max = 100, double initial = 0,
double inc = 1, double inc = 1,
const wxString& name = wxT("wxSpinCtrlDouble")) const wxString& name = wxT("wxSpinCtrlDouble"))

View File

@@ -97,7 +97,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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, int min = 0, int max = 100, int initial = 0,
const wxString& name = wxS("wxSpinCtrl")) const wxString& name = wxS("wxSpinCtrl"))
{ {
@@ -111,7 +111,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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, int min = 0, int max = 100, int initial = 0,
const wxString& name = wxS("wxSpinCtrl")) const wxString& name = wxS("wxSpinCtrl"))
{ {
@@ -159,7 +159,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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 min = 0, double max = 100, double initial = 0,
double inc = 1, double inc = 1,
const wxString& name = wxS("wxSpinCtrlDouble")) const wxString& name = wxS("wxSpinCtrlDouble"))
@@ -173,7 +173,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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 min = 0, double max = 100, double initial = 0,
double inc = 1, double inc = 1,
const wxString& name = wxS("wxSpinCtrlDouble")) const wxString& name = wxS("wxSpinCtrlDouble"))

View File

@@ -36,7 +36,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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, int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl")) const wxString& name = wxT("wxSpinCtrl"))
{ {
@@ -50,7 +50,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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, int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl")); const wxString& name = wxT("wxSpinCtrl"));

View File

@@ -61,7 +61,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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, int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl")); const wxString& name = wxT("wxSpinCtrl"));
@@ -70,7 +70,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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, int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl")); const wxString& name = wxT("wxSpinCtrl"));
virtual int GetBase() const wxOVERRIDE { return m_base; } virtual int GetBase() const wxOVERRIDE { return m_base; }
@@ -97,7 +97,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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 min = 0, double max = 100, double initial = 0,
double inc = 1, double inc = 1,
const wxString& name = wxT("wxSpinCtrlDouble")); const wxString& name = wxT("wxSpinCtrlDouble"));
@@ -107,7 +107,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, 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 min = 0, double max = 100, double initial = 0,
double inc = 1, double inc = 1,
const wxString& name = wxT("wxSpinCtrlDouble")); const wxString& name = wxT("wxSpinCtrlDouble"));

View File

@@ -21,12 +21,12 @@
for dialog navigation (e.g. activating the default button in the for dialog navigation (e.g. activating the default button in the
dialog) under MSW. dialog) under MSW.
@style{wxALIGN_LEFT} @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} @style{wxALIGN_CENTRE_HORIZONTAL}
Same as wxTE_CENTRE for wxTextCtrl: the text is centered. Same as wxTE_CENTRE for wxTextCtrl: the text is centered.
@style{wxALIGN_RIGHT} @style{wxALIGN_RIGHT}
Same as wxTE_RIGHT for wxTextCtrl: the text is right aligned (this is Same as wxTE_RIGHT for wxTextCtrl: the text is right aligned.
the default).
@endStyleTable @endStyleTable
@@ -98,7 +98,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, long style = wxSP_ARROW_KEYS,
int min = 0, int max = 100, int min = 0, int max = 100,
int initial = 0, const wxString& name = "wxSpinCtrl"); int initial = 0, const wxString& name = "wxSpinCtrl");
@@ -110,7 +110,7 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, long style = wxSP_ARROW_KEYS,
int min = 0, int max = 100, int min = 0, int max = 100,
int initial = 0, const wxString& name = "wxSpinCtrl"); int initial = 0, const wxString& name = "wxSpinCtrl");

View File

@@ -45,7 +45,7 @@ wxObject *wxSpinButtonXmlHandler::DoCreateResource()
control->Create(m_parentAsWindow, control->Create(m_parentAsWindow,
GetID(), GetID(),
GetPosition(), GetSize(), GetPosition(), GetSize(),
GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS), GetStyle(wxT("style"), wxSP_ARROW_KEYS),
GetName()); GetName());
control->SetValue(GetLong( wxT("value"), DEFAULT_VALUE)); control->SetValue(GetLong( wxT("value"), DEFAULT_VALUE));
@@ -96,7 +96,7 @@ wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
GetID(), GetID(),
GetText(wxT("value")), GetText(wxT("value")),
GetPosition(), GetSize(), GetPosition(), GetSize(),
GetStyle(wxT("style"), wxSP_ARROW_KEYS | wxALIGN_RIGHT), GetStyle(wxT("style"), wxSP_ARROW_KEYS),
GetLong(wxT("min"), DEFAULT_MIN), GetLong(wxT("min"), DEFAULT_MIN),
GetLong(wxT("max"), DEFAULT_MAX), GetLong(wxT("max"), DEFAULT_MAX),
GetLong(wxT("value"), DEFAULT_VALUE), GetLong(wxT("value"), DEFAULT_VALUE),
@@ -133,7 +133,7 @@ wxObject *wxSpinCtrlDoubleXmlHandler::DoCreateResource()
GetID(), GetID(),
GetText(wxS("value")), GetText(wxS("value")),
GetPosition(), GetSize(), GetPosition(), GetSize(),
GetStyle(wxS("style"), wxSP_ARROW_KEYS | wxALIGN_RIGHT), GetStyle(wxS("style"), wxSP_ARROW_KEYS),
GetFloat(wxS("min"), (float)DEFAULT_MIN), GetFloat(wxS("min"), (float)DEFAULT_MIN),
GetFloat(wxS("max"), (float)DEFAULT_MAX), GetFloat(wxS("max"), (float)DEFAULT_MAX),
GetFloat(wxS("value"), (float)DEFAULT_VALUE), GetFloat(wxS("value"), (float)DEFAULT_VALUE),