]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xrc/xh_stbmp.cpp
implemented subclassing in XRC
[wxWidgets.git] / src / xrc / xh_stbmp.cpp
index 49371752a49ebcdf79ba1021978479e5437e1120..544b43de9f6dda2a2a5c4d0fea2251a4d7681bf2 100644 (file)
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        xh_stbmp.cpp
-// Purpose:     XML resource for wxStaticBitmap
+// Purpose:     XRC resource for wxStaticBitmap
 // Author:      Vaclav Slavik
 // Created:     2000/04/22
 // RCS-ID:      $Id$
@@ -30,13 +30,18 @@ wxStaticBitmapXmlHandler::wxStaticBitmapXmlHandler()
 
 wxObject *wxStaticBitmapXmlHandler::DoCreateResource()
 { 
-    wxStaticBitmap *bmp = new wxStaticBitmap(m_parentAsWindow,
-                                    GetID(),
-                                    GetBitmap(wxT("bitmap"), GetSize()),
-                                    GetPosition(), GetSize(),
-                                    GetStyle(),
-                                    GetName()
-                                    );
+    wxStaticBitmap *bmp = wxStaticCast(m_instance, wxStaticBitmap);
+
+    if (!bmp)
+       bmp = new wxStaticBitmap;
+
+    bmp->Create(m_parentAsWindow,
+                GetID(),
+                GetBitmap(wxT("bitmap"), GetSize()),
+                GetPosition(), GetSize(),
+                GetStyle(),
+                GetName());
+
     SetupWindow(bmp);
     
     return bmp;