]>
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
12 #pragma implementation "xh_slidr.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #if wxUSE_XRC && wxUSE_SLIDER
24 #include "wx/xrc/xh_slidr.h"
25 #include "wx/slider.h"
27 IMPLEMENT_DYNAMIC_CLASS(wxSliderXmlHandler
, wxXmlResourceHandler
)
29 wxSliderXmlHandler::wxSliderXmlHandler()
30 : wxXmlResourceHandler()
32 XRC_ADD_STYLE(wxSL_HORIZONTAL
);
33 XRC_ADD_STYLE(wxSL_VERTICAL
);
34 XRC_ADD_STYLE(wxSL_AUTOTICKS
);
35 XRC_ADD_STYLE(wxSL_LABELS
);
36 XRC_ADD_STYLE(wxSL_LEFT
);
37 XRC_ADD_STYLE(wxSL_TOP
);
38 XRC_ADD_STYLE(wxSL_RIGHT
);
39 XRC_ADD_STYLE(wxSL_BOTTOM
);
40 XRC_ADD_STYLE(wxSL_BOTH
);
41 XRC_ADD_STYLE(wxSL_SELRANGE
);
42 XRC_ADD_STYLE(wxSL_INVERSE
);
46 wxObject
*wxSliderXmlHandler::DoCreateResource()
48 XRC_MAKE_INSTANCE(control
, wxSlider
)
50 control
->Create(m_parentAsWindow
,
52 GetLong(wxT("value"), wxSL_DEFAULT_VALUE
),
53 GetLong(wxT("min"), wxSL_DEFAULT_MIN
),
54 GetLong(wxT("max"), wxSL_DEFAULT_MAX
),
55 GetPosition(), GetSize(),
60 if( HasParam(wxT("tickfreq")))
62 control
->SetTickFreq(GetLong(wxT("tickfreq")), 0);
64 if( HasParam(wxT("pagesize")))
66 control
->SetPageSize(GetLong(wxT("pagesize")));
68 if( HasParam(wxT("linesize")))
70 control
->SetLineSize(GetLong(wxT("linesize")));
72 if( HasParam(wxT("thumb")))
74 control
->SetThumbLength(GetLong(wxT("thumb")));
76 if( HasParam(wxT("tick")))
78 control
->SetTick(GetLong(wxT("tick")));
80 if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
82 control
->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
90 bool wxSliderXmlHandler::CanHandle(wxXmlNode
*node
)
92 return IsOfClass(node
, wxT("wxSlider"));
95 #endif // wxUSE_XRC && wxUSE_SLIDER