]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/xml/xh_stbmp.cpp
added xmlres format docs (uncomplete)
[wxWidgets.git] / contrib / src / xml / xh_stbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_stbmp.cpp
3 // Purpose: XML resource for wxStaticBitmap
4 // Author: Vaclav Slavik
5 // Created: 2000/04/22
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifdef __GNUG__
12 #pragma implementation "xh_stbmp.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 #include "wx/xml/xh_stbmp.h"
23 #include "wx/statbmp.h"
24 #include "wx/image.h"
25 #include "wx/bitmap.h"
26
27 wxStaticBitmapXmlHandler::wxStaticBitmapXmlHandler()
28 : wxXmlResourceHandler()
29 {
30 }
31
32 wxObject *wxStaticBitmapXmlHandler::DoCreateResource()
33 {
34 wxImage img(GetParamValue(_T("bitmap")));
35 wxSize sz = GetSize();
36
37 if (!(sz == wxDefaultSize)) img.Rescale(sz.x, sz.y);
38
39 wxStaticBitmap *bmp = new wxStaticBitmap(m_ParentAsWindow,
40 GetID(),
41 img.ConvertToBitmap(),
42 GetPosition(), GetSize(),
43 GetStyle(),
44 GetName()
45 );
46 SetupWindow(bmp);
47
48 return bmp;
49 }
50
51
52
53 bool wxStaticBitmapXmlHandler::CanHandle(wxXmlNode *node)
54 {
55 return node->GetName() == _T("staticbitmap");
56 }
57
58