]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_bmpbt.cpp
fixed MIPSpro version in the comment
[wxWidgets.git] / src / xrc / xh_bmpbt.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_bmpbt.cpp
3 // Purpose: XRC resource for bitmap buttons
4 // Author: Brian Gavin
5 // Created: 2000/09/09
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 Brian Gavin
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_bmpbt.h"
21 #include "wx/bmpbuttn.h"
22
23 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButtonXmlHandler, wxXmlResourceHandler)
24
25 wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler()
26 : wxXmlResourceHandler()
27 {
28 XRC_ADD_STYLE(wxBU_AUTODRAW);
29 XRC_ADD_STYLE(wxBU_LEFT);
30 XRC_ADD_STYLE(wxBU_RIGHT);
31 XRC_ADD_STYLE(wxBU_TOP);
32 XRC_ADD_STYLE(wxBU_BOTTOM);
33 XRC_ADD_STYLE(wxBU_EXACTFIT);
34 AddWindowStyles();
35 }
36
37 wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
38 {
39 XRC_MAKE_INSTANCE(button, wxBitmapButton)
40
41 button->Create(m_parentAsWindow,
42 GetID(),
43 GetBitmap(wxT("bitmap"), wxART_BUTTON),
44 GetPosition(), GetSize(),
45 GetStyle(wxT("style"), wxBU_AUTODRAW),
46 wxDefaultValidator,
47 GetName());
48 if (GetBool(wxT("default"), 0))
49 button->SetDefault();
50 SetupWindow(button);
51
52 if (!GetParamValue(wxT("selected")).IsEmpty())
53 button->SetBitmapSelected(GetBitmap(wxT("selected")));
54 if (!GetParamValue(wxT("focus")).IsEmpty())
55 button->SetBitmapFocus(GetBitmap(wxT("focus")));
56 if (!GetParamValue(wxT("disabled")).IsEmpty())
57 button->SetBitmapDisabled(GetBitmap(wxT("disabled")));
58
59 return button;
60 }
61
62 bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
63 {
64 return IsOfClass(node, wxT("wxBitmapButton"));
65 }
66
67 #endif // wxUSE_XRC