]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_slidr.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XRC resource for wxSlider
4 // Author: Bob Mitchell
7 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_XRC && wxUSE_SLIDER
20 #include "wx/xrc/xh_slidr.h"
21 #include "wx/slider.h"
23 IMPLEMENT_DYNAMIC_CLASS(wxSliderXmlHandler
, wxXmlResourceHandler
)
25 wxSliderXmlHandler::wxSliderXmlHandler()
26 : wxXmlResourceHandler()
28 XRC_ADD_STYLE(wxSL_HORIZONTAL
);
29 XRC_ADD_STYLE(wxSL_VERTICAL
);
30 XRC_ADD_STYLE(wxSL_AUTOTICKS
);
31 XRC_ADD_STYLE(wxSL_LABELS
);
32 XRC_ADD_STYLE(wxSL_LEFT
);
33 XRC_ADD_STYLE(wxSL_TOP
);
34 XRC_ADD_STYLE(wxSL_RIGHT
);
35 XRC_ADD_STYLE(wxSL_BOTTOM
);
36 XRC_ADD_STYLE(wxSL_BOTH
);
37 XRC_ADD_STYLE(wxSL_SELRANGE
);
38 XRC_ADD_STYLE(wxSL_INVERSE
);
42 wxObject
*wxSliderXmlHandler::DoCreateResource()
44 XRC_MAKE_INSTANCE(control
, wxSlider
)
46 control
->Create(m_parentAsWindow
,
48 GetLong(wxT("value"), wxSL_DEFAULT_VALUE
),
49 GetLong(wxT("min"), wxSL_DEFAULT_MIN
),
50 GetLong(wxT("max"), wxSL_DEFAULT_MAX
),
51 GetPosition(), GetSize(),
56 if( HasParam(wxT("tickfreq")))
58 control
->SetTickFreq(GetLong(wxT("tickfreq")), 0);
60 if( HasParam(wxT("pagesize")))
62 control
->SetPageSize(GetLong(wxT("pagesize")));
64 if( HasParam(wxT("linesize")))
66 control
->SetLineSize(GetLong(wxT("linesize")));
68 if( HasParam(wxT("thumb")))
70 control
->SetThumbLength(GetLong(wxT("thumb")));
72 if( HasParam(wxT("tick")))
74 control
->SetTick(GetLong(wxT("tick")));
76 if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
78 control
->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
86 bool wxSliderXmlHandler::CanHandle(wxXmlNode
*node
)
88 return IsOfClass(node
, wxT("wxSlider"));
91 #endif // wxUSE_XRC && wxUSE_SLIDER