]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_spin.cpp
GetMenuBar() now traverses up the hierarchy so it no longer has to be done here.
[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
854e189f
VS
27IMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler, wxXmlResourceHandler)
28
78d14f80
VS
29wxSpinButtonXmlHandler::wxSpinButtonXmlHandler()
30: wxXmlResourceHandler()
31{
544fee32
VS
32 XRC_ADD_STYLE(wxSP_HORIZONTAL);
33 XRC_ADD_STYLE(wxSP_VERTICAL);
34 XRC_ADD_STYLE(wxSP_ARROW_KEYS);
35 XRC_ADD_STYLE(wxSP_WRAP);
78d14f80
VS
36 AddWindowStyles();
37}
38
39wxObject *wxSpinButtonXmlHandler::DoCreateResource()
40{
544fee32 41 XRC_MAKE_INSTANCE(control, wxSpinButton)
f2588180
VS
42
43 control->Create(m_parentAsWindow,
44 GetID(),
45 GetPosition(), GetSize(),
46 GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS),
47 GetName());
78d14f80 48
544fee32
VS
49 control->SetValue(GetLong( wxT("value"), wxSP_DEFAULT_VALUE));
50 control->SetRange(GetLong( wxT("min"), wxSP_DEFAULT_MIN),
51 GetLong(wxT("max"), wxSP_DEFAULT_MAX));
78d14f80
VS
52 SetupWindow(control);
53
54 return control;
55}
56
78d14f80
VS
57bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
58{
59 return IsOfClass(node, wxT("wxSpinButton"));
60}
61
62#endif // wxUSE_SPINBTN
63
64#if wxUSE_SPINCTRL
65
854e189f
VS
66IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlXmlHandler, wxXmlResourceHandler)
67
78d14f80
VS
68wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
69: wxXmlResourceHandler()
70{
544fee32
VS
71 XRC_ADD_STYLE(wxSP_HORIZONTAL);
72 XRC_ADD_STYLE(wxSP_VERTICAL);
73 XRC_ADD_STYLE(wxSP_ARROW_KEYS);
74 XRC_ADD_STYLE(wxSP_WRAP);
78d14f80
VS
75}
76
77wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
78{
544fee32
VS
79 XRC_MAKE_INSTANCE(control, wxSpinCtrl)
80
81 control->Create(m_parentAsWindow,
82 GetID(),
83 GetText(wxT("value")),
84 GetPosition(), GetSize(),
85 GetStyle(wxT("style"), wxSP_ARROW_KEYS),
86 GetLong(wxT("min"), wxSP_DEFAULT_MIN),
87 GetLong(wxT("max"), wxSP_DEFAULT_MAX),
88 GetLong(wxT("value"), wxSP_DEFAULT_VALUE),
89 GetName());
78d14f80
VS
90
91 SetupWindow(control);
92
93 return control;
94}
95
78d14f80
VS
96bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
97{
98 return IsOfClass(node, wxT("wxSpinCtrl"));
99}
100
101#endif // wxUSE_SPINCTRL