]>
Commit | Line | Data |
---|---|---|
56d2f750 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: xh_spin.cpp | |
3 | // Purpose: XML 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 | #ifdef __GNUG__ | |
12 | #pragma implementation "xh_spin.h" | |
13 | #endif | |
14 | ||
15 | // For compilers that support precompilation, includes "wx.h". | |
16 | #include "wx/wxprec.h" | |
17 | ||
18 | #ifdef __BORLANDC__ | |
19 | #pragma hdrstop | |
20 | #endif | |
21 | ||
22 | #include "wx/xml/xh_spin.h" | |
23 | #include "wx/spinctrl.h" | |
24 | ||
25 | #if wxUSE_SPINBTN | |
26 | ||
27 | wxSpinButtonXmlHandler::wxSpinButtonXmlHandler() | |
28 | : wxXmlResourceHandler() | |
29 | { | |
30 | ADD_STYLE( wxSP_HORIZONTAL ); | |
31 | ADD_STYLE( wxSP_VERTICAL ); | |
32 | ADD_STYLE( wxSP_ARROW_KEYS ); | |
33 | ADD_STYLE( wxSP_WRAP ); | |
09dc1241 | 34 | AddWindowStyles(); |
56d2f750 VS |
35 | } |
36 | ||
37 | wxObject *wxSpinButtonXmlHandler::DoCreateResource() | |
38 | { | |
ab708d5d | 39 | wxSpinButton *control = new wxSpinButton(m_parentAsWindow, |
56d2f750 VS |
40 | GetID(), |
41 | GetPosition(), GetSize(), | |
a559d708 | 42 | GetStyle( wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS ), |
56d2f750 VS |
43 | GetName() |
44 | ); | |
45 | ||
a559d708 VS |
46 | control->SetValue( GetLong( wxT("value"), wxSP_DEFAULT_VALUE) ); |
47 | control->SetRange( GetLong( wxT("min"), wxSP_DEFAULT_MIN), | |
48 | GetLong( wxT("max"), wxSP_DEFAULT_MAX) ); | |
56d2f750 VS |
49 | SetupWindow(control); |
50 | ||
51 | return control; | |
52 | } | |
53 | ||
54 | ||
55 | ||
56 | bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node) | |
57 | { | |
a559d708 | 58 | return node->GetName() == wxT("spinbutton"); |
56d2f750 VS |
59 | } |
60 | ||
61 | #endif // wxUSE_SPINBTN | |
62 | ||
63 | #if wxUSE_SPINCTRL | |
64 | ||
65 | wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler() | |
66 | : wxXmlResourceHandler() | |
67 | { | |
68 | ADD_STYLE( wxSP_HORIZONTAL ); | |
69 | ADD_STYLE( wxSP_VERTICAL ); | |
70 | ADD_STYLE( wxSP_ARROW_KEYS ); | |
71 | ADD_STYLE( wxSP_WRAP ); | |
72 | } | |
73 | ||
74 | wxObject *wxSpinCtrlXmlHandler::DoCreateResource() | |
75 | { | |
ab708d5d | 76 | wxSpinCtrl *control = new wxSpinCtrl(m_parentAsWindow, |
56d2f750 | 77 | GetID(), |
a559d708 | 78 | GetText(wxT("value")), |
56d2f750 | 79 | GetPosition(), GetSize(), |
a559d708 VS |
80 | GetStyle( wxT("style"), wxSP_ARROW_KEYS ), |
81 | GetLong( wxT("min"), wxSP_DEFAULT_MIN), | |
82 | GetLong( wxT("max"), wxSP_DEFAULT_MAX), | |
83 | GetLong( wxT("value"), wxSP_DEFAULT_VALUE), | |
56d2f750 VS |
84 | GetName() |
85 | ); | |
86 | ||
87 | SetupWindow(control); | |
88 | ||
89 | return control; | |
90 | } | |
91 | ||
92 | ||
93 | ||
94 | bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node) | |
95 | { | |
a559d708 | 96 | return IsOfClass(node, wxT("wxSpinCtrl")); |
56d2f750 VS |
97 | } |
98 | ||
99 | #endif // wxUSE_SPINCTRL |