]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_spin.cpp
better report if the subclass factory has import problems
[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/////////////////////////////////////////////////////////////////////////////
f80ea77b 10
78d14f80
VS
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
dd47af27 18#if wxUSE_XRC
a1e4ec87 19
78d14f80 20#include "wx/xrc/xh_spin.h"
2ae23cc5
WS
21
22#if wxUSE_SPINBTN
23
24#include "wx/spinbutt.h"
78d14f80 25
854e189f
VS
26IMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler, wxXmlResourceHandler)
27
f80ea77b
WS
28wxSpinButtonXmlHandler::wxSpinButtonXmlHandler()
29: wxXmlResourceHandler()
78d14f80 30{
544fee32
VS
31 XRC_ADD_STYLE(wxSP_HORIZONTAL);
32 XRC_ADD_STYLE(wxSP_VERTICAL);
33 XRC_ADD_STYLE(wxSP_ARROW_KEYS);
34 XRC_ADD_STYLE(wxSP_WRAP);
78d14f80
VS
35 AddWindowStyles();
36}
37
38wxObject *wxSpinButtonXmlHandler::DoCreateResource()
f80ea77b 39{
544fee32 40 XRC_MAKE_INSTANCE(control, wxSpinButton)
f2588180
VS
41
42 control->Create(m_parentAsWindow,
43 GetID(),
44 GetPosition(), GetSize(),
45 GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS),
46 GetName());
78d14f80 47
544fee32
VS
48 control->SetValue(GetLong( wxT("value"), wxSP_DEFAULT_VALUE));
49 control->SetRange(GetLong( wxT("min"), wxSP_DEFAULT_MIN),
50 GetLong(wxT("max"), wxSP_DEFAULT_MAX));
78d14f80 51 SetupWindow(control);
f80ea77b 52
78d14f80
VS
53 return control;
54}
55
78d14f80
VS
56bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
57{
58 return IsOfClass(node, wxT("wxSpinButton"));
59}
60
61#endif // wxUSE_SPINBTN
62
63#if wxUSE_SPINCTRL
64
2ae23cc5
WS
65#include "wx/spinctrl.h"
66
854e189f
VS
67IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlXmlHandler, wxXmlResourceHandler)
68
f80ea77b
WS
69wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
70: wxXmlResourceHandler()
78d14f80 71{
544fee32
VS
72 XRC_ADD_STYLE(wxSP_HORIZONTAL);
73 XRC_ADD_STYLE(wxSP_VERTICAL);
74 XRC_ADD_STYLE(wxSP_ARROW_KEYS);
75 XRC_ADD_STYLE(wxSP_WRAP);
78d14f80
VS
76}
77
78wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
f80ea77b 79{
544fee32 80 XRC_MAKE_INSTANCE(control, wxSpinCtrl)
f80ea77b 81
544fee32
VS
82 control->Create(m_parentAsWindow,
83 GetID(),
84 GetText(wxT("value")),
85 GetPosition(), GetSize(),
86 GetStyle(wxT("style"), wxSP_ARROW_KEYS),
87 GetLong(wxT("min"), wxSP_DEFAULT_MIN),
88 GetLong(wxT("max"), wxSP_DEFAULT_MAX),
89 GetLong(wxT("value"), wxSP_DEFAULT_VALUE),
90 GetName());
78d14f80
VS
91
92 SetupWindow(control);
f80ea77b 93
78d14f80
VS
94 return control;
95}
96
78d14f80
VS
97bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
98{
99 return IsOfClass(node, wxT("wxSpinCtrl"));
100}
101
2ae23cc5
WS
102#endif // wxUSE_SPINCTRL
103
621be1ec 104#endif // wxUSE_XRC