]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_chckb.cpp
todos, cleanups, detabified
[wxWidgets.git] / src / xrc / xh_chckb.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_chckb.cpp
3 // Purpose: XRC resource for wxCheckBox
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_chckb.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 #if wxUSE_XRC && wxUSE_CHECKBOX
23
24 #include "wx/xrc/xh_chckb.h"
25 #include "wx/checkbox.h"
26
27 IMPLEMENT_DYNAMIC_CLASS(wxCheckBoxXmlHandler, wxXmlResourceHandler)
28
29 wxCheckBoxXmlHandler::wxCheckBoxXmlHandler()
30 : wxXmlResourceHandler()
31 {
32 XRC_ADD_STYLE(wxCHK_2STATE);
33 XRC_ADD_STYLE(wxCHK_3STATE);
34 XRC_ADD_STYLE(wxCHK_ALLOW_3RD_STATE_FOR_USER);
35 XRC_ADD_STYLE(wxALIGN_RIGHT);
36 AddWindowStyles();
37 }
38
39 wxObject *wxCheckBoxXmlHandler::DoCreateResource()
40 {
41 XRC_MAKE_INSTANCE(control, wxCheckBox)
42
43 control->Create(m_parentAsWindow,
44 GetID(),
45 GetText(wxT("label")),
46 GetPosition(), GetSize(),
47 GetStyle(),
48 wxDefaultValidator,
49 GetName());
50
51 control->SetValue(GetBool( wxT("checked")));
52 SetupWindow(control);
53
54 return control;
55 }
56
57 bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node)
58 {
59 return IsOfClass(node, wxT("wxCheckBox"));
60 }
61
62 #endif // wxUSE_XRC && wxUSE_CHECKBOX