]> git.saurik.com Git - wxWidgets.git/commitdiff
add alignment flags support to wxSpinCtrl[Double] (closes #10621)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 22 Mar 2009 09:18:46 +0000 (09:18 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 22 Mar 2009 09:18:46 +0000 (09:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/spinctlg.h
include/wx/gtk/spinctrl.h
include/wx/msw/spinctrl.h
include/wx/osx/spinctrl.h
interface/wx/spinctrl.h
samples/widgets/spinbtn.cpp
src/generic/spinctlg.cpp
src/gtk/spinctrl.cpp
src/msw/spinctrl.cpp
src/osx/spinctrl_osx.cpp
src/xrc/xh_spin.cpp

index dbae5a17f0f685cff41e157b7527d109121a6307..dfec89c2302056f99afc1ba6cfd01d5181f1eedc 100644 (file)
@@ -50,7 +50,7 @@ public:
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrl"));
 
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrl"));
 
@@ -157,7 +157,7 @@ public:
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrl"))
     {
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrl"))
     {
@@ -232,7 +232,7 @@ public:
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
-               long style = wxSP_ARROW_KEYS,
+               long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                int min = 0, int max = 100, int initial = 0,
                const wxString& name = _T("wxSpinCtrl"))
     {
                int min = 0, int max = 100, int initial = 0,
                const wxString& name = _T("wxSpinCtrl"))
     {
@@ -244,7 +244,7 @@ public:
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"))
     {
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"))
     {
@@ -285,7 +285,7 @@ public:
                      const wxString& value = wxEmptyString,
                      const wxPoint& pos = wxDefaultPosition,
                      const wxSize& size = wxDefaultSize,
                      const wxString& value = wxEmptyString,
                      const wxPoint& pos = wxDefaultPosition,
                      const wxSize& size = wxDefaultSize,
-                     long style = wxSP_ARROW_KEYS,
+                     long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                      double min = 0, double max = 100, double initial = 0, double inc = 1,
                      const wxString& name = _T("wxSpinCtrlDouble"))
     {
                      double min = 0, double max = 100, double initial = 0, double inc = 1,
                      const wxString& name = _T("wxSpinCtrlDouble"))
     {
@@ -298,7 +298,7 @@ public:
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrlDouble"))
     {
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrlDouble"))
     {
index 2cc025425350880c6ae046b80b069931ae868152..a4c5753238bb0f4f3c24ea1e6eee875d3e9039b9 100644 (file)
@@ -30,7 +30,7 @@ public:
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrlGTKBase"));
 
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrlGTKBase"));
 
@@ -101,7 +101,7 @@ public:
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
-               long style = wxSP_ARROW_KEYS,
+               long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                int min = 0, int max = 100, int initial = 0,
                const wxString& name = _T("wxSpinCtrl"))
     {
                int min = 0, int max = 100, int initial = 0,
                const wxString& name = _T("wxSpinCtrl"))
     {
@@ -113,7 +113,7 @@ public:
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"))
     {
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"))
     {
@@ -149,7 +149,7 @@ public:
                      const wxString& value = wxEmptyString,
                      const wxPoint& pos = wxDefaultPosition,
                      const wxSize& size = wxDefaultSize,
                      const wxString& value = wxEmptyString,
                      const wxPoint& pos = wxDefaultPosition,
                      const wxSize& size = wxDefaultSize,
-                     long style = wxSP_ARROW_KEYS,
+                     long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                      double min = 0, double max = 100, double initial = 0, double inc = 1,
                      const wxString& name = _T("wxSpinCtrlDouble"))
     {
                      double min = 0, double max = 100, double initial = 0, double inc = 1,
                      const wxString& name = _T("wxSpinCtrlDouble"))
     {
@@ -161,7 +161,7 @@ public:
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrlDouble"))
     {
                 double min = 0, double max = 100, double initial = 0, double inc = 1,
                 const wxString& name = _T("wxSpinCtrlDouble"))
     {
index 036ac2b1f353011e60afea6f8a148d9def48d44f..cedd0601e54b71e4effa4457b89b1a8202736532 100644 (file)
@@ -37,7 +37,7 @@ public:
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
-               long style = wxSP_ARROW_KEYS,
+               long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                int min = 0, int max = 100, int initial = 0,
                const wxString& name = _T("wxSpinCtrl"))
     {
                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,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"));
 
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"));
 
index 38fd7a9bffd6a9a098c258ae8cc52cb570e4018a..a2f0c6223a54edf61c3fa40221cc6604a2a3ffe2 100644 (file)
@@ -43,7 +43,7 @@ public:
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
-               long style = wxSP_ARROW_KEYS,
+               long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                int min = 0, int max = 100, int initial = 0,
                const wxString& name = _T("wxSpinCtrl"))
     {
                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,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"));
 
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"));
 
@@ -135,7 +135,7 @@ public:
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                const wxString& value = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
-               long style = wxSP_ARROW_KEYS,
+               long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                int min = 0, int max = 100, int initial = 0,
                const wxString& name = _T("wxSpinCtrl"))
     {
                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,
                 const wxString& value = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
-                long style = wxSP_ARROW_KEYS,
+                long style = wxSP_ARROW_KEYS | wxTE_RIGHT,
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"))
     {
                 int min = 0, int max = 100, int initial = 0,
                 const wxString& name = _T("wxSpinCtrl"))
     {
index 80701178c3903ac9ecad72f2ff59c4b2cfa0bb4d..877aa32007e6f0669d7c6d89b9481d2563369956 100644 (file)
         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.
         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).
     @endStyleTable
 
 
     @endStyleTable
 
 
index bf396d7cb7e88c1542dd5f99e1fd094607a5c1cc..ec4b31030109c7295cf232474a14e4285a63fc1b 100644 (file)
@@ -67,6 +67,14 @@ enum
     SpinBtnPage_SpinCtrlDouble
 };
 
     SpinBtnPage_SpinCtrlDouble
 };
 
+// alignment radiobox values
+enum
+{
+    Align_Left,
+    Align_Centre,
+    Align_Right
+};
+
 // ----------------------------------------------------------------------------
 // SpinBtnWidgetsPage
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // SpinBtnWidgetsPage
 // ----------------------------------------------------------------------------
@@ -130,6 +138,7 @@ protected:
                *m_chkArrowKeys,
                *m_chkWrap,
                *m_chkProcessEnter;
                *m_chkArrowKeys,
                *m_chkWrap,
                *m_chkProcessEnter;
+   wxRadioBox *m_radioAlign;
 
     // the spinbtn and the spinctrl and the sizer containing them
     wxSpinButton *m_spinbtn;
 
     // the spinbtn and the spinctrl and the sizer containing them
     wxSpinButton *m_spinbtn;
@@ -199,6 +208,7 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book,
     m_chkArrowKeys = NULL;
     m_chkWrap = NULL;
     m_chkProcessEnter = NULL;
     m_chkArrowKeys = NULL;
     m_chkWrap = NULL;
     m_chkProcessEnter = NULL;
+    m_radioAlign = NULL;
     m_spinbtn = NULL;
     m_spinctrl = NULL;
     m_spinctrldbl = NULL;
     m_spinbtn = NULL;
     m_spinctrl = NULL;
     m_spinctrldbl = NULL;
@@ -228,6 +238,21 @@ void SpinBtnWidgetsPage::CreateContent()
 
     sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
 
 
     sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
 
+    static const wxString halign[] =
+    {
+        _T("left"),
+        _T("centre"),
+        _T("right"),
+    };
+
+    m_radioAlign = new wxRadioBox(this, wxID_ANY, _T("&Text alignment"),
+                                   wxDefaultPosition, wxDefaultSize,
+                                   WXSIZEOF(halign), halign, 1);
+
+    sizerLeft->Add(m_radioAlign, 0, wxGROW | wxALL, 5);
+
+    sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
+
     wxButton *btn = new wxButton(this, SpinBtnPage_Reset, _T("&Reset"));
     sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
 
     wxButton *btn = new wxButton(this, SpinBtnPage_Reset, _T("&Reset"));
     sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
 
@@ -291,6 +316,7 @@ void SpinBtnWidgetsPage::Reset()
     m_chkArrowKeys->SetValue(true);
     m_chkWrap->SetValue(false);
     m_chkProcessEnter->SetValue(false);
     m_chkArrowKeys->SetValue(true);
     m_chkWrap->SetValue(false);
     m_chkProcessEnter->SetValue(false);
+    m_radioAlign->SetSelection(Align_Right);
 }
 
 void SpinBtnWidgetsPage::CreateSpin()
 }
 
 void SpinBtnWidgetsPage::CreateSpin()
@@ -312,6 +338,26 @@ void SpinBtnWidgetsPage::CreateSpin()
     if ( m_chkProcessEnter->GetValue() )
         flags |= wxTE_PROCESS_ENTER;
 
     if ( m_chkProcessEnter->GetValue() )
         flags |= wxTE_PROCESS_ENTER;
 
+    int textFlags = 0;
+    switch ( m_radioAlign->GetSelection() )
+    {
+        default:
+            wxFAIL_MSG(_T("unexpected radiobox selection"));
+            // fall through
+
+        case Align_Left:
+            textFlags |= wxALIGN_LEFT;  // no-op
+            break;
+
+        case Align_Centre:
+            textFlags |= wxALIGN_CENTRE_HORIZONTAL;
+            break;
+
+        case Align_Right:
+            textFlags |= wxALIGN_RIGHT;
+            break;
+    }
+
     int val = m_min;
     if ( m_spinbtn )
     {
     int val = m_min;
     if ( m_spinbtn )
     {
@@ -334,13 +380,13 @@ void SpinBtnWidgetsPage::CreateSpin()
     m_spinctrl = new wxSpinCtrl(this, SpinBtnPage_SpinCtrl,
                                 wxString::Format(_T("%d"), val),
                                 wxDefaultPosition, wxDefaultSize,
     m_spinctrl = new wxSpinCtrl(this, SpinBtnPage_SpinCtrl,
                                 wxString::Format(_T("%d"), val),
                                 wxDefaultPosition, wxDefaultSize,
-                                flags,
+                                flags | textFlags,
                                 m_min, m_max, val);
 
     m_spinctrldbl = new wxSpinCtrlDouble(this, SpinBtnPage_SpinCtrlDouble,
                                          wxString::Format(_T("%d"), val),
                                          wxDefaultPosition, wxDefaultSize,
                                 m_min, m_max, val);
 
     m_spinctrldbl = new wxSpinCtrlDouble(this, SpinBtnPage_SpinCtrlDouble,
                                          wxString::Format(_T("%d"), val),
                                          wxDefaultPosition, wxDefaultSize,
-                                         flags,
+                                         flags | textFlags,
                                          m_min, m_max, val, 0.1);
 
     // Add spacers, labels and spin controls to the sizer.
                                          m_min, m_max, val, 0.1);
 
     // Add spacers, labels and spin controls to the sizer.
index 853b967500d96462293f009ce3ab774de15db7f9..8fc9dadc298d3bc910eff020ca2cf787d2fcb15c 100644 (file)
@@ -58,9 +58,9 @@ static const wxCoord MARGIN = 2;
 class wxSpinCtrlTextGeneric : public wxTextCtrl
 {
 public:
 class wxSpinCtrlTextGeneric : public wxTextCtrl
 {
 public:
-    wxSpinCtrlTextGeneric(wxSpinCtrlGenericBase *spin, const wxString& value)
-        : wxTextCtrl(spin->GetParent(), wxID_ANY, value, wxDefaultPosition,
-                     wxDefaultSize, wxTE_NOHIDESEL|wxTE_PROCESS_ENTER)
+    wxSpinCtrlTextGeneric(wxSpinCtrlGenericBase *spin, const wxString& value, long style=0)
+        : wxTextCtrl(spin->GetParent(), wxID_ANY, value, wxDefaultPosition, wxDefaultSize,
+                     ( style & wxALIGN_MASK ) | wxTE_NOHIDESEL | wxTE_PROCESS_ENTER)
     {
         m_spin = spin;
 
     {
         m_spin = spin;
 
@@ -197,7 +197,7 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent,
     m_max   = max;
     m_increment = increment;
 
     m_max   = max;
     m_increment = increment;
 
-    m_textCtrl   = new wxSpinCtrlTextGeneric(this, value);
+    m_textCtrl   = new wxSpinCtrlTextGeneric(this, value, style);
     m_spinButton = new wxSpinCtrlButtonGeneric(this, style);
 
     m_spin_value = m_spinButton->GetValue();
     m_spinButton = new wxSpinCtrlButtonGeneric(this, style);
 
     m_spin_value = m_spinButton->GetValue();
index 698e6f1365fb9614e86ef1c597f88a72a0aa2a39..5d1e3c18e3fc5f25e097f8f005538e311f4b9601 100644 (file)
@@ -118,6 +118,16 @@ bool wxSpinCtrlGTKBase::Create(wxWindow *parent, wxWindowID id,
     gtk_spin_button_set_value( GTK_SPIN_BUTTON(m_widget), initial);
     m_value = gtk_spin_button_get_value( GTK_SPIN_BUTTON(m_widget));
 
     gtk_spin_button_set_value( GTK_SPIN_BUTTON(m_widget), initial);
     m_value = gtk_spin_button_get_value( GTK_SPIN_BUTTON(m_widget));
 
+    gfloat align;
+    if ( HasFlag(wxTE_RIGHT) )
+        align = 1.0;
+    else if ( HasFlag(wxTE_CENTRE) )
+        align = 0.5;
+    else
+        align = 0.0;
+
+    gtk_entry_set_alignment(GTK_ENTRY(m_widget), align);
+
     gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
                               (int)(m_windowStyle & wxSP_WRAP) );
 
     gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
                               (int)(m_windowStyle & wxSP_WRAP) );
 
index 05965d0c3d7d377a6b7df701ca19c5238a36aa6c..298319ad2d127ee48746f8058ae59565e9f6a0b6 100644 (file)
@@ -335,10 +335,16 @@ bool wxSpinCtrl::Create(wxWindow *parent,
     WXDWORD exStyle = 0;
     WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ;
 
     WXDWORD exStyle = 0;
     WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ;
 
+    // propagate text alignment style to text ctrl
+    if ( style & wxTE_RIGHT )
+        msStyle |= ES_RIGHT;
+    else if ( style & wxTE_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
     // 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
-    msStyle |= ES_RIGHT | ES_NUMBER;
+    msStyle |= ES_NUMBER;
 
     // calculate the sizes: the size given is the total size for both controls
     // and we need to fit them both in the given width (height is the same)
 
     // calculate the sizes: the size given is the total size for both controls
     // and we need to fit them both in the given width (height is the same)
index a5849cde3f97a1d4ea8a511554e3ec9a16aeaf93..2704bdf77377060bd630e35c64307b04a4ac3015 100644 (file)
@@ -250,7 +250,7 @@ bool wxSpinCtrl::Create(wxWindow *parent,
     }
 
     wxSize csize = size ;
     }
 
     wxSize csize = size ;
-    m_text = new wxSpinCtrlText(this, value, style & wxTE_PROCESS_ENTER ? wxTE_PROCESS_ENTER : 0 );
+    m_text = new wxSpinCtrlText(this, value, style & ( wxTE_PROCESS_ENTER | wxALIGN_MASK ) );
     m_btn = new wxSpinCtrlButton(this, style);
 
     m_btn->SetRange(min, max);
     m_btn = new wxSpinCtrlButton(this, style);
 
     m_btn->SetRange(min, max);
index 7ac87fe3ab30ce98528a64970783f9dec492186c..5115b639d7b772cda0100e9da99f367c405e826e 100644 (file)
@@ -77,6 +77,9 @@ wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
     XRC_ADD_STYLE(wxSP_VERTICAL);
     XRC_ADD_STYLE(wxSP_ARROW_KEYS);
     XRC_ADD_STYLE(wxSP_WRAP);
     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);
 }
 
 wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
 }
 
 wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
@@ -87,7 +90,7 @@ wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
                     GetID(),
                     GetText(wxT("value")),
                     GetPosition(), GetSize(),
                     GetID(),
                     GetText(wxT("value")),
                     GetPosition(), GetSize(),
-                    GetStyle(wxT("style"), wxSP_ARROW_KEYS),
+                    GetStyle(wxT("style"), wxSP_ARROW_KEYS | wxTE_RIGHT),
                     GetLong(wxT("min"), DEFAULT_MIN),
                     GetLong(wxT("max"), DEFAULT_MAX),
                     GetLong(wxT("value"), DEFAULT_VALUE),
                     GetLong(wxT("min"), DEFAULT_MIN),
                     GetLong(wxT("max"), DEFAULT_MAX),
                     GetLong(wxT("value"), DEFAULT_VALUE),