]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_slidr.cpp
fix getting tooltip colors for GTK 2.11
[wxWidgets.git] / src / xrc / xh_slidr.cpp
CommitLineData
78d14f80 1/////////////////////////////////////////////////////////////////////////////
f4da9a94 2// Name: src/xrc/xh_slidr.cpp
b5d6954b 3// Purpose: XRC resource for wxSlider
78d14f80
VS
4// Author: Bob Mitchell
5// Created: 2000/03/21
6// RCS-ID: $Id$
7// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
f80ea77b 10
78d14f80
VS
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
621be1ec 18#if wxUSE_XRC && wxUSE_SLIDER
a1e4ec87 19
78d14f80 20#include "wx/xrc/xh_slidr.h"
f4da9a94
WS
21
22#ifndef WX_PRECOMP
23 #include "wx/slider.h"
24#endif
78d14f80 25
854e189f
VS
26IMPLEMENT_DYNAMIC_CLASS(wxSliderXmlHandler, wxXmlResourceHandler)
27
f80ea77b 28wxSliderXmlHandler::wxSliderXmlHandler()
f4da9a94 29 :wxXmlResourceHandler()
78d14f80 30{
544fee32
VS
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);
12d85b0e 41 XRC_ADD_STYLE(wxSL_INVERSE);
78d14f80
VS
42 AddWindowStyles();
43}
44
45wxObject *wxSliderXmlHandler::DoCreateResource()
f80ea77b 46{
544fee32 47 XRC_MAKE_INSTANCE(control, wxSlider)
f2588180
VS
48
49 control->Create(m_parentAsWindow,
50 GetID(),
f80ea77b 51 GetLong(wxT("value"), wxSL_DEFAULT_VALUE),
f2588180
VS
52 GetLong(wxT("min"), wxSL_DEFAULT_MIN),
53 GetLong(wxT("max"), wxSL_DEFAULT_MAX),
54 GetPosition(), GetSize(),
55 GetStyle(),
56 wxDefaultValidator,
57 GetName());
78d14f80 58
544fee32 59 if( HasParam(wxT("tickfreq")))
78d14f80 60 {
544fee32 61 control->SetTickFreq(GetLong(wxT("tickfreq")), 0);
78d14f80 62 }
544fee32 63 if( HasParam(wxT("pagesize")))
78d14f80 64 {
544fee32 65 control->SetPageSize(GetLong(wxT("pagesize")));
78d14f80 66 }
544fee32 67 if( HasParam(wxT("linesize")))
78d14f80 68 {
544fee32 69 control->SetLineSize(GetLong(wxT("linesize")));
78d14f80 70 }
544fee32 71 if( HasParam(wxT("thumb")))
78d14f80 72 {
544fee32 73 control->SetThumbLength(GetLong(wxT("thumb")));
78d14f80 74 }
544fee32 75 if( HasParam(wxT("tick")))
78d14f80 76 {
544fee32 77 control->SetTick(GetLong(wxT("tick")));
78d14f80 78 }
544fee32 79 if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
78d14f80 80 {
544fee32 81 control->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
78d14f80
VS
82 }
83
84 SetupWindow(control);
f80ea77b 85
78d14f80
VS
86 return control;
87}
88
78d14f80
VS
89bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
90{
91 return IsOfClass(node, wxT("wxSlider"));
92}
93
621be1ec 94#endif // wxUSE_XRC && wxUSE_SLIDER