]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_spin.cpp
Mention wxSizer::Fit() change and wxWrapSizer
[wxWidgets.git] / src / xrc / xh_spin.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_spin.cpp
3 // Purpose: XRC resource for wxSpinButton
4 // Author: Bob Mitchell
5 // Created: 2000/03/21
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_XRC
19
20 #include "wx/xrc/xh_spin.h"
21
22 #if wxUSE_SPINBTN
23
24 #include "wx/spinbutt.h"
25
26 IMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler, wxXmlResourceHandler)
27
28 wxSpinButtonXmlHandler::wxSpinButtonXmlHandler()
29 : wxXmlResourceHandler()
30 {
31 XRC_ADD_STYLE(wxSP_HORIZONTAL);
32 XRC_ADD_STYLE(wxSP_VERTICAL);
33 XRC_ADD_STYLE(wxSP_ARROW_KEYS);
34 XRC_ADD_STYLE(wxSP_WRAP);
35 AddWindowStyles();
36 }
37
38 wxObject *wxSpinButtonXmlHandler::DoCreateResource()
39 {
40 XRC_MAKE_INSTANCE(control, wxSpinButton)
41
42 control->Create(m_parentAsWindow,
43 GetID(),
44 GetPosition(), GetSize(),
45 GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS),
46 GetName());
47
48 control->SetValue(GetLong( wxT("value"), wxSP_DEFAULT_VALUE));
49 control->SetRange(GetLong( wxT("min"), wxSP_DEFAULT_MIN),
50 GetLong(wxT("max"), wxSP_DEFAULT_MAX));
51 SetupWindow(control);
52
53 return control;
54 }
55
56 bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
57 {
58 return IsOfClass(node, wxT("wxSpinButton"));
59 }
60
61 #endif // wxUSE_SPINBTN
62
63 #if wxUSE_SPINCTRL
64
65 #include "wx/spinctrl.h"
66
67 IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlXmlHandler, wxXmlResourceHandler)
68
69 wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
70 : wxXmlResourceHandler()
71 {
72 XRC_ADD_STYLE(wxSP_HORIZONTAL);
73 XRC_ADD_STYLE(wxSP_VERTICAL);
74 XRC_ADD_STYLE(wxSP_ARROW_KEYS);
75 XRC_ADD_STYLE(wxSP_WRAP);
76 }
77
78 wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
79 {
80 XRC_MAKE_INSTANCE(control, wxSpinCtrl)
81
82 control->Create(m_parentAsWindow,
83 GetID(),
84 GetText(wxT("value")),
85 GetPosition(), GetSize(),
86 GetStyle(wxT("style"), wxSP_ARROW_KEYS),
87 GetLong(wxT("min"), wxSP_DEFAULT_MIN),
88 GetLong(wxT("max"), wxSP_DEFAULT_MAX),
89 GetLong(wxT("value"), wxSP_DEFAULT_VALUE),
90 GetName());
91
92 SetupWindow(control);
93
94 return control;
95 }
96
97 bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
98 {
99 return IsOfClass(node, wxT("wxSpinCtrl"));
100 }
101
102 #endif // wxUSE_SPINCTRL
103
104 #endif // wxUSE_XRC