]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_gauge.cpp
Implement wxComboCtrl::GetSizeFromTextSize().
[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 static const long DEFAULT_RANGE = 100;
27
28 IMPLEMENT_DYNAMIC_CLASS(wxGaugeXmlHandler, wxXmlResourceHandler)
29
30 wxGaugeXmlHandler::wxGaugeXmlHandler()
31 :wxXmlResourceHandler()
32 {
33 XRC_ADD_STYLE(wxGA_HORIZONTAL);
34 XRC_ADD_STYLE(wxGA_VERTICAL);
35 #if WXWIN_COMPATIBILITY_2_6
36 XRC_ADD_STYLE(wxGA_PROGRESSBAR);
37 #endif // WXWIN_COMPATIBILITY_2_6
38 XRC_ADD_STYLE(wxGA_SMOOTH); // windows only
39 AddWindowStyles();
40 }
41
42 wxObject *wxGaugeXmlHandler::DoCreateResource()
43 {
44 XRC_MAKE_INSTANCE(control, wxGauge)
45
46 control->Create(m_parentAsWindow,
47 GetID(),
48 GetLong(wxT("range"), DEFAULT_RANGE),
49 GetPosition(), GetSize(),
50 GetStyle(),
51 wxDefaultValidator,
52 GetName());
53
54 if( HasParam(wxT("value")))
55 {
56 control->SetValue(GetLong(wxT("value")));
57 }
58 if( HasParam(wxT("shadow")))
59 {
60 control->SetShadowWidth(GetDimension(wxT("shadow")));
61 }
62 if( HasParam(wxT("bezel")))
63 {
64 control->SetBezelFace(GetDimension(wxT("bezel")));
65 }
66
67 SetupWindow(control);
68
69 return control;
70 }
71
72 bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
73 {
74 return IsOfClass(node, wxT("wxGauge"));
75 }
76
77 #endif // wxUSE_XRC && wxUSE_GAUGE