]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_radbt.cpp
Misc validity fixes to samples/xrc/rc/*.xrc.
[wxWidgets.git] / src / xrc / xh_radbt.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_radbt.cpp
3 // Purpose: XRC resource for wxRadioButton
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_RADIOBTN
18
19 #include "wx/xrc/xh_radbt.h"
20
21 #ifndef WX_PRECOMP
22 #include "wx/radiobut.h"
23 #endif
24
25 IMPLEMENT_DYNAMIC_CLASS(wxRadioButtonXmlHandler, wxXmlResourceHandler)
26
27 wxRadioButtonXmlHandler::wxRadioButtonXmlHandler()
28 : wxXmlResourceHandler()
29 {
30 XRC_ADD_STYLE(wxRB_GROUP);
31 XRC_ADD_STYLE(wxRB_SINGLE);
32 AddWindowStyles();
33 }
34
35 wxObject *wxRadioButtonXmlHandler::DoCreateResource()
36 {
37 /* BOBM - implementation note.
38 * once the wxBitmapRadioButton is implemented.
39 * look for a bitmap property. If not null,
40 * make it a wxBitmapRadioButton instead of the
41 * normal radio button.
42 */
43
44 XRC_MAKE_INSTANCE(control, wxRadioButton)
45
46 control->Create(m_parentAsWindow,
47 GetID(),
48 GetText(wxT("label")),
49 GetPosition(), GetSize(),
50 GetStyle(),
51 wxDefaultValidator,
52 GetName());
53
54 control->SetValue(GetBool(wxT("value"), 0));
55 SetupWindow(control);
56
57 return control;
58 }
59
60 bool wxRadioButtonXmlHandler::CanHandle(wxXmlNode *node)
61 {
62 return IsOfClass(node, wxT("wxRadioButton"));
63 }
64
65 #endif // wxUSE_XRC && wxUSE_RADIOBTN