]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_slidr.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_slidr.cpp
3 // Purpose: XRC resource for wxSlider
4 // Author: Bob Mitchell
6 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_XRC && wxUSE_SLIDER
19 #include "wx/xrc/xh_slidr.h"
22 #include "wx/slider.h"
25 static const long DEFAULT_VALUE
= 0;
26 static const long DEFAULT_MIN
= 0;
27 static const long DEFAULT_MAX
= 100;
30 IMPLEMENT_DYNAMIC_CLASS(wxSliderXmlHandler
, wxXmlResourceHandler
)
32 wxSliderXmlHandler::wxSliderXmlHandler()
33 :wxXmlResourceHandler()
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
);
45 XRC_ADD_STYLE(wxSL_INVERSE
);
49 wxObject
*wxSliderXmlHandler::DoCreateResource()
51 XRC_MAKE_INSTANCE(control
, wxSlider
)
53 control
->Create(m_parentAsWindow
,
55 GetLong(wxT("value"), DEFAULT_VALUE
),
56 GetLong(wxT("min"), DEFAULT_MIN
),
57 GetLong(wxT("max"), DEFAULT_MAX
),
58 GetPosition(), GetSize(),
63 if( HasParam(wxT("tickfreq")))
65 control
->SetTickFreq(GetLong(wxT("tickfreq")));
67 if( HasParam(wxT("pagesize")))
69 control
->SetPageSize(GetLong(wxT("pagesize")));
71 if( HasParam(wxT("linesize")))
73 control
->SetLineSize(GetLong(wxT("linesize")));
75 if( HasParam(wxT("thumb")))
77 control
->SetThumbLength(GetLong(wxT("thumb")));
79 if( HasParam(wxT("tick")))
81 control
->SetTick(GetLong(wxT("tick")));
83 if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
85 control
->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
93 bool wxSliderXmlHandler::CanHandle(wxXmlNode
*node
)
95 return IsOfClass(node
, wxT("wxSlider"));
98 #endif // wxUSE_XRC && wxUSE_SLIDER