]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_gauge.cpp
using native key handling, closes #10406
[wxWidgets.git] / src / xrc / xh_gauge.cpp
CommitLineData
78d14f80 1/////////////////////////////////////////////////////////////////////////////
40ff126a 2// Name: src/xrc/xh_gauge.cpp
b5d6954b 3// Purpose: XRC resource for wxGauge
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
621be1ec 18#if wxUSE_XRC && wxUSE_GAUGE
a1e4ec87 19
78d14f80 20#include "wx/xrc/xh_gauge.h"
9d2c19f1
WS
21
22#ifndef WX_PRECOMP
23 #include "wx/gauge.h"
24#endif
78d14f80 25
033508e1
VS
26static const long DEFAULT_RANGE = 100;
27
854e189f
VS
28IMPLEMENT_DYNAMIC_CLASS(wxGaugeXmlHandler, wxXmlResourceHandler)
29
f80ea77b 30wxGaugeXmlHandler::wxGaugeXmlHandler()
9d2c19f1 31 :wxXmlResourceHandler()
78d14f80 32{
544fee32
VS
33 XRC_ADD_STYLE(wxGA_HORIZONTAL);
34 XRC_ADD_STYLE(wxGA_VERTICAL);
40ff126a 35#if WXWIN_COMPATIBILITY_2_6
544fee32 36 XRC_ADD_STYLE(wxGA_PROGRESSBAR);
40ff126a 37#endif // WXWIN_COMPATIBILITY_2_6
544fee32 38 XRC_ADD_STYLE(wxGA_SMOOTH); // windows only
78d14f80
VS
39 AddWindowStyles();
40}
41
42wxObject *wxGaugeXmlHandler::DoCreateResource()
f80ea77b 43{
544fee32 44 XRC_MAKE_INSTANCE(control, wxGauge)
f2588180
VS
45
46 control->Create(m_parentAsWindow,
47 GetID(),
033508e1 48 GetLong(wxT("range"), DEFAULT_RANGE),
f2588180
VS
49 GetPosition(), GetSize(),
50 GetStyle(),
51 wxDefaultValidator,
52 GetName());
78d14f80 53
544fee32 54 if( HasParam(wxT("value")))
78d14f80 55 {
544fee32 56 control->SetValue(GetLong(wxT("value")));
78d14f80 57 }
544fee32 58 if( HasParam(wxT("shadow")))
78d14f80 59 {
544fee32 60 control->SetShadowWidth(GetDimension(wxT("shadow")));
78d14f80 61 }
544fee32 62 if( HasParam(wxT("bezel")))
78d14f80 63 {
544fee32 64 control->SetBezelFace(GetDimension(wxT("bezel")));
78d14f80
VS
65 }
66
67 SetupWindow(control);
544fee32 68
78d14f80
VS
69 return control;
70}
71
78d14f80
VS
72bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
73{
74 return IsOfClass(node, wxT("wxGauge"));
75}
76
621be1ec 77#endif // wxUSE_XRC && wxUSE_GAUGE