]> git.saurik.com Git - wxWidgets.git/blame - contrib/src/xrc/xh_spin.cpp
1. minor rewrite of XRC's stock_id/stock_client handling, now guesses client id from...
[wxWidgets.git] / contrib / 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{
544fee32
VS
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);
78d14f80
VS
34 AddWindowStyles();
35}
36
37wxObject *wxSpinButtonXmlHandler::DoCreateResource()
38{
544fee32 39 XRC_MAKE_INSTANCE(control, wxSpinButton)
f2588180
VS
40
41 control->Create(m_parentAsWindow,
42 GetID(),
43 GetPosition(), GetSize(),
44 GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS),
45 GetName());
78d14f80 46
544fee32
VS
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));
78d14f80
VS
50 SetupWindow(control);
51
52 return control;
53}
54
78d14f80
VS
55bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
56{
57 return IsOfClass(node, wxT("wxSpinButton"));
58}
59
60#endif // wxUSE_SPINBTN
61
62#if wxUSE_SPINCTRL
63
64wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
65: wxXmlResourceHandler()
66{
544fee32
VS
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);
78d14f80
VS
71}
72
73wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
74{
544fee32
VS
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());
78d14f80
VS
86
87 SetupWindow(control);
88
89 return control;
90}
91
78d14f80
VS
92bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
93{
94 return IsOfClass(node, wxT("wxSpinCtrl"));
95}
96
97#endif // wxUSE_SPINCTRL