]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_tglbtn.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XRC resource for wxToggleButton
4 // Author: Bob Mitchell
7 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_XRC && wxUSE_TOGGLEBTN
20 #include "wx/xrc/xh_tglbtn.h"
21 #include "wx/tglbtn.h"
22 #include "wx/button.h" // solely for wxBU_EXACTFIT
24 IMPLEMENT_DYNAMIC_CLASS(wxToggleButtonXmlHandler
, wxXmlResourceHandler
)
26 wxToggleButtonXmlHandler::wxToggleButtonXmlHandler()
27 : wxXmlResourceHandler()
29 XRC_ADD_STYLE(wxBU_EXACTFIT
);
34 wxObject
*wxToggleButtonXmlHandler::DoCreateResource()
37 wxObject
*control
= m_instance
;
39 #if !defined(__WXUNIVERSAL__) && !defined(__WXMOTIF__) && !defined(__WXPALMOS__) && !defined(__WXPM__) && !(defined(__WXGTK__) && !defined(__WXGTK20__))
41 if (m_class
== wxT("wxBitmapToggleButton"))
44 control
= new wxBitmapToggleButton
;
46 DoCreateBitmapToggleButton(control
);
52 control
= new wxToggleButton
;
54 DoCreateToggleButton(control
);
57 SetupWindow(wxDynamicCast(control
, wxWindow
));
62 bool wxToggleButtonXmlHandler::CanHandle(wxXmlNode
*node
)
65 IsOfClass(node
, wxT("wxToggleButton")) ||
66 IsOfClass(node
, wxT("wxBitmapToggleButton"))
70 void wxToggleButtonXmlHandler::DoCreateToggleButton(wxObject
*control
)
72 wxToggleButton
*button
= wxDynamicCast(control
, wxToggleButton
);
74 button
->Create(m_parentAsWindow
,
76 GetText(wxT("label")),
77 GetPosition(), GetSize(),
82 button
->SetValue(GetBool( wxT("checked")));
85 #if !defined(__WXUNIVERSAL__) && !defined(__WXMOTIF__) && !defined(__WXPALMOS__) && !defined(__WXPM__) && !(defined(__WXGTK__) && !defined(__WXGTK20__))
86 void wxToggleButtonXmlHandler::DoCreateBitmapToggleButton(wxObject
*control
)
88 wxBitmapToggleButton
*button
= wxDynamicCast(control
, wxBitmapToggleButton
);
90 button
->Create(m_parentAsWindow
,
92 GetBitmap(wxT("bitmap"), wxART_BUTTON
),
93 GetPosition(), GetSize(),
98 button
->SetValue(GetBool( wxT("checked")));
101 #endif // wxUSE_XRC && wxUSE_TOGGLEBTN