]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_slidr.cpp
Italian translation corrections from Roberto Boriotti.
[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
033508e1
VS
26static const long DEFAULT_VALUE = 0;
27static const long DEFAULT_MIN = 0;
28static const long DEFAULT_MAX = 100;
29
30
854e189f
VS
31IMPLEMENT_DYNAMIC_CLASS(wxSliderXmlHandler, wxXmlResourceHandler)
32
f80ea77b 33wxSliderXmlHandler::wxSliderXmlHandler()
f4da9a94 34 :wxXmlResourceHandler()
78d14f80 35{
544fee32
VS
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);
12d85b0e 46 XRC_ADD_STYLE(wxSL_INVERSE);
78d14f80
VS
47 AddWindowStyles();
48}
49
50wxObject *wxSliderXmlHandler::DoCreateResource()
f80ea77b 51{
544fee32 52 XRC_MAKE_INSTANCE(control, wxSlider)
f2588180
VS
53
54 control->Create(m_parentAsWindow,
55 GetID(),
033508e1
VS
56 GetLong(wxT("value"), DEFAULT_VALUE),
57 GetLong(wxT("min"), DEFAULT_MIN),
58 GetLong(wxT("max"), DEFAULT_MAX),
f2588180
VS
59 GetPosition(), GetSize(),
60 GetStyle(),
61 wxDefaultValidator,
62 GetName());
78d14f80 63
544fee32 64 if( HasParam(wxT("tickfreq")))
78d14f80 65 {
0a12e013 66 control->SetTickFreq(GetLong(wxT("tickfreq")));
78d14f80 67 }
544fee32 68 if( HasParam(wxT("pagesize")))
78d14f80 69 {
544fee32 70 control->SetPageSize(GetLong(wxT("pagesize")));
78d14f80 71 }
544fee32 72 if( HasParam(wxT("linesize")))
78d14f80 73 {
544fee32 74 control->SetLineSize(GetLong(wxT("linesize")));
78d14f80 75 }
544fee32 76 if( HasParam(wxT("thumb")))
78d14f80 77 {
544fee32 78 control->SetThumbLength(GetLong(wxT("thumb")));
78d14f80 79 }
544fee32 80 if( HasParam(wxT("tick")))
78d14f80 81 {
544fee32 82 control->SetTick(GetLong(wxT("tick")));
78d14f80 83 }
544fee32 84 if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
78d14f80 85 {
544fee32 86 control->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
78d14f80
VS
87 }
88
89 SetupWindow(control);
f80ea77b 90
78d14f80
VS
91 return control;
92}
93
78d14f80
VS
94bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
95{
96 return IsOfClass(node, wxT("wxSlider"));
97}
98
621be1ec 99#endif // wxUSE_XRC && wxUSE_SLIDER