]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_gauge.cpp
Sizing fixes for generic control.
[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
854e189f
VS
26IMPLEMENT_DYNAMIC_CLASS(wxGaugeXmlHandler, wxXmlResourceHandler)
27
f80ea77b 28wxGaugeXmlHandler::wxGaugeXmlHandler()
9d2c19f1 29 :wxXmlResourceHandler()
78d14f80 30{
544fee32
VS
31 XRC_ADD_STYLE(wxGA_HORIZONTAL);
32 XRC_ADD_STYLE(wxGA_VERTICAL);
40ff126a 33#if WXWIN_COMPATIBILITY_2_6
544fee32 34 XRC_ADD_STYLE(wxGA_PROGRESSBAR);
40ff126a 35#endif // WXWIN_COMPATIBILITY_2_6
544fee32 36 XRC_ADD_STYLE(wxGA_SMOOTH); // windows only
78d14f80
VS
37 AddWindowStyles();
38}
39
40wxObject *wxGaugeXmlHandler::DoCreateResource()
f80ea77b 41{
544fee32 42 XRC_MAKE_INSTANCE(control, wxGauge)
f2588180
VS
43
44 control->Create(m_parentAsWindow,
45 GetID(),
f80ea77b 46 GetLong(wxT("range"), wxGAUGE_DEFAULT_RANGE),
f2588180
VS
47 GetPosition(), GetSize(),
48 GetStyle(),
49 wxDefaultValidator,
50 GetName());
78d14f80 51
544fee32 52 if( HasParam(wxT("value")))
78d14f80 53 {
544fee32 54 control->SetValue(GetLong(wxT("value")));
78d14f80 55 }
544fee32 56 if( HasParam(wxT("shadow")))
78d14f80 57 {
544fee32 58 control->SetShadowWidth(GetDimension(wxT("shadow")));
78d14f80 59 }
544fee32 60 if( HasParam(wxT("bezel")))
78d14f80 61 {
544fee32 62 control->SetBezelFace(GetDimension(wxT("bezel")));
78d14f80
VS
63 }
64
65 SetupWindow(control);
544fee32 66
78d14f80
VS
67 return control;
68}
69
78d14f80
VS
70bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
71{
72 return IsOfClass(node, wxT("wxGauge"));
73}
74
621be1ec 75#endif // wxUSE_XRC && wxUSE_GAUGE