use wxALIGN_LEFT/CENTRE/RIGHT instead of wxTE_XXX to avoid problems with the latter not being defined in wx/spinctrl.h on non-MSW platforms (see #10621)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-03-22 10:55:55 +00:00
parent c218ccee9f
commit f1ddb476b1
9 changed files with 36 additions and 35 deletions

View File

@ -503,6 +503,7 @@ All (GUI):
- Render <th> 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:

View File

@ -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"))

View File

@ -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"));

View File

@ -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"))
{

View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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),