]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_gauge.cpp
fixes for compilation with wxUSE_XXX==0 and some other minor fixes (patch 1569904)
[wxWidgets.git] / src / xrc / xh_gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/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 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_XRC && wxUSE_GAUGE
19
20 #include "wx/xrc/xh_gauge.h"
21
22 #ifndef WX_PRECOMP
23 #include "wx/gauge.h"
24 #endif
25
26 IMPLEMENT_DYNAMIC_CLASS(wxGaugeXmlHandler, wxXmlResourceHandler)
27
28 wxGaugeXmlHandler::wxGaugeXmlHandler()
29 :wxXmlResourceHandler()
30 {
31 XRC_ADD_STYLE(wxGA_HORIZONTAL);
32 XRC_ADD_STYLE(wxGA_VERTICAL);
33 #if WXWIN_COMPATIBILITY_2_6
34 XRC_ADD_STYLE(wxGA_PROGRESSBAR);
35 #endif // WXWIN_COMPATIBILITY_2_6
36 XRC_ADD_STYLE(wxGA_SMOOTH); // windows only
37 AddWindowStyles();
38 }
39
40 wxObject *wxGaugeXmlHandler::DoCreateResource()
41 {
42 XRC_MAKE_INSTANCE(control, wxGauge)
43
44 control->Create(m_parentAsWindow,
45 GetID(),
46 GetLong(wxT("range"), wxGAUGE_DEFAULT_RANGE),
47 GetPosition(), GetSize(),
48 GetStyle(),
49 wxDefaultValidator,
50 GetName());
51
52 if( HasParam(wxT("value")))
53 {
54 control->SetValue(GetLong(wxT("value")));
55 }
56 if( HasParam(wxT("shadow")))
57 {
58 control->SetShadowWidth(GetDimension(wxT("shadow")));
59 }
60 if( HasParam(wxT("bezel")))
61 {
62 control->SetBezelFace(GetDimension(wxT("bezel")));
63 }
64
65 SetupWindow(control);
66
67 return control;
68 }
69
70 bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
71 {
72 return IsOfClass(node, wxT("wxGauge"));
73 }
74
75 #endif // wxUSE_XRC && wxUSE_GAUGE