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