]>
Commit | Line | Data |
---|---|---|
56d2f750 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: xh_slidr.cpp | |
3 | // Purpose: XML resource for wxSlider | |
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_slidr.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_slidr.h" | |
23 | #include "wx/slider.h" | |
24 | ||
25 | #if wxUSE_SLIDER | |
26 | ||
27 | wxSliderXmlHandler::wxSliderXmlHandler() | |
28 | : wxXmlResourceHandler() | |
29 | { | |
30 | ADD_STYLE( wxSL_HORIZONTAL ); | |
31 | ADD_STYLE( wxSL_VERTICAL ); | |
32 | ADD_STYLE( wxSL_AUTOTICKS ); | |
33 | ADD_STYLE( wxSL_LABELS ); | |
34 | ADD_STYLE( wxSL_LEFT ); | |
35 | ADD_STYLE( wxSL_TOP ); | |
36 | ADD_STYLE( wxSL_RIGHT ); | |
37 | ADD_STYLE( wxSL_BOTTOM ); | |
38 | ADD_STYLE( wxSL_BOTH ); | |
39 | ADD_STYLE( wxSL_SELRANGE ); | |
09dc1241 | 40 | AddWindowStyles(); |
56d2f750 VS |
41 | } |
42 | ||
43 | wxObject *wxSliderXmlHandler::DoCreateResource() | |
44 | { | |
ab708d5d | 45 | wxSlider *control = new wxSlider(m_parentAsWindow, |
56d2f750 | 46 | GetID(), |
a559d708 VS |
47 | GetLong( wxT("value"), wxSL_DEFAULT_VALUE), |
48 | GetLong( wxT("min"), wxSL_DEFAULT_MIN), | |
49 | GetLong( wxT("max"), wxSL_DEFAULT_MAX), | |
56d2f750 VS |
50 | GetPosition(), GetSize(), |
51 | GetStyle(), | |
52 | wxDefaultValidator, | |
53 | GetName() | |
54 | ); | |
55 | ||
a559d708 | 56 | if( HasParam( wxT("tickfreq") )) |
56d2f750 | 57 | { |
a559d708 | 58 | control->SetTickFreq( GetLong( wxT("tickfreq") ), 0 ); |
56d2f750 | 59 | } |
a559d708 | 60 | if( HasParam( wxT("pagesize") )) |
56d2f750 | 61 | { |
a559d708 | 62 | control->SetPageSize( GetLong( wxT("pagesize") ) ); |
56d2f750 | 63 | } |
a559d708 | 64 | if( HasParam( wxT("linesize") )) |
56d2f750 | 65 | { |
a559d708 | 66 | control->SetLineSize( GetLong( wxT("linesize") )); |
56d2f750 | 67 | } |
a559d708 | 68 | if( HasParam( wxT("thumb") )) |
56d2f750 | 69 | { |
a559d708 | 70 | control->SetThumbLength( GetLong( wxT("thumb") )); |
56d2f750 | 71 | } |
a559d708 | 72 | if( HasParam( wxT("tick") )) |
56d2f750 | 73 | { |
a559d708 | 74 | control->SetTick( GetLong( wxT("tick") )); |
56d2f750 | 75 | } |
a559d708 | 76 | if( HasParam( wxT("selmin") ) && HasParam( wxT("selmax")) ) |
56d2f750 | 77 | { |
a559d708 | 78 | control->SetSelection( GetLong( wxT("selmin") ), GetLong( wxT("selmax")) ); |
56d2f750 VS |
79 | } |
80 | ||
81 | SetupWindow(control); | |
82 | ||
83 | return control; | |
84 | } | |
85 | ||
86 | ||
87 | ||
88 | bool wxSliderXmlHandler::CanHandle(wxXmlNode *node) | |
89 | { | |
a559d708 | 90 | return IsOfClass(node, wxT("wxSlider")); |
56d2f750 VS |
91 | } |
92 | ||
93 | ||
94 | #endif |