]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/xrc/xh_chckb.cpp | |
3 | // Purpose: XRC resource for wxCheckBox | |
4 | // Author: Bob Mitchell | |
5 | // Created: 2000/03/21 | |
6 | // Copyright: (c) 2000 Bob Mitchell and Verant Interactive | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | // For compilers that support precompilation, includes "wx.h". | |
11 | #include "wx/wxprec.h" | |
12 | ||
13 | #ifdef __BORLANDC__ | |
14 | #pragma hdrstop | |
15 | #endif | |
16 | ||
17 | #if wxUSE_XRC && wxUSE_CHECKBOX | |
18 | ||
19 | #include "wx/xrc/xh_chckb.h" | |
20 | ||
21 | #ifndef WX_PRECOMP | |
22 | #include "wx/checkbox.h" | |
23 | #endif | |
24 | ||
25 | IMPLEMENT_DYNAMIC_CLASS(wxCheckBoxXmlHandler, wxXmlResourceHandler) | |
26 | ||
27 | wxCheckBoxXmlHandler::wxCheckBoxXmlHandler() | |
28 | : wxXmlResourceHandler() | |
29 | { | |
30 | XRC_ADD_STYLE(wxCHK_2STATE); | |
31 | XRC_ADD_STYLE(wxCHK_3STATE); | |
32 | XRC_ADD_STYLE(wxCHK_ALLOW_3RD_STATE_FOR_USER); | |
33 | XRC_ADD_STYLE(wxALIGN_RIGHT); | |
34 | AddWindowStyles(); | |
35 | } | |
36 | ||
37 | wxObject *wxCheckBoxXmlHandler::DoCreateResource() | |
38 | { | |
39 | XRC_MAKE_INSTANCE(control, wxCheckBox) | |
40 | ||
41 | control->Create(m_parentAsWindow, | |
42 | GetID(), | |
43 | GetText(wxT("label")), | |
44 | GetPosition(), GetSize(), | |
45 | GetStyle(), | |
46 | wxDefaultValidator, | |
47 | GetName()); | |
48 | ||
49 | control->SetValue(GetBool( wxT("checked"))); | |
50 | SetupWindow(control); | |
51 | ||
52 | return control; | |
53 | } | |
54 | ||
55 | bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node) | |
56 | { | |
57 | return IsOfClass(node, wxT("wxCheckBox")); | |
58 | } | |
59 | ||
60 | #endif // wxUSE_XRC && wxUSE_CHECKBOX |