]>
Commit | Line | Data |
---|---|---|
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 | #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/xrc/xh_spin.h" | |
23 | #include "wx/spinctrl.h" | |
24 | ||
25 | #if wxUSE_SPINBTN | |
26 | ||
27 | IMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler, wxXmlResourceHandler) | |
28 | ||
29 | wxSpinButtonXmlHandler::wxSpinButtonXmlHandler() | |
30 | : wxXmlResourceHandler() | |
31 | { | |
32 | XRC_ADD_STYLE(wxSP_HORIZONTAL); | |
33 | XRC_ADD_STYLE(wxSP_VERTICAL); | |
34 | XRC_ADD_STYLE(wxSP_ARROW_KEYS); | |
35 | XRC_ADD_STYLE(wxSP_WRAP); | |
36 | AddWindowStyles(); | |
37 | } | |
38 | ||
39 | wxObject *wxSpinButtonXmlHandler::DoCreateResource() | |
40 | { | |
41 | XRC_MAKE_INSTANCE(control, wxSpinButton) | |
42 | ||
43 | control->Create(m_parentAsWindow, | |
44 | GetID(), | |
45 | GetPosition(), GetSize(), | |
46 | GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS), | |
47 | GetName()); | |
48 | ||
49 | control->SetValue(GetLong( wxT("value"), wxSP_DEFAULT_VALUE)); | |
50 | control->SetRange(GetLong( wxT("min"), wxSP_DEFAULT_MIN), | |
51 | GetLong(wxT("max"), wxSP_DEFAULT_MAX)); | |
52 | SetupWindow(control); | |
53 | ||
54 | return control; | |
55 | } | |
56 | ||
57 | bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node) | |
58 | { | |
59 | return IsOfClass(node, wxT("wxSpinButton")); | |
60 | } | |
61 | ||
62 | #endif // wxUSE_SPINBTN | |
63 | ||
64 | #if wxUSE_SPINCTRL | |
65 | ||
66 | IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlXmlHandler, wxXmlResourceHandler) | |
67 | ||
68 | wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler() | |
69 | : wxXmlResourceHandler() | |
70 | { | |
71 | XRC_ADD_STYLE(wxSP_HORIZONTAL); | |
72 | XRC_ADD_STYLE(wxSP_VERTICAL); | |
73 | XRC_ADD_STYLE(wxSP_ARROW_KEYS); | |
74 | XRC_ADD_STYLE(wxSP_WRAP); | |
75 | } | |
76 | ||
77 | wxObject *wxSpinCtrlXmlHandler::DoCreateResource() | |
78 | { | |
79 | XRC_MAKE_INSTANCE(control, wxSpinCtrl) | |
80 | ||
81 | control->Create(m_parentAsWindow, | |
82 | GetID(), | |
83 | GetText(wxT("value")), | |
84 | GetPosition(), GetSize(), | |
85 | GetStyle(wxT("style"), wxSP_ARROW_KEYS), | |
86 | GetLong(wxT("min"), wxSP_DEFAULT_MIN), | |
87 | GetLong(wxT("max"), wxSP_DEFAULT_MAX), | |
88 | GetLong(wxT("value"), wxSP_DEFAULT_VALUE), | |
89 | GetName()); | |
90 | ||
91 | SetupWindow(control); | |
92 | ||
93 | return control; | |
94 | } | |
95 | ||
96 | bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node) | |
97 | { | |
98 | return IsOfClass(node, wxT("wxSpinCtrl")); | |
99 | } | |
100 | ||
101 | #endif // wxUSE_SPINCTRL |