]> git.saurik.com Git - wxWidgets.git/blame - contrib/src/xrc/xh_slidr.cpp
fixed bug in generation of thumb scroll events
[wxWidgets.git] / contrib / src / xrc / xh_slidr.cpp
CommitLineData
78d14f80
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: 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/////////////////////////////////////////////////////////////////////////////
10
11#ifdef __GNUG__
12#pragma implementation "xh_slidr.h"
13#endif
14
15// For compilers that support precompilation, includes "wx.h".
16#include "wx/wxprec.h"
17
18#ifdef __BORLANDC__
19 #pragma hdrstop
20#endif
21
22#include "wx/xrc/xh_slidr.h"
23#include "wx/slider.h"
24
25#if wxUSE_SLIDER
26
27wxSliderXmlHandler::wxSliderXmlHandler()
28: wxXmlResourceHandler()
29{
544fee32
VS
30 XRC_ADD_STYLE(wxSL_HORIZONTAL);
31 XRC_ADD_STYLE(wxSL_VERTICAL);
32 XRC_ADD_STYLE(wxSL_AUTOTICKS);
33 XRC_ADD_STYLE(wxSL_LABELS);
34 XRC_ADD_STYLE(wxSL_LEFT);
35 XRC_ADD_STYLE(wxSL_TOP);
36 XRC_ADD_STYLE(wxSL_RIGHT);
37 XRC_ADD_STYLE(wxSL_BOTTOM);
38 XRC_ADD_STYLE(wxSL_BOTH);
39 XRC_ADD_STYLE(wxSL_SELRANGE);
78d14f80
VS
40 AddWindowStyles();
41}
42
43wxObject *wxSliderXmlHandler::DoCreateResource()
44{
544fee32 45 XRC_MAKE_INSTANCE(control, wxSlider)
f2588180
VS
46
47 control->Create(m_parentAsWindow,
48 GetID(),
49 GetLong(wxT("value"), wxSL_DEFAULT_VALUE),
50 GetLong(wxT("min"), wxSL_DEFAULT_MIN),
51 GetLong(wxT("max"), wxSL_DEFAULT_MAX),
52 GetPosition(), GetSize(),
53 GetStyle(),
54 wxDefaultValidator,
55 GetName());
78d14f80 56
544fee32 57 if( HasParam(wxT("tickfreq")))
78d14f80 58 {
544fee32 59 control->SetTickFreq(GetLong(wxT("tickfreq")), 0);
78d14f80 60 }
544fee32 61 if( HasParam(wxT("pagesize")))
78d14f80 62 {
544fee32 63 control->SetPageSize(GetLong(wxT("pagesize")));
78d14f80 64 }
544fee32 65 if( HasParam(wxT("linesize")))
78d14f80 66 {
544fee32 67 control->SetLineSize(GetLong(wxT("linesize")));
78d14f80 68 }
544fee32 69 if( HasParam(wxT("thumb")))
78d14f80 70 {
544fee32 71 control->SetThumbLength(GetLong(wxT("thumb")));
78d14f80 72 }
544fee32 73 if( HasParam(wxT("tick")))
78d14f80 74 {
544fee32 75 control->SetTick(GetLong(wxT("tick")));
78d14f80 76 }
544fee32 77 if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
78d14f80 78 {
544fee32 79 control->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
78d14f80
VS
80 }
81
82 SetupWindow(control);
83
84 return control;
85}
86
78d14f80
VS
87bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
88{
89 return IsOfClass(node, wxT("wxSlider"));
90}
91
78d14f80 92#endif