]>
Commit | Line | Data |
---|---|---|
78d14f80 | 1 | ///////////////////////////////////////////////////////////////////////////// |
f4da9a94 | 2 | // Name: src/xrc/xh_slidr.cpp |
b5d6954b | 3 | // Purpose: XRC resource for wxSlider |
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_SLIDER |
a1e4ec87 | 18 | |
78d14f80 | 19 | #include "wx/xrc/xh_slidr.h" |
f4da9a94 WS |
20 | |
21 | #ifndef WX_PRECOMP | |
22 | #include "wx/slider.h" | |
23 | #endif | |
78d14f80 | 24 | |
033508e1 VS |
25 | static const long DEFAULT_VALUE = 0; |
26 | static const long DEFAULT_MIN = 0; | |
27 | static const long DEFAULT_MAX = 100; | |
28 | ||
29 | ||
854e189f VS |
30 | IMPLEMENT_DYNAMIC_CLASS(wxSliderXmlHandler, wxXmlResourceHandler) |
31 | ||
f80ea77b | 32 | wxSliderXmlHandler::wxSliderXmlHandler() |
f4da9a94 | 33 | :wxXmlResourceHandler() |
78d14f80 | 34 | { |
544fee32 VS |
35 | XRC_ADD_STYLE(wxSL_HORIZONTAL); |
36 | XRC_ADD_STYLE(wxSL_VERTICAL); | |
37 | XRC_ADD_STYLE(wxSL_AUTOTICKS); | |
38 | XRC_ADD_STYLE(wxSL_LABELS); | |
39 | XRC_ADD_STYLE(wxSL_LEFT); | |
40 | XRC_ADD_STYLE(wxSL_TOP); | |
41 | XRC_ADD_STYLE(wxSL_RIGHT); | |
42 | XRC_ADD_STYLE(wxSL_BOTTOM); | |
43 | XRC_ADD_STYLE(wxSL_BOTH); | |
44 | XRC_ADD_STYLE(wxSL_SELRANGE); | |
12d85b0e | 45 | XRC_ADD_STYLE(wxSL_INVERSE); |
78d14f80 VS |
46 | AddWindowStyles(); |
47 | } | |
48 | ||
49 | wxObject *wxSliderXmlHandler::DoCreateResource() | |
f80ea77b | 50 | { |
544fee32 | 51 | XRC_MAKE_INSTANCE(control, wxSlider) |
f2588180 VS |
52 | |
53 | control->Create(m_parentAsWindow, | |
54 | GetID(), | |
033508e1 VS |
55 | GetLong(wxT("value"), DEFAULT_VALUE), |
56 | GetLong(wxT("min"), DEFAULT_MIN), | |
57 | GetLong(wxT("max"), DEFAULT_MAX), | |
f2588180 VS |
58 | GetPosition(), GetSize(), |
59 | GetStyle(), | |
60 | wxDefaultValidator, | |
61 | GetName()); | |
78d14f80 | 62 | |
544fee32 | 63 | if( HasParam(wxT("tickfreq"))) |
78d14f80 | 64 | { |
0a12e013 | 65 | control->SetTickFreq(GetLong(wxT("tickfreq"))); |
78d14f80 | 66 | } |
544fee32 | 67 | if( HasParam(wxT("pagesize"))) |
78d14f80 | 68 | { |
544fee32 | 69 | control->SetPageSize(GetLong(wxT("pagesize"))); |
78d14f80 | 70 | } |
544fee32 | 71 | if( HasParam(wxT("linesize"))) |
78d14f80 | 72 | { |
544fee32 | 73 | control->SetLineSize(GetLong(wxT("linesize"))); |
78d14f80 | 74 | } |
544fee32 | 75 | if( HasParam(wxT("thumb"))) |
78d14f80 | 76 | { |
544fee32 | 77 | control->SetThumbLength(GetLong(wxT("thumb"))); |
78d14f80 | 78 | } |
544fee32 | 79 | if( HasParam(wxT("tick"))) |
78d14f80 | 80 | { |
544fee32 | 81 | control->SetTick(GetLong(wxT("tick"))); |
78d14f80 | 82 | } |
544fee32 | 83 | if( HasParam(wxT("selmin")) && HasParam(wxT("selmax"))) |
78d14f80 | 84 | { |
544fee32 | 85 | control->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax"))); |
78d14f80 VS |
86 | } |
87 | ||
88 | SetupWindow(control); | |
f80ea77b | 89 | |
78d14f80 VS |
90 | return control; |
91 | } | |
92 | ||
78d14f80 VS |
93 | bool wxSliderXmlHandler::CanHandle(wxXmlNode *node) |
94 | { | |
95 | return IsOfClass(node, wxT("wxSlider")); | |
96 | } | |
97 | ||
621be1ec | 98 | #endif // wxUSE_XRC && wxUSE_SLIDER |