]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_spin.cpp
implemented subclassing in XRC
[wxWidgets.git] / src / xrc / xh_spin.cpp
CommitLineData
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/////////////////////////////////////////////////////////////////////////////
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
27wxSpinButtonXmlHandler::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 );
34 AddWindowStyles();
35}
36
37wxObject *wxSpinButtonXmlHandler::DoCreateResource()
38{
f2588180
VS
39 wxSpinButton *control = wxStaticCast(m_instance, wxSpinButton);
40
41 if (!control)
42 control = new wxSpinButton;
43
44 control->Create(m_parentAsWindow,
45 GetID(),
46 GetPosition(), GetSize(),
47 GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS),
48 GetName());
78d14f80
VS
49
50 control->SetValue( GetLong( wxT("value"), wxSP_DEFAULT_VALUE) );
51 control->SetRange( GetLong( wxT("min"), wxSP_DEFAULT_MIN),
52 GetLong( wxT("max"), wxSP_DEFAULT_MAX) );
53 SetupWindow(control);
54
55 return control;
56}
57
58
59
60bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
61{
62 return IsOfClass(node, wxT("wxSpinButton"));
63}
64
65#endif // wxUSE_SPINBTN
66
67#if wxUSE_SPINCTRL
68
69wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
70: wxXmlResourceHandler()
71{
72 ADD_STYLE( wxSP_HORIZONTAL );
73 ADD_STYLE( wxSP_VERTICAL );
74 ADD_STYLE( wxSP_ARROW_KEYS );
75 ADD_STYLE( wxSP_WRAP );
76}
77
78wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
79{
80 wxSpinCtrl *control = new wxSpinCtrl(m_parentAsWindow,
81 GetID(),
82 GetText(wxT("value")),
83 GetPosition(), GetSize(),
84 GetStyle( wxT("style"), wxSP_ARROW_KEYS ),
85 GetLong( wxT("min"), wxSP_DEFAULT_MIN),
86 GetLong( wxT("max"), wxSP_DEFAULT_MAX),
87 GetLong( wxT("value"), wxSP_DEFAULT_VALUE),
88 GetName()
89 );
90
91 SetupWindow(control);
92
93 return control;
94}
95
96
97
98bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
99{
100 return IsOfClass(node, wxT("wxSpinCtrl"));
101}
102
103#endif // wxUSE_SPINCTRL