]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/xrc/xh_gauge.cpp
Prevent possible divide by zero problem
[wxWidgets.git] / src / xrc / xh_gauge.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: xh_gauge.cpp
3// Purpose: XRC resource for wxGauge
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_gauge.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_gauge.h"
23#include "wx/gauge.h"
24
25#if wxUSE_GAUGE
26
27IMPLEMENT_DYNAMIC_CLASS(wxGaugeXmlHandler, wxXmlResourceHandler)
28
29wxGaugeXmlHandler::wxGaugeXmlHandler()
30: wxXmlResourceHandler()
31{
32 XRC_ADD_STYLE(wxGA_HORIZONTAL);
33 XRC_ADD_STYLE(wxGA_VERTICAL);
34 XRC_ADD_STYLE(wxGA_PROGRESSBAR);
35 XRC_ADD_STYLE(wxGA_SMOOTH); // windows only
36 AddWindowStyles();
37}
38
39wxObject *wxGaugeXmlHandler::DoCreateResource()
40{
41 XRC_MAKE_INSTANCE(control, wxGauge)
42
43 control->Create(m_parentAsWindow,
44 GetID(),
45 GetLong(wxT("range"), wxGAUGE_DEFAULT_RANGE),
46 GetPosition(), GetSize(),
47 GetStyle(),
48 wxDefaultValidator,
49 GetName());
50
51 if( HasParam(wxT("value")))
52 {
53 control->SetValue(GetLong(wxT("value")));
54 }
55 if( HasParam(wxT("shadow")))
56 {
57 control->SetShadowWidth(GetDimension(wxT("shadow")));
58 }
59 if( HasParam(wxT("bezel")))
60 {
61 control->SetBezelFace(GetDimension(wxT("bezel")));
62 }
63
64 SetupWindow(control);
65
66 return control;
67}
68
69bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
70{
71 return IsOfClass(node, wxT("wxGauge"));
72}
73
74#endif // wxUSE_GAUGE