]>
Commit | Line | Data |
---|---|---|
78d14f80 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: xh_spin.cpp | |
b5d6954b | 3 | // Purpose: XRC resource for wxSpinButton |
78d14f80 VS |
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 | ///////////////////////////////////////////////////////////////////////////// | |
f80ea77b | 10 | |
c575e45a | 11 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
78d14f80 VS |
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 | ||
621be1ec | 22 | #if wxUSE_XRC |
a1e4ec87 | 23 | |
78d14f80 | 24 | #include "wx/xrc/xh_spin.h" |
2ae23cc5 WS |
25 | |
26 | #if wxUSE_SPINBTN | |
27 | ||
28 | #include "wx/spinbutt.h" | |
78d14f80 | 29 | |
854e189f VS |
30 | IMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler, wxXmlResourceHandler) |
31 | ||
f80ea77b WS |
32 | wxSpinButtonXmlHandler::wxSpinButtonXmlHandler() |
33 | : wxXmlResourceHandler() | |
78d14f80 | 34 | { |
544fee32 VS |
35 | XRC_ADD_STYLE(wxSP_HORIZONTAL); |
36 | XRC_ADD_STYLE(wxSP_VERTICAL); | |
37 | XRC_ADD_STYLE(wxSP_ARROW_KEYS); | |
38 | XRC_ADD_STYLE(wxSP_WRAP); | |
78d14f80 VS |
39 | AddWindowStyles(); |
40 | } | |
41 | ||
42 | wxObject *wxSpinButtonXmlHandler::DoCreateResource() | |
f80ea77b | 43 | { |
544fee32 | 44 | XRC_MAKE_INSTANCE(control, wxSpinButton) |
f2588180 VS |
45 | |
46 | control->Create(m_parentAsWindow, | |
47 | GetID(), | |
48 | GetPosition(), GetSize(), | |
49 | GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS), | |
50 | GetName()); | |
78d14f80 | 51 | |
544fee32 VS |
52 | control->SetValue(GetLong( wxT("value"), wxSP_DEFAULT_VALUE)); |
53 | control->SetRange(GetLong( wxT("min"), wxSP_DEFAULT_MIN), | |
54 | GetLong(wxT("max"), wxSP_DEFAULT_MAX)); | |
78d14f80 | 55 | SetupWindow(control); |
f80ea77b | 56 | |
78d14f80 VS |
57 | return control; |
58 | } | |
59 | ||
78d14f80 VS |
60 | bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node) |
61 | { | |
62 | return IsOfClass(node, wxT("wxSpinButton")); | |
63 | } | |
64 | ||
65 | #endif // wxUSE_SPINBTN | |
66 | ||
67 | #if wxUSE_SPINCTRL | |
68 | ||
2ae23cc5 WS |
69 | #include "wx/spinctrl.h" |
70 | ||
854e189f VS |
71 | IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlXmlHandler, wxXmlResourceHandler) |
72 | ||
f80ea77b WS |
73 | wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler() |
74 | : wxXmlResourceHandler() | |
78d14f80 | 75 | { |
544fee32 VS |
76 | XRC_ADD_STYLE(wxSP_HORIZONTAL); |
77 | XRC_ADD_STYLE(wxSP_VERTICAL); | |
78 | XRC_ADD_STYLE(wxSP_ARROW_KEYS); | |
79 | XRC_ADD_STYLE(wxSP_WRAP); | |
78d14f80 VS |
80 | } |
81 | ||
82 | wxObject *wxSpinCtrlXmlHandler::DoCreateResource() | |
f80ea77b | 83 | { |
544fee32 | 84 | XRC_MAKE_INSTANCE(control, wxSpinCtrl) |
f80ea77b | 85 | |
544fee32 VS |
86 | control->Create(m_parentAsWindow, |
87 | GetID(), | |
88 | GetText(wxT("value")), | |
89 | GetPosition(), GetSize(), | |
90 | GetStyle(wxT("style"), wxSP_ARROW_KEYS), | |
91 | GetLong(wxT("min"), wxSP_DEFAULT_MIN), | |
92 | GetLong(wxT("max"), wxSP_DEFAULT_MAX), | |
93 | GetLong(wxT("value"), wxSP_DEFAULT_VALUE), | |
94 | GetName()); | |
78d14f80 VS |
95 | |
96 | SetupWindow(control); | |
f80ea77b | 97 | |
78d14f80 VS |
98 | return control; |
99 | } | |
100 | ||
78d14f80 VS |
101 | bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node) |
102 | { | |
103 | return IsOfClass(node, wxT("wxSpinCtrl")); | |
104 | } | |
105 | ||
2ae23cc5 WS |
106 | #endif // wxUSE_SPINCTRL |
107 | ||
621be1ec | 108 | #endif // wxUSE_XRC |