]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_spin.cpp
Fixed some warnings
[wxWidgets.git] / src / xrc / xh_spin.cpp
CommitLineData
78d14f80 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/xrc/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
033508e1 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
033508e1
VS
26static const long DEFAULT_VALUE = 0;
27static const long DEFAULT_MIN = 0;
28static const long DEFAULT_MAX = 100;
29
854e189f
VS
30IMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler, wxXmlResourceHandler)
31
f80ea77b
WS
32wxSpinButtonXmlHandler::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
42wxObject *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
033508e1
VS
52 control->SetValue(GetLong( wxT("value"), DEFAULT_VALUE));
53 control->SetRange(GetLong( wxT("min"), DEFAULT_MIN),
54 GetLong(wxT("max"), DEFAULT_MAX));
78d14f80 55 SetupWindow(control);
f80ea77b 56
78d14f80
VS
57 return control;
58}
59
78d14f80
VS
60bool 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
71IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlXmlHandler, wxXmlResourceHandler)
72
f80ea77b
WS
73wxSpinCtrlXmlHandler::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);
f1ddb476
VZ
80 XRC_ADD_STYLE(wxALIGN_LEFT);
81 XRC_ADD_STYLE(wxALIGN_CENTER);
82 XRC_ADD_STYLE(wxALIGN_RIGHT);
78d14f80
VS
83}
84
85wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
f80ea77b 86{
544fee32 87 XRC_MAKE_INSTANCE(control, wxSpinCtrl)
f80ea77b 88
544fee32
VS
89 control->Create(m_parentAsWindow,
90 GetID(),
91 GetText(wxT("value")),
92 GetPosition(), GetSize(),
f1ddb476 93 GetStyle(wxT("style"), wxSP_ARROW_KEYS | wxALIGN_RIGHT),
033508e1
VS
94 GetLong(wxT("min"), DEFAULT_MIN),
95 GetLong(wxT("max"), DEFAULT_MAX),
96 GetLong(wxT("value"), DEFAULT_VALUE),
544fee32 97 GetName());
78d14f80 98
9e565667
VZ
99 const long base = GetLong(wxS("base"), 10);
100 if ( base != 10 )
101 control->SetBase(base);
102
78d14f80 103 SetupWindow(control);
f80ea77b 104
78d14f80
VS
105 return control;
106}
107
78d14f80
VS
108bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
109{
110 return IsOfClass(node, wxT("wxSpinCtrl"));
111}
112
2ae23cc5
WS
113#endif // wxUSE_SPINCTRL
114
621be1ec 115#endif // wxUSE_XRC