]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xrc/xmlres.cpp
Make use of new array functions.
[wxWidgets.git] / src / xrc / xmlres.cpp
index b0376ee8516233bb371cf7037653673071254ee7..0a1b72cd3a352efede382725cee04ab4ecc9074c 100644 (file)
@@ -132,6 +132,12 @@ void wxXmlResource::AddHandler(wxXmlResourceHandler *handler)
     handler->SetParentResource(this);
 }
 
+void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler)
+{
+    m_handlers.Insert(handler);
+    handler->SetParentResource(this);
+}
+
 
 
 void wxXmlResource::ClearHandlers()
@@ -165,10 +171,7 @@ wxToolBar *wxXmlResource::LoadToolBar(wxWindow *parent, const wxString& name)
 
 wxDialog *wxXmlResource::LoadDialog(wxWindow *parent, const wxString& name)
 {
-    wxDialog *dialog = new wxDialog;
-    if (!LoadDialog(dialog, parent, name))
-        { delete dialog; return NULL; }
-    else return dialog;
+    return (wxDialog*)CreateResFromNode(FindResource(name, wxT("wxDialog")), parent, NULL);
 }
 
 bool wxXmlResource::LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name)
@@ -188,6 +191,11 @@ bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString&
     return CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, panel) != NULL;
 }
 
+wxFrame *wxXmlResource::LoadFrame(wxWindow* parent, const wxString& name)
+{
+    return (wxFrame*)CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, NULL);
+}
+
 bool wxXmlResource::LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name)
 {
     return CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, frame) != NULL;
@@ -213,6 +221,18 @@ wxIcon wxXmlResource::LoadIcon(const wxString& name)
     return rt;
 }
 
+
+wxObject *wxXmlResource::LoadObject(wxWindow *parent, const wxString& name, const wxString& classname)
+{
+    return CreateResFromNode(FindResource(name, classname), parent, NULL);
+}
+
+bool wxXmlResource::LoadObject(wxObject *instance, wxWindow *parent, const wxString& name, const wxString& classname)
+{
+    return CreateResFromNode(FindResource(name, classname), parent, instance) != NULL;
+}
+
+
 bool wxXmlResource::AttachUnknownControl(const wxString& name,
                                          wxWindow *control, wxWindow *parent)
 {
@@ -756,7 +776,7 @@ wxColour wxXmlResourceHandler::GetColour(const wxString& param)
 
 
 
-wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param, 
+wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
                                          const wxArtClient& defaultArtClient,
                                          wxSize size)
 {
@@ -768,7 +788,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
         if ( !sid.empty() )
         {
             wxString scl = bmpNode->GetPropVal(wxT("stock_client"), defaultArtClient);
-            wxBitmap stockArt = 
+            wxBitmap stockArt =
                 wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(sid),
                                          wxART_MAKE_CLIENT_ID_FROM_STR(scl),
                                          size);
@@ -777,9 +797,9 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
         }
     }
 
-    /* ...or load the bitmap from file: */  
+    /* ...or load the bitmap from file: */
     wxString name = GetParamValue(param);
-    if (name.IsEmpty()) return wxNullBitmap;        
+    if (name.IsEmpty()) return wxNullBitmap;
 #if wxUSE_FILESYSTEM
     wxFSFile *fsfile = GetCurFileSystem().OpenFile(name);
     if (fsfile == NULL)
@@ -805,7 +825,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
 
 
 
-wxIcon wxXmlResourceHandler::GetIcon(const wxString& param, 
+wxIcon wxXmlResourceHandler::GetIcon(const wxString& param,
                                      const wxArtClient& defaultArtClient,
                                      wxSize size)
 {