]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/xml/xh_slidr.cpp
changed content of checklist, choice, combobox, radiobox from <children> to <content>
[wxWidgets.git] / contrib / src / xml / xh_slidr.cpp
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 );
40 }
41
42 wxObject *wxSliderXmlHandler::DoCreateResource()
43 {
44 wxSlider *control = new wxSlider(m_ParentAsWindow,
45 GetID(),
46 GetLong( _T("value"), wxSL_DEFAULT_VALUE),
47 GetLong( _T("min"), wxSL_DEFAULT_MIN),
48 GetLong( _T("max"), wxSL_DEFAULT_MAX),
49 GetPosition(), GetSize(),
50 GetStyle(),
51 wxDefaultValidator,
52 GetName()
53 );
54
55 if( HasParam( _T("tickfreq") ))
56 {
57 control->SetTickFreq( GetLong( _T("tickfreq") ), 0 );
58 }
59 if( HasParam( _T("pagesize") ))
60 {
61 control->SetPageSize( GetLong( _T("pagesize") ) );
62 }
63 if( HasParam( _T("linesize") ))
64 {
65 control->SetLineSize( GetLong( _T("linesize") ));
66 }
67 if( HasParam( _T("thumb") ))
68 {
69 control->SetThumbLength( GetLong( _T("thumb") ));
70 }
71 if( HasParam( _T("tick") ))
72 {
73 control->SetTick( GetLong( _T("tick") ));
74 }
75 if( HasParam( _T("selmin") ) && HasParam( _T("selmax")) )
76 {
77 control->SetSelection( GetLong( _T("selmin") ), GetLong( _T("selmax")) );
78 }
79
80 SetupWindow(control);
81
82 return control;
83 }
84
85
86
87 bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
88 {
89 return node->GetName() == _T("slider");
90 }
91
92
93 #endif