]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_gauge.cpp
Remove all lines containing cvs/svn "$Id$" keyword.
[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 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 #if wxUSE_XRC && wxUSE_GAUGE
18
19 #include "wx/xrc/xh_gauge.h"
20
21 #ifndef WX_PRECOMP
22 #include "wx/gauge.h"
23 #endif
24
25 static const long DEFAULT_RANGE = 100;
26
27 IMPLEMENT_DYNAMIC_CLASS(wxGaugeXmlHandler, wxXmlResourceHandler)
28
29 wxGaugeXmlHandler::wxGaugeXmlHandler()
30 :wxXmlResourceHandler()
31 {
32 XRC_ADD_STYLE(wxGA_HORIZONTAL);
33 XRC_ADD_STYLE(wxGA_VERTICAL);
34 #if WXWIN_COMPATIBILITY_2_6
35 XRC_ADD_STYLE(wxGA_PROGRESSBAR);
36 #endif // WXWIN_COMPATIBILITY_2_6
37 XRC_ADD_STYLE(wxGA_SMOOTH); // windows only
38 AddWindowStyles();
39 }
40
41 wxObject *wxGaugeXmlHandler::DoCreateResource()
42 {
43 XRC_MAKE_INSTANCE(control, wxGauge)
44
45 control->Create(m_parentAsWindow,
46 GetID(),
47 GetLong(wxT("range"), DEFAULT_RANGE),
48 GetPosition(), GetSize(),
49 GetStyle(),
50 wxDefaultValidator,
51 GetName());
52
53 if( HasParam(wxT("value")))
54 {
55 control->SetValue(GetLong(wxT("value")));
56 }
57 if( HasParam(wxT("shadow")))
58 {
59 control->SetShadowWidth(GetDimension(wxT("shadow")));
60 }
61 if( HasParam(wxT("bezel")))
62 {
63 control->SetBezelFace(GetDimension(wxT("bezel")));
64 }
65
66 SetupWindow(control);
67
68 return control;
69 }
70
71 bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
72 {
73 return IsOfClass(node, wxT("wxGauge"));
74 }
75
76 #endif // wxUSE_XRC && wxUSE_GAUGE