Changes to the XRC library:
[wxWidgets.git] / src / xrc / xh_bttn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_bttn.cpp
3 // Purpose: XRC resource for buttons
4 // Author: Vaclav Slavik
5 // Created: 2000/03/05
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifdef __GNUG__
12 #pragma implementation "xh_bttn.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 #include "wx/xrc/xh_bttn.h"
23 #include "wx/button.h"
24
25
26 wxButtonXmlHandler::wxButtonXmlHandler()
27 : wxXmlResourceHandler()
28 {
29 ADD_STYLE(wxBU_LEFT);
30 ADD_STYLE(wxBU_RIGHT);
31 ADD_STYLE(wxBU_TOP);
32 ADD_STYLE(wxBU_BOTTOM);
33 AddWindowStyles();
34 }
35
36
37 wxObject *wxButtonXmlHandler::DoCreateResource()
38 {
39 wxButton *button = wxStaticCast(m_instance, wxButton);
40
41 if (!button)
42 button = new wxButton;
43
44 button->Create(m_parentAsWindow,
45 GetID(),
46 GetText(wxT("label")),
47 GetPosition(), GetSize(),
48 GetStyle(),
49 wxDefaultValidator,
50 GetName());
51
52 if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
53 SetupWindow(button);
54
55 return button;
56 }
57
58
59
60 bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
61 {
62 return IsOfClass(node, wxT("wxButton"));
63 }
64
65