]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_bmpbt.cpp
Generalised WinCE fix for other platforms
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
12 #pragma implementation "xh_bmpbt.h"
13 #endif
14
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
17
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 #if wxUSE_XRC
23
24 #include "wx/xrc/xh_bmpbt.h"
25 #include "wx/bmpbuttn.h"
26
27 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButtonXmlHandler, wxXmlResourceHandler)
28
29 wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler()
30 : wxXmlResourceHandler()
31 {
32 XRC_ADD_STYLE(wxBU_AUTODRAW);
33 XRC_ADD_STYLE(wxBU_LEFT);
34 XRC_ADD_STYLE(wxBU_RIGHT);
35 XRC_ADD_STYLE(wxBU_TOP);
36 XRC_ADD_STYLE(wxBU_BOTTOM);
37 XRC_ADD_STYLE(wxBU_EXACTFIT);
38 AddWindowStyles();
39 }
40
41 wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
42 {
43 XRC_MAKE_INSTANCE(button, wxBitmapButton)
44
45 button->Create(m_parentAsWindow,
46 GetID(),
47 GetBitmap(wxT("bitmap"), wxART_BUTTON),
48 GetPosition(), GetSize(),
49 GetStyle(wxT("style"), wxBU_AUTODRAW),
50 wxDefaultValidator,
51 GetName());
52 if (GetBool(wxT("default"), 0))
53 button->SetDefault();
54 SetupWindow(button);
55
56 if (!GetParamValue(wxT("selected")).IsEmpty())
57 button->SetBitmapSelected(GetBitmap(wxT("selected")));
58 if (!GetParamValue(wxT("focus")).IsEmpty())
59 button->SetBitmapFocus(GetBitmap(wxT("focus")));
60 if (!GetParamValue(wxT("disabled")).IsEmpty())
61 button->SetBitmapDisabled(GetBitmap(wxT("disabled")));
62
63 return button;
64 }
65
66 bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
67 {
68 return IsOfClass(node, wxT("wxBitmapButton"));
69 }
70
71 #endif // wxUSE_XRC