]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xrc/xh_mdi.cpp
non mach-o fix
[wxWidgets.git] / src / xrc / xh_mdi.cpp
index 21010352f700e1c97eb8c9f9010ea3cbf240d949..507f49d806fe43ae1dcd680476ee12e534f5ee44 100644 (file)
@@ -8,10 +8,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "xh_mdi.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -68,7 +64,7 @@ wxWindow *wxMdiXmlHandler::CreateFrame()
     {
         XRC_MAKE_INSTANCE(frame, wxMDIParentFrame);
 
-        ((wxMDIParentFrame*)frame)->Create(m_parentAsWindow,
+        frame->Create(m_parentAsWindow,
                       GetID(),
                       GetText(wxT("title")),
                       wxDefaultPosition, wxDefaultSize,
@@ -82,11 +78,14 @@ wxWindow *wxMdiXmlHandler::CreateFrame()
         wxMDIParentFrame *mdiParent = wxDynamicCast(m_parent, wxMDIParentFrame);
 
         if ( !mdiParent )
-            wxLogError(wxT("Parent is not of type wxMDIParentFrame."));
+        {
+            wxLogError(wxT("Parent of wxMDIParentFrame must be wxMDIParentFrame."));
+            return NULL;
+        }
 
         XRC_MAKE_INSTANCE(frame, wxMDIChildFrame);
 
-        ((wxMDIChildFrame*) frame)->Create(mdiParent,
+        frame->Create(mdiParent,
                       GetID(),
                       GetText(wxT("title")),
                       wxDefaultPosition, wxDefaultSize,
@@ -105,10 +104,11 @@ wxObject *wxMdiXmlHandler::DoCreateResource()
         frame->SetClientSize(GetSize());
     if (HasParam(wxT("pos")))
         frame->Move(GetPosition());
-    if (HasParam(wxT("icon")) && frame->IsKindOf(CLASSINFO(wxFrame)))
+    if (HasParam(wxT("icon")))
     {
-        wxFrame* f = wxDynamicCast(f, wxFrame);
-        f->SetIcon(GetIcon(wxT("icon"), wxART_FRAME_ICON));
+        wxFrame* f = wxDynamicCast(frame, wxFrame);
+        if (f)
+            f->SetIcon(GetIcon(wxT("icon"), wxART_FRAME_ICON));
     }
 
     SetupWindow(frame);