]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_bttn.cpp
Remove SashHitTest() "tolerance" parameter
[wxWidgets.git] / src / xrc / xh_bttn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/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 && wxUSE_BUTTON
19
20 #include "wx/xrc/xh_bttn.h"
21
22 #ifndef WX_PRECOMP
23 #include "wx/button.h"
24 #endif
25
26 IMPLEMENT_DYNAMIC_CLASS(wxButtonXmlHandler, wxXmlResourceHandler)
27
28 wxButtonXmlHandler::wxButtonXmlHandler()
29 : wxXmlResourceHandler()
30 {
31 XRC_ADD_STYLE(wxBU_LEFT);
32 XRC_ADD_STYLE(wxBU_RIGHT);
33 XRC_ADD_STYLE(wxBU_TOP);
34 XRC_ADD_STYLE(wxBU_BOTTOM);
35 XRC_ADD_STYLE(wxBU_EXACTFIT);
36 AddWindowStyles();
37 }
38
39 wxObject *wxButtonXmlHandler::DoCreateResource()
40 {
41 XRC_MAKE_INSTANCE(button, wxButton)
42
43 button->Create(m_parentAsWindow,
44 GetID(),
45 GetText(wxT("label")),
46 GetPosition(), GetSize(),
47 GetStyle(),
48 wxDefaultValidator,
49 GetName());
50
51 if (GetBool(wxT("default"), 0))
52 button->SetDefault();
53
54 if ( GetParamNode("bitmap") )
55 {
56 button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON),
57 GetDirection("bitmapposition"));
58 }
59
60 SetupWindow(button);
61
62 return button;
63 }
64
65 bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
66 {
67 return IsOfClass(node, wxT("wxButton"));
68 }
69
70 #endif // wxUSE_XRC && wxUSE_BUTTON