]>
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
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 IMPLEMENT_DYNAMIC_CLASS(wxSliderXmlHandler
, wxXmlResourceHandler
)
28 wxSliderXmlHandler::wxSliderXmlHandler()
29 :wxXmlResourceHandler()
31 XRC_ADD_STYLE(wxSL_HORIZONTAL
);
32 XRC_ADD_STYLE(wxSL_VERTICAL
);
33 XRC_ADD_STYLE(wxSL_AUTOTICKS
);
34 XRC_ADD_STYLE(wxSL_LABELS
);
35 XRC_ADD_STYLE(wxSL_LEFT
);
36 XRC_ADD_STYLE(wxSL_TOP
);
37 XRC_ADD_STYLE(wxSL_RIGHT
);
38 XRC_ADD_STYLE(wxSL_BOTTOM
);
39 XRC_ADD_STYLE(wxSL_BOTH
);
40 XRC_ADD_STYLE(wxSL_SELRANGE
);
41 XRC_ADD_STYLE(wxSL_INVERSE
);
45 wxObject
*wxSliderXmlHandler::DoCreateResource()
47 XRC_MAKE_INSTANCE(control
, wxSlider
)
49 control
->Create(m_parentAsWindow
,
51 GetLong(wxT("value"), wxSL_DEFAULT_VALUE
),
52 GetLong(wxT("min"), wxSL_DEFAULT_MIN
),
53 GetLong(wxT("max"), wxSL_DEFAULT_MAX
),
54 GetPosition(), GetSize(),
59 if( HasParam(wxT("tickfreq")))
61 control
->SetTickFreq(GetLong(wxT("tickfreq")), 0);
63 if( HasParam(wxT("pagesize")))
65 control
->SetPageSize(GetLong(wxT("pagesize")));
67 if( HasParam(wxT("linesize")))
69 control
->SetLineSize(GetLong(wxT("linesize")));
71 if( HasParam(wxT("thumb")))
73 control
->SetThumbLength(GetLong(wxT("thumb")));
75 if( HasParam(wxT("tick")))
77 control
->SetTick(GetLong(wxT("tick")));
79 if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
81 control
->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
89 bool wxSliderXmlHandler::CanHandle(wxXmlNode
*node
)
91 return IsOfClass(node
, wxT("wxSlider"));
94 #endif // wxUSE_XRC && wxUSE_SLIDER