diff --git a/docs/changes.txt b/docs/changes.txt
index e088b7ed12..532d531ab2 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -503,6 +503,7 @@ All (GUI):
- Render
element contents in bold in wxHTML.
- Added wxGrid::{Set,Get}{Row,Col}Sizes() methods (Andrey Putrin).
- Add support for wxSP_WRAP in the generic version of wxSpinCtrlDouble.
+- Add alignment flags support to wxSpinCtrl[Double] (Andrew Radke).
- Added wxGetSelectedChoices() replacing wxGetMultipleChoices() (Kolya Kosenko).
wxGTK:
diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h
index 0cc65d090d..1fe9c2b984 100644
--- a/include/wx/generic/spinctlg.h
+++ b/include/wx/generic/spinctlg.h
@@ -50,7 +50,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
double min = 0, double max = 100, double initial = 0,
double inc = 1,
const wxString& name = _T("wxSpinCtrl"));
@@ -158,7 +158,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
double min = 0, double max = 100, double initial = 0,
double inc = 1,
const wxString& name = _T("wxSpinCtrl"))
@@ -243,7 +243,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"))
{
@@ -255,7 +255,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"))
{
@@ -299,7 +299,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
double min = 0, double max = 100, double initial = 0,
double inc = 1,
const wxString& name = _T("wxSpinCtrlDouble"))
@@ -314,7 +314,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
double min = 0, double max = 100, double initial = 0,
double inc = 1,
const wxString& name = _T("wxSpinCtrlDouble"))
diff --git a/include/wx/msw/spinctrl.h b/include/wx/msw/spinctrl.h
index cedd0601e5..3e533ed091 100644
--- a/include/wx/msw/spinctrl.h
+++ b/include/wx/msw/spinctrl.h
@@ -37,7 +37,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"))
{
@@ -49,7 +49,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"));
diff --git a/include/wx/osx/spinctrl.h b/include/wx/osx/spinctrl.h
index a2f0c6223a..efc6f7f554 100644
--- a/include/wx/osx/spinctrl.h
+++ b/include/wx/osx/spinctrl.h
@@ -20,7 +20,7 @@
// without tons of #ifdefs.
// ----------------------------------------------------------------------------
-#if wxUSE_SPINBTN
+#if wxUSE_SPINBTN
#include "wx/containr.h"
@@ -43,7 +43,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"))
{
@@ -56,7 +56,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"));
@@ -107,10 +107,10 @@ private:
// the subcontrols
wxTextCtrl *m_text;
wxSpinButton *m_btn;
-
+
friend class wxSpinCtrlText;
friend class wxSpinCtrlButton;
-
+
int m_oldValue;
private:
DECLARE_EVENT_TABLE()
@@ -135,7 +135,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"))
{
@@ -147,7 +147,7 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
int min = 0, int max = 100, int initial = 0,
const wxString& name = _T("wxSpinCtrl"))
{
diff --git a/interface/wx/spinctrl.h b/interface/wx/spinctrl.h
index 877aa32007..62e6f93eaa 100644
--- a/interface/wx/spinctrl.h
+++ b/interface/wx/spinctrl.h
@@ -21,13 +21,13 @@
events. Using this style will prevent the user from using the Enter key
for dialog navigation (e.g. activating the default button in the
dialog) under MSW.
- @style{wxTE_LEFT}
- Same as for wxTextCtrl: the text is left aligned.
- @style{wxTE_CENTER}
- Same as for wxTextCtrl: the text is centered.
- @style{wxTE_RIGHT}
- Same as for wxTextCtrl: the text is right aligned (this is the
- default).
+ @style{wxALIGN_LEFT}
+ Same as wxTE_LEFT for wxTextCtrl: the text is left aligned.
+ @style{wxALIGN_CENTRE}
+ 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).
@endStyleTable
diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp
index 5d1e3c18e3..5c53cd491a 100644
--- a/src/gtk/spinctrl.cpp
+++ b/src/gtk/spinctrl.cpp
@@ -119,9 +119,9 @@ bool wxSpinCtrlGTKBase::Create(wxWindow *parent, wxWindowID id,
m_value = gtk_spin_button_get_value( GTK_SPIN_BUTTON(m_widget));
gfloat align;
- if ( HasFlag(wxTE_RIGHT) )
+ if ( HasFlag(wxALIGN_RIGHT) )
align = 1.0;
- else if ( HasFlag(wxTE_CENTRE) )
+ else if ( HasFlag(wxALIGN_CENTRE) )
align = 0.5;
else
align = 0.0;
diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp
index 298319ad2d..d7a13374d0 100644
--- a/src/msw/spinctrl.cpp
+++ b/src/msw/spinctrl.cpp
@@ -336,11 +336,11 @@ bool wxSpinCtrl::Create(wxWindow *parent,
WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ;
// propagate text alignment style to text ctrl
- if ( style & wxTE_RIGHT )
+ if ( style & wxALIGN_RIGHT )
msStyle |= ES_RIGHT;
- else if ( style & wxTE_CENTER )
+ else if ( style & wxALIGN_CENTER )
msStyle |= ES_CENTER;
-
+
// this control is used for numeric entry so normally using these flags by
// default shouldn't be a problem, if it is we can always add a style such
// as wxSP_NON_NUMERIC later
@@ -481,7 +481,7 @@ void wxSpinCtrl::SetValue(const wxString& text)
void wxSpinCtrl::SetValue(int val)
{
m_blockEvent = true;
-
+
wxSpinButton::SetValue(val);
// normally setting the value of the spin button is enough as it updates
@@ -497,7 +497,7 @@ void wxSpinCtrl::SetValue(int val)
}
m_oldValue = GetValue();
-
+
m_blockEvent = false;
}
diff --git a/src/osx/spinctrl_osx.cpp b/src/osx/spinctrl_osx.cpp
index 2704bdf773..1a582d7f6c 100644
--- a/src/osx/spinctrl_osx.cpp
+++ b/src/osx/spinctrl_osx.cpp
@@ -66,7 +66,7 @@ protected:
event.SetEventObject( GetParent() );
GetParent()->HandleWindowEvent(event);
}
-
+
void OnKillFocus(wxFocusEvent& event)
{
long l;
@@ -102,7 +102,7 @@ protected:
m_spin->m_oldValue = l;
}
-
+
// delegate to parent control
event.SetEventObject( GetParent() );
GetParent()->HandleWindowEvent(event);
diff --git a/src/xrc/xh_spin.cpp b/src/xrc/xh_spin.cpp
index 5115b639d7..5684e74777 100644
--- a/src/xrc/xh_spin.cpp
+++ b/src/xrc/xh_spin.cpp
@@ -77,9 +77,9 @@ wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
XRC_ADD_STYLE(wxSP_VERTICAL);
XRC_ADD_STYLE(wxSP_ARROW_KEYS);
XRC_ADD_STYLE(wxSP_WRAP);
- XRC_ADD_STYLE(wxTE_LEFT);
- XRC_ADD_STYLE(wxTE_CENTER);
- XRC_ADD_STYLE(wxTE_RIGHT);
+ XRC_ADD_STYLE(wxALIGN_LEFT);
+ XRC_ADD_STYLE(wxALIGN_CENTER);
+ XRC_ADD_STYLE(wxALIGN_RIGHT);
}
wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
@@ -90,7 +90,7 @@ wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
- GetStyle(wxT("style"), wxSP_ARROW_KEYS | wxTE_RIGHT),
+ GetStyle(wxT("style"), wxSP_ARROW_KEYS | wxALIGN_RIGHT),
GetLong(wxT("min"), DEFAULT_MIN),
GetLong(wxT("max"), DEFAULT_MAX),
GetLong(wxT("value"), DEFAULT_VALUE),
|