]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/xrc/xh_bttn.cpp
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / src / xrc / xh_bttn.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/xrc/xh_bttn.cpp
3// Purpose: XRC resource for buttons
4// Author: Vaclav Slavik
5// Created: 2000/03/05
6// Copyright: (c) 2000 Vaclav Slavik
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14 #pragma hdrstop
15#endif
16
17#if wxUSE_XRC && wxUSE_BUTTON
18
19#include "wx/xrc/xh_bttn.h"
20
21#ifndef WX_PRECOMP
22 #include "wx/button.h"
23#endif
24
25IMPLEMENT_DYNAMIC_CLASS(wxButtonXmlHandler, wxXmlResourceHandler)
26
27wxButtonXmlHandler::wxButtonXmlHandler()
28: wxXmlResourceHandler()
29{
30 XRC_ADD_STYLE(wxBU_LEFT);
31 XRC_ADD_STYLE(wxBU_RIGHT);
32 XRC_ADD_STYLE(wxBU_TOP);
33 XRC_ADD_STYLE(wxBU_BOTTOM);
34 XRC_ADD_STYLE(wxBU_EXACTFIT);
35 AddWindowStyles();
36}
37
38wxObject *wxButtonXmlHandler::DoCreateResource()
39{
40 XRC_MAKE_INSTANCE(button, wxButton)
41
42 button->Create(m_parentAsWindow,
43 GetID(),
44 GetText(wxT("label")),
45 GetPosition(), GetSize(),
46 GetStyle(),
47 wxDefaultValidator,
48 GetName());
49
50 if (GetBool(wxT("default"), 0))
51 button->SetDefault();
52
53 if ( GetParamNode("bitmap") )
54 {
55 button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON),
56 GetDirection("bitmapposition"));
57 }
58
59 SetupWindow(button);
60
61 return button;
62}
63
64bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
65{
66 return IsOfClass(node, wxT("wxButton"));
67}
68
69#endif // wxUSE_XRC && wxUSE_BUTTON