]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_scrol.cpp
Applied patch from Bo, WIP
[wxWidgets.git] / src / xrc / xh_scrol.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_scrol.cpp
3 // Purpose: XRC resource for wxScrollBar
4 // Author: Brian Gavin
5 // Created: 2000/09/09
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 Brian Gavin
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_XRC && wxUSE_SCROLLBAR
19
20 #include "wx/xrc/xh_scrol.h"
21
22 #ifndef WX_PRECOMP
23 #include "wx/scrolbar.h"
24 #endif
25
26 IMPLEMENT_DYNAMIC_CLASS(wxScrollBarXmlHandler, wxXmlResourceHandler)
27
28 wxScrollBarXmlHandler::wxScrollBarXmlHandler()
29 : wxXmlResourceHandler()
30 {
31 XRC_ADD_STYLE(wxSB_HORIZONTAL);
32 XRC_ADD_STYLE(wxSB_VERTICAL);
33 AddWindowStyles();
34 }
35
36 wxObject *wxScrollBarXmlHandler::DoCreateResource()
37 {
38 XRC_MAKE_INSTANCE(control, wxScrollBar)
39
40 control->Create(m_parentAsWindow,
41 GetID(),
42 GetPosition(), GetSize(),
43 GetStyle(),
44 wxDefaultValidator,
45 GetName());
46
47 control->SetScrollbar(GetLong( wxT("value"), 0),
48 GetLong( wxT("thumbsize"),1),
49 GetLong( wxT("range"), 10),
50 GetLong( wxT("pagesize"),1));
51
52 SetupWindow(control);
53 CreateChildren(control);
54
55 return control;
56 }
57
58 bool wxScrollBarXmlHandler::CanHandle(wxXmlNode *node)
59 {
60 return IsOfClass(node, wxT("wxScrollBar"));
61 }
62
63 #endif // wxUSE_XRC && wxUSE_SCROLLBAR