]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_bttn.cpp
First pass at integrating a code generator in XRCed. Initial patch
[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 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_XRC
19
20 #include "wx/xrc/xh_bttn.h"
21 #include "wx/button.h"
22
23 IMPLEMENT_DYNAMIC_CLASS(wxButtonXmlHandler, wxXmlResourceHandler)
24
25 wxButtonXmlHandler::wxButtonXmlHandler()
26 : wxXmlResourceHandler()
27 {
28 XRC_ADD_STYLE(wxBU_LEFT);
29 XRC_ADD_STYLE(wxBU_RIGHT);
30 XRC_ADD_STYLE(wxBU_TOP);
31 XRC_ADD_STYLE(wxBU_BOTTOM);
32 XRC_ADD_STYLE(wxBU_EXACTFIT);
33 AddWindowStyles();
34 }
35
36 wxObject *wxButtonXmlHandler::DoCreateResource()
37 {
38 XRC_MAKE_INSTANCE(button, wxButton)
39
40 button->Create(m_parentAsWindow,
41 GetID(),
42 GetText(wxT("label")),
43 GetPosition(), GetSize(),
44 GetStyle(),
45 wxDefaultValidator,
46 GetName());
47
48 if (GetBool(wxT("default"), 0))
49 button->SetDefault();
50 SetupWindow(button);
51
52 return button;
53 }
54
55 bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
56 {
57 return IsOfClass(node, wxT("wxButton"));
58 }
59
60 #endif // wxUSE_XRC