1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_cmdlinkbn.cpp
3 // Purpose: XRC resource for command link buttons
4 // Author: Kinaou Herve
5 // Created: 2010/10/20
6 // Copyright:
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13
14 #if wxUSE_XRC && wxUSE_COMMANDLINKBUTTON
15
16 #include "wx/xrc/xh_cmdlinkbn.h"
17
18 #include "wx/commandlinkbutton.h"
19
20 wxIMPLEMENT_DYNAMIC_CLASS(wxCommandLinkButtonXmlHandler, wxXmlResourceHandler);
21
wxCommandLinkButtonXmlHandler()22 wxCommandLinkButtonXmlHandler::wxCommandLinkButtonXmlHandler()
23 : wxXmlResourceHandler()
24 {
25 XRC_ADD_STYLE(wxBU_LEFT);
26 XRC_ADD_STYLE(wxBU_RIGHT);
27 XRC_ADD_STYLE(wxBU_TOP);
28 XRC_ADD_STYLE(wxBU_BOTTOM);
29 XRC_ADD_STYLE(wxBU_EXACTFIT);
30 AddWindowStyles();
31 }
32
DoCreateResource()33 wxObject *wxCommandLinkButtonXmlHandler::DoCreateResource()
34 {
35 XRC_MAKE_INSTANCE(button, wxCommandLinkButton)
36
37 button->Create(m_parentAsWindow,
38 GetID(),
39 GetText(wxS("label")),
40 GetText(wxS("note")),
41 GetPosition(), GetSize(),
42 GetStyle(),
43 wxDefaultValidator,
44 GetName());
45
46 if (GetBool(wxT("default"), 0))
47 button->SetDefault();
48
49 if ( GetParamNode("bitmap") )
50 {
51 button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON),
52 GetDirection("bitmapposition"));
53 }
54
55 SetupWindow(button);
56
57 return button;
58 }
59
CanHandle(wxXmlNode * node)60 bool wxCommandLinkButtonXmlHandler::CanHandle(wxXmlNode *node)
61 {
62 return IsOfClass(node, wxS("wxCommandLinkButton"));
63 }
64
65 #endif // wxUSE_XRC && wxUSE_COMMANDLINKBUTTON
66