]>
Commit | Line | Data |
---|---|---|
78d14f80 | 1 | ///////////////////////////////////////////////////////////////////////////// |
40ff126a | 2 | // Name: src/xrc/xh_gauge.cpp |
b5d6954b | 3 | // Purpose: XRC resource for wxGauge |
78d14f80 VS |
4 | // Author: Bob Mitchell |
5 | // Created: 2000/03/21 | |
78d14f80 VS |
6 | // Copyright: (c) 2000 Bob Mitchell and Verant Interactive |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
f80ea77b | 9 | |
78d14f80 VS |
10 | // For compilers that support precompilation, includes "wx.h". |
11 | #include "wx/wxprec.h" | |
12 | ||
13 | #ifdef __BORLANDC__ | |
14 | #pragma hdrstop | |
15 | #endif | |
16 | ||
621be1ec | 17 | #if wxUSE_XRC && wxUSE_GAUGE |
a1e4ec87 | 18 | |
78d14f80 | 19 | #include "wx/xrc/xh_gauge.h" |
9d2c19f1 WS |
20 | |
21 | #ifndef WX_PRECOMP | |
22 | #include "wx/gauge.h" | |
23 | #endif | |
78d14f80 | 24 | |
033508e1 VS |
25 | static const long DEFAULT_RANGE = 100; |
26 | ||
854e189f VS |
27 | IMPLEMENT_DYNAMIC_CLASS(wxGaugeXmlHandler, wxXmlResourceHandler) |
28 | ||
f80ea77b | 29 | wxGaugeXmlHandler::wxGaugeXmlHandler() |
9d2c19f1 | 30 | :wxXmlResourceHandler() |
78d14f80 | 31 | { |
544fee32 VS |
32 | XRC_ADD_STYLE(wxGA_HORIZONTAL); |
33 | XRC_ADD_STYLE(wxGA_VERTICAL); | |
40ff126a | 34 | #if WXWIN_COMPATIBILITY_2_6 |
544fee32 | 35 | XRC_ADD_STYLE(wxGA_PROGRESSBAR); |
40ff126a | 36 | #endif // WXWIN_COMPATIBILITY_2_6 |
544fee32 | 37 | XRC_ADD_STYLE(wxGA_SMOOTH); // windows only |
78d14f80 VS |
38 | AddWindowStyles(); |
39 | } | |
40 | ||
41 | wxObject *wxGaugeXmlHandler::DoCreateResource() | |
f80ea77b | 42 | { |
544fee32 | 43 | XRC_MAKE_INSTANCE(control, wxGauge) |
f2588180 VS |
44 | |
45 | control->Create(m_parentAsWindow, | |
46 | GetID(), | |
033508e1 | 47 | GetLong(wxT("range"), DEFAULT_RANGE), |
f2588180 VS |
48 | GetPosition(), GetSize(), |
49 | GetStyle(), | |
50 | wxDefaultValidator, | |
51 | GetName()); | |
78d14f80 | 52 | |
544fee32 | 53 | if( HasParam(wxT("value"))) |
78d14f80 | 54 | { |
544fee32 | 55 | control->SetValue(GetLong(wxT("value"))); |
78d14f80 | 56 | } |
544fee32 | 57 | if( HasParam(wxT("shadow"))) |
78d14f80 | 58 | { |
544fee32 | 59 | control->SetShadowWidth(GetDimension(wxT("shadow"))); |
78d14f80 | 60 | } |
544fee32 | 61 | if( HasParam(wxT("bezel"))) |
78d14f80 | 62 | { |
544fee32 | 63 | control->SetBezelFace(GetDimension(wxT("bezel"))); |
78d14f80 VS |
64 | } |
65 | ||
66 | SetupWindow(control); | |
544fee32 | 67 | |
78d14f80 VS |
68 | return control; |
69 | } | |
70 | ||
78d14f80 VS |
71 | bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node) |
72 | { | |
73 | return IsOfClass(node, wxT("wxGauge")); | |
74 | } | |
75 | ||
621be1ec | 76 | #endif // wxUSE_XRC && wxUSE_GAUGE |