]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/xml/xh_gauge.cpp
xmlres: added support for wxMSW
[wxWidgets.git] / contrib / src / xml / xh_gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_gauge.cpp
3 // Purpose: XML 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/xml/xh_gauge.h"
23 #include "wx/gauge.h"
24
25 #if wxUSE_GAUGE
26
27 wxGaugeXmlHandler::wxGaugeXmlHandler()
28 : wxXmlResourceHandler()
29 {
30 ADD_STYLE( wxGA_HORIZONTAL );
31 ADD_STYLE( wxGA_VERTICAL );
32 ADD_STYLE( wxGA_PROGRESSBAR );
33 ADD_STYLE( wxGA_SMOOTH ); // windows only
34 }
35
36 wxObject *wxGaugeXmlHandler::DoCreateResource()
37 {
38 wxGauge *control = new wxGauge(m_ParentAsWindow,
39 GetID(),
40 GetLong( _T("range"), wxGAUGE_DEFAULT_RANGE),
41 GetPosition(), GetSize(),
42 GetStyle(),
43 wxDefaultValidator,
44 GetName()
45 );
46
47 if( HasParam( _T("value") ))
48 {
49 control->SetValue( GetLong( _T("value") ));
50 }
51 if( HasParam( _T("shadow") ))
52 {
53 control->SetShadowWidth( GetLong( _T("shadow") ));
54 }
55 if( HasParam( _T("bezel") ))
56 {
57 control->SetBezelFace( GetLong( _T("bezel") ));
58 }
59
60 SetupWindow(control);
61
62 return control;
63 }
64
65
66
67 bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
68 {
69 return node->GetName() == _T("gauge");
70 }
71
72
73 #endif // wxUSE_GAUGE