]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_slidr.cpp
b888d71de995c48c738b0e44ecd4aaa3ae420207
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_slidr.cpp
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"
23 #include "wx/slider.h"
26 static const long DEFAULT_VALUE
= 0;
27 static const long DEFAULT_MIN
= 0;
28 static const long DEFAULT_MAX
= 100;
31 IMPLEMENT_DYNAMIC_CLASS(wxSliderXmlHandler
, wxXmlResourceHandler
)
33 wxSliderXmlHandler::wxSliderXmlHandler()
34 :wxXmlResourceHandler()
36 XRC_ADD_STYLE(wxSL_HORIZONTAL
);
37 XRC_ADD_STYLE(wxSL_VERTICAL
);
38 XRC_ADD_STYLE(wxSL_AUTOTICKS
);
39 XRC_ADD_STYLE(wxSL_LABELS
);
40 XRC_ADD_STYLE(wxSL_LEFT
);
41 XRC_ADD_STYLE(wxSL_TOP
);
42 XRC_ADD_STYLE(wxSL_RIGHT
);
43 XRC_ADD_STYLE(wxSL_BOTTOM
);
44 XRC_ADD_STYLE(wxSL_BOTH
);
45 XRC_ADD_STYLE(wxSL_SELRANGE
);
46 XRC_ADD_STYLE(wxSL_INVERSE
);
50 wxObject
*wxSliderXmlHandler::DoCreateResource()
52 XRC_MAKE_INSTANCE(control
, wxSlider
)
54 control
->Create(m_parentAsWindow
,
56 GetLong(wxT("value"), DEFAULT_VALUE
),
57 GetLong(wxT("min"), DEFAULT_MIN
),
58 GetLong(wxT("max"), DEFAULT_MAX
),
59 GetPosition(), GetSize(),
64 if( HasParam(wxT("tickfreq")))
66 control
->SetTickFreq(GetLong(wxT("tickfreq")));
68 if( HasParam(wxT("pagesize")))
70 control
->SetPageSize(GetLong(wxT("pagesize")));
72 if( HasParam(wxT("linesize")))
74 control
->SetLineSize(GetLong(wxT("linesize")));
76 if( HasParam(wxT("thumb")))
78 control
->SetThumbLength(GetLong(wxT("thumb")));
80 if( HasParam(wxT("tick")))
82 control
->SetTick(GetLong(wxT("tick")));
84 if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
86 control
->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
94 bool wxSliderXmlHandler::CanHandle(wxXmlNode
*node
)
96 return IsOfClass(node
, wxT("wxSlider"));
99 #endif // wxUSE_XRC && wxUSE_SLIDER