1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        src/xrc/xh_bmp.cpp
3 // Purpose:     XRC resource for wxBitmap and wxIcon
4 // Author:      Vaclav Slavik
5 // Created:     2000/09/09
6 // RCS-ID:      $Id: xh_bmp.cpp 39710 2006-06-14 10:02:19Z ABX $
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 
22 #ifndef WX_PRECOMP
23     #include "wx/bitmap.h"
24 #endif
25 
IMPLEMENT_DYNAMIC_CLASS(wxBitmapXmlHandler,wxXmlResourceHandler)26 IMPLEMENT_DYNAMIC_CLASS(wxBitmapXmlHandler, wxXmlResourceHandler)
27 
28 wxBitmapXmlHandler::wxBitmapXmlHandler()
29                    :wxXmlResourceHandler()
30 {
31 }
32 
DoCreateResource()33 wxObject *wxBitmapXmlHandler::DoCreateResource()
34 {
35     // NB: empty parameter name means "take directly from this node's next
36     //     instead of from subnode with given name"
37     return new wxBitmap(GetBitmap(wxEmptyString));
38 }
39 
CanHandle(wxXmlNode * node)40 bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node)
41 {
42     return IsOfClass(node, wxT("wxBitmap"));
43 }
44 
IMPLEMENT_DYNAMIC_CLASS(wxIconXmlHandler,wxXmlResourceHandler)45 IMPLEMENT_DYNAMIC_CLASS(wxIconXmlHandler, wxXmlResourceHandler)
46 
47 wxIconXmlHandler::wxIconXmlHandler()
48 : wxXmlResourceHandler()
49 {
50 }
51 
DoCreateResource()52 wxObject *wxIconXmlHandler::DoCreateResource()
53 {
54     // NB: empty parameter name means "take directly from this node's next
55     //     instead of from subnode with given name"
56     return new wxIcon(GetIcon(wxEmptyString));
57 }
58 
CanHandle(wxXmlNode * node)59 bool wxIconXmlHandler::CanHandle(wxXmlNode *node)
60 {
61     return IsOfClass(node, wxT("wxIcon"));
62 }
63 
64 #endif // wxUSE_XRC
65