]> git.saurik.com Git - wxWidgets.git/blame_incremental - contrib/src/xml/xh_spin.cpp
standardized syntax of bool properties: '1' means true, anything else false
[wxWidgets.git] / contrib / src / xml / xh_spin.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: xh_spin.cpp
3// Purpose: XML 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/xml/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}
35
36wxObject *wxSpinButtonXmlHandler::DoCreateResource()
37{
38 wxSpinButton *control = new wxSpinButton(m_ParentAsWindow,
39 GetID(),
40 GetPosition(), GetSize(),
41 GetStyle( _T("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS ),
42 GetName()
43 );
44
45 control->SetValue( GetLong( _T("value"), wxSP_DEFAULT_VALUE) );
46 control->SetRange( GetLong( _T("min"), wxSP_DEFAULT_MIN),
47 GetLong( _T("max"), wxSP_DEFAULT_MAX) );
48 SetupWindow(control);
49
50 return control;
51}
52
53
54
55bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
56{
57 return node->GetName() == _T("spinbutton");
58}
59
60#endif // wxUSE_SPINBTN
61
62#if wxUSE_SPINCTRL
63
64wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
65: wxXmlResourceHandler()
66{
67 ADD_STYLE( wxSP_HORIZONTAL );
68 ADD_STYLE( wxSP_VERTICAL );
69 ADD_STYLE( wxSP_ARROW_KEYS );
70 ADD_STYLE( wxSP_WRAP );
71}
72
73wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
74{
75 wxSpinCtrl *control = new wxSpinCtrl(m_ParentAsWindow,
76 GetID(),
77 GetText(_T("label")),
78 GetPosition(), GetSize(),
79 GetStyle( _T("style"), wxSP_ARROW_KEYS ),
80 GetLong( _T("min"), wxSP_DEFAULT_MIN),
81 GetLong( _T("max"), wxSP_DEFAULT_MAX),
82 GetLong( _T("value"), wxSP_DEFAULT_VALUE),
83 GetName()
84 );
85
86 SetupWindow(control);
87
88 return control;
89}
90
91
92
93bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
94{
95 return node->GetName() == _T("spinctrl");
96}
97
98#endif // wxUSE_SPINCTRL