]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_spin.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_spin.cpp
3 // Purpose: XRC resource for wxSpinButton
4 // Author: Bob Mitchell
6 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
19 #include "wx/xrc/xh_spin.h"
23 #include "wx/spinbutt.h"
25 static const long DEFAULT_VALUE
= 0;
26 static const long DEFAULT_MIN
= 0;
27 static const long DEFAULT_MAX
= 100;
29 IMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler
, wxXmlResourceHandler
)
31 wxSpinButtonXmlHandler::wxSpinButtonXmlHandler()
32 : wxXmlResourceHandler()
34 XRC_ADD_STYLE(wxSP_HORIZONTAL
);
35 XRC_ADD_STYLE(wxSP_VERTICAL
);
36 XRC_ADD_STYLE(wxSP_ARROW_KEYS
);
37 XRC_ADD_STYLE(wxSP_WRAP
);
41 wxObject
*wxSpinButtonXmlHandler::DoCreateResource()
43 XRC_MAKE_INSTANCE(control
, wxSpinButton
)
45 control
->Create(m_parentAsWindow
,
47 GetPosition(), GetSize(),
48 GetStyle(wxT("style"), wxSP_VERTICAL
| wxSP_ARROW_KEYS
),
51 control
->SetValue(GetLong( wxT("value"), DEFAULT_VALUE
));
52 control
->SetRange(GetLong( wxT("min"), DEFAULT_MIN
),
53 GetLong(wxT("max"), DEFAULT_MAX
));
59 bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode
*node
)
61 return IsOfClass(node
, wxT("wxSpinButton"));
64 #endif // wxUSE_SPINBTN
68 #include "wx/spinctrl.h"
70 IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlXmlHandler
, wxXmlResourceHandler
)
72 wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
73 : wxXmlResourceHandler()
75 XRC_ADD_STYLE(wxSP_HORIZONTAL
);
76 XRC_ADD_STYLE(wxSP_VERTICAL
);
77 XRC_ADD_STYLE(wxSP_ARROW_KEYS
);
78 XRC_ADD_STYLE(wxSP_WRAP
);
79 XRC_ADD_STYLE(wxALIGN_LEFT
);
80 XRC_ADD_STYLE(wxALIGN_CENTER
);
81 XRC_ADD_STYLE(wxALIGN_RIGHT
);
84 wxObject
*wxSpinCtrlXmlHandler::DoCreateResource()
86 XRC_MAKE_INSTANCE(control
, wxSpinCtrl
)
88 control
->Create(m_parentAsWindow
,
90 GetText(wxT("value")),
91 GetPosition(), GetSize(),
92 GetStyle(wxT("style"), wxSP_ARROW_KEYS
| wxALIGN_RIGHT
),
93 GetLong(wxT("min"), DEFAULT_MIN
),
94 GetLong(wxT("max"), DEFAULT_MAX
),
95 GetLong(wxT("value"), DEFAULT_VALUE
),
98 const long base
= GetLong(wxS("base"), 10);
100 control
->SetBase(base
);
102 SetupWindow(control
);
107 bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode
*node
)
109 return IsOfClass(node
, wxT("wxSpinCtrl"));
112 #endif // wxUSE_SPINCTRL