]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_bmp.cpp
fix another memory leak in SetCommand() (coverity checker CID 52)
[wxWidgets.git] / src / xrc / xh_bmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_bmp.cpp
3 // Purpose: XRC resource for wxBitmap and wxIcon
4 // Author: Vaclav Slavik
5 // Created: 2000/09/09
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 Vaclav Slavik
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_bmp.h"
21 #include "wx/bitmap.h"
22
23 IMPLEMENT_DYNAMIC_CLASS(wxBitmapXmlHandler, wxXmlResourceHandler)
24
25 wxBitmapXmlHandler::wxBitmapXmlHandler()
26 : wxXmlResourceHandler()
27 {
28 }
29
30 wxObject *wxBitmapXmlHandler::DoCreateResource()
31 {
32 // NB: empty parameter name means "take directly from this node's next
33 // instead of from subnode with given name"
34 return new wxBitmap(GetBitmap(wxEmptyString));
35 }
36
37 bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node)
38 {
39 return IsOfClass(node, wxT("wxBitmap"));
40 }
41
42 IMPLEMENT_DYNAMIC_CLASS(wxIconXmlHandler, wxXmlResourceHandler)
43
44 wxIconXmlHandler::wxIconXmlHandler()
45 : wxXmlResourceHandler()
46 {
47 }
48
49 wxObject *wxIconXmlHandler::DoCreateResource()
50 {
51 // NB: empty parameter name means "take directly from this node's next
52 // instead of from subnode with given name"
53 return new wxIcon(GetIcon(wxEmptyString));
54 }
55
56 bool wxIconXmlHandler::CanHandle(wxXmlNode *node)
57 {
58 return IsOfClass(node, wxT("wxIcon"));
59 }
60
61 #endif // wxUSE_XRC