]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_bmpbt.cpp
fixed problems with sometimes processing the events twice introduced in rev 1.170...
[wxWidgets.git] / src / xrc / xh_bmpbt.cpp
CommitLineData
78d14f80
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: xh_bmpbt.cpp
b5d6954b 3// Purpose: XRC resource for bitmap buttons
78d14f80
VS
4// Author: Brian Gavin
5// Created: 2000/09/09
6// RCS-ID: $Id$
7// Copyright: (c) 2000 Brian Gavin
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
f80ea77b 10
78d14f80
VS
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
621be1ec 18#if wxUSE_XRC
a1e4ec87 19
78d14f80 20#include "wx/xrc/xh_bmpbt.h"
d8418952 21#include "wx/bmpbuttn.h"
78d14f80 22
854e189f
VS
23IMPLEMENT_DYNAMIC_CLASS(wxBitmapButtonXmlHandler, wxXmlResourceHandler)
24
f80ea77b
WS
25wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler()
26: wxXmlResourceHandler()
78d14f80 27{
544fee32
VS
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);
d8e1aa86 33 XRC_ADD_STYLE(wxBU_EXACTFIT);
78d14f80
VS
34 AddWindowStyles();
35}
36
78d14f80 37wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
f80ea77b 38{
544fee32
VS
39 XRC_MAKE_INSTANCE(button, wxBitmapButton)
40
41 button->Create(m_parentAsWindow,
42 GetID(),
abda7717 43 GetBitmap(wxT("bitmap"), wxART_BUTTON),
544fee32
VS
44 GetPosition(), GetSize(),
45 GetStyle(wxT("style"), wxBU_AUTODRAW),
46 wxDefaultValidator,
47 GetName());
48 if (GetBool(wxT("default"), 0))
49 button->SetDefault();
78d14f80 50 SetupWindow(button);
f80ea77b 51
78d14f80
VS
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")));
f80ea77b 58
78d14f80
VS
59 return button;
60}
61
78d14f80
VS
62bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
63{
64 return IsOfClass(node, wxT("wxBitmapButton"));
65}
a1e4ec87 66
621be1ec 67#endif // wxUSE_XRC