]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_bttn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_bttn.cpp
3 // Purpose: XRC resource for buttons
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_XRC && wxUSE_BUTTON
20 #include "wx/xrc/xh_bttn.h"
23 #include "wx/button.h"
26 IMPLEMENT_DYNAMIC_CLASS(wxButtonXmlHandler
, wxXmlResourceHandler
)
28 wxButtonXmlHandler::wxButtonXmlHandler()
29 : wxXmlResourceHandler()
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
);
39 wxObject
*wxButtonXmlHandler::DoCreateResource()
41 XRC_MAKE_INSTANCE(button
, wxButton
)
43 button
->Create(m_parentAsWindow
,
45 GetText(wxT("label")),
46 GetPosition(), GetSize(),
51 if (GetBool(wxT("default"), 0))
54 if ( GetParamNode("bitmap") )
57 const wxString dirstr
= GetParamValue("bitmapposition");
58 if ( dirstr
.empty() || dirstr
== "wxLEFT" )
60 else if ( dirstr
== "wxRIGHT" )
62 else if ( dirstr
== "wxTOP" )
64 else if ( dirstr
== "wxBOTTOM" )
70 GetParamNode("bitmapposition"),
73 "Invalid bitmap position \"%s\": must be one of "
74 "wxLEFT|wxRIGHT|wxTOP|wxBOTTOM.",
82 button
->SetBitmap(GetBitmap("bitmap", wxART_BUTTON
), dir
);
90 bool wxButtonXmlHandler::CanHandle(wxXmlNode
*node
)
92 return IsOfClass(node
, wxT("wxButton"));
95 #endif // wxUSE_XRC && wxUSE_BUTTON