]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_tglbtn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_tglbtn.cpp
3 // Purpose: XRC resource for wxToggleButton
4 // Author: Bob Mitchell
6 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_XRC && wxUSE_TOGGLEBTN
19 #include "wx/xrc/xh_tglbtn.h"
20 #include "wx/tglbtn.h"
21 #include "wx/button.h" // solely for wxBU_EXACTFIT
23 IMPLEMENT_DYNAMIC_CLASS(wxToggleButtonXmlHandler
, wxXmlResourceHandler
)
25 wxToggleButtonXmlHandler::wxToggleButtonXmlHandler()
26 : wxXmlResourceHandler()
28 XRC_ADD_STYLE(wxBU_EXACTFIT
);
33 wxObject
*wxToggleButtonXmlHandler::DoCreateResource()
36 wxObject
*control
= m_instance
;
38 #if !defined(__WXUNIVERSAL__) && !defined(__WXMOTIF__) && !defined(__WXPM__) && !(defined(__WXGTK__) && !defined(__WXGTK20__))
40 if (m_class
== wxT("wxBitmapToggleButton"))
43 control
= new wxBitmapToggleButton
;
45 DoCreateBitmapToggleButton(control
);
51 control
= new wxToggleButton
;
53 DoCreateToggleButton(control
);
56 SetupWindow(wxDynamicCast(control
, wxWindow
));
61 bool wxToggleButtonXmlHandler::CanHandle(wxXmlNode
*node
)
64 IsOfClass(node
, wxT("wxToggleButton")) ||
65 IsOfClass(node
, wxT("wxBitmapToggleButton"))
69 void wxToggleButtonXmlHandler::DoCreateToggleButton(wxObject
*control
)
71 wxToggleButton
*button
= wxDynamicCast(control
, wxToggleButton
);
73 button
->Create(m_parentAsWindow
,
75 GetText(wxT("label")),
76 GetPosition(), GetSize(),
81 button
->SetValue(GetBool( wxT("checked")));
84 #if !defined(__WXUNIVERSAL__) && !defined(__WXMOTIF__) && !defined(__WXPM__) && !(defined(__WXGTK__) && !defined(__WXGTK20__))
85 void wxToggleButtonXmlHandler::DoCreateBitmapToggleButton(wxObject
*control
)
87 wxBitmapToggleButton
*button
= wxDynamicCast(control
, wxBitmapToggleButton
);
89 button
->Create(m_parentAsWindow
,
91 GetBitmap(wxT("bitmap"), wxART_BUTTON
),
92 GetPosition(), GetSize(),
97 button
->SetValue(GetBool( wxT("checked")));
100 #endif // wxUSE_XRC && wxUSE_TOGGLEBTN