]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/xrc/xrc.i
mention ShouldInheritColours() change
[wxWidgets.git] / wxPython / contrib / xrc / xrc.i
index 04f3c394716835d7b713e089567bfceeb547f51e..f2be7c4107af1f2e5a4f6c0305e015eb37f965ce 100644 (file)
@@ -16,7 +16,7 @@
 %{
 #include "wxPython.h"
 #include "pyistream.h"
-#include "wx/xrc/xml.h"
+#include "wx/xml/xml.h"
 #include "wx/xrc/xmlres.h"
 #include <wx/filesys.h>
 #include <wx/fs_mem.h>
@@ -48,6 +48,9 @@
     static const wxString wxPyIconString(wxT("icon"));
     static const wxString wxPyFontString(wxT("font"));
 %}
+
+class wxPyXmlSubclassFactory;
+
 //---------------------------------------------------------------------------
 
 enum wxXmlResourceFlags
@@ -128,6 +131,12 @@ public:
     // Removes all handlers
     void ClearHandlers();
 
+    // Registers subclasses factory for use in XRC. This function is not meant
+    // for public use, please see the comment above wxXmlSubclassFactory
+    // definition.
+    static void AddSubclassFactory(wxPyXmlSubclassFactory *factory);
+
+
     // Loads menu from resource. Returns NULL on failure.
     wxMenu *LoadMenu(const wxString& name);
 
@@ -196,6 +205,12 @@ public:
     // Sets global resources object and returns pointer to previous one (may be NULL).
     static wxXmlResource *Set(wxXmlResource *res);
 
+    // Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
+    int GetFlags();
+
+    // Set flags after construction.
+    void SetFlags(int flags) { m_flags = flags; }
+
 };
 
 //----------------------------------------------------------------------
@@ -212,6 +227,31 @@ XMLCTRL = XRCCTRL
 "
 
 //----------------------------------------------------------------------
+// wxXmlSubclassFactory
+
+
+%{
+class wxPyXmlSubclassFactory : public wxXmlSubclassFactory
+{
+public:
+    wxPyXmlSubclassFactory() {}
+    DEC_PYCALLBACK_OBJECT_STRING_pure(Create);
+    PYPRIVATE;
+};
+
+IMP_PYCALLBACK_OBJECT_STRING_pure(wxPyXmlSubclassFactory, wxXmlSubclassFactory, Create);
+%}
+
+
+%name(wxXmlSubclassFactory)class wxPyXmlSubclassFactory {
+public:
+    wxPyXmlSubclassFactory();
+
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxXmlSubclassFactory)"
+};
+
+
 //----------------------------------------------------------------------
 // In order to provide wrappers for wxXmlResourceHandler we need to also
 // provide the classes for representing and parsing XML.
@@ -371,6 +411,13 @@ public:
             return self->GetEncoding();
         #endif
         }
+        void SetEncoding(const wxString& enc) {
+        #if wxUSE_UNICODE
+            // do nothing
+        #else
+            self->SetEncoding(enc);
+        #endif
+        }
     }
 };
 
@@ -393,34 +440,6 @@ public:
     DEC_PYCALLBACK_OBJECT__pure(DoCreateResource);
     DEC_PYCALLBACK_BOOL_NODE_pure(CanHandle);
 
-//     wxObject* DoCreateResource() {
-//         wxObject* rv = NULL;
-//         wxPyBeginBlockThreads();
-//         if (wxPyCBH_findCallback(m_myInst, "DoCreateResource")) {
-//             PyObject* ro;
-//             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
-//             if (ro) {
-//                 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p");
-//                 Py_DECREF(ro);
-//             }
-//         }
-//         wxPyEndBlockThreads();
-//         return rv;
-//     }
-
-//     bool CanHandle(wxXmlNode* a) {
-//         bool rv=FALSE;
-//         wxPyBeginBlockThreads();
-//         if (wxPyCBH_findCallback(m_myInst, "CanHandle")) {
-//             PyObject* obj = wxPyConstructObject((void*)a, "wxXmlNode", 0);
-//             rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
-//             Py_DECREF(obj);
-//         }
-//         wxPyEndBlockThreads();
-//         return rv;
-//     }
-
-
 
     // accessors for protected members
 
@@ -658,9 +677,6 @@ public:
 
 %init %{
 
-    wxClassInfo::CleanUpClasses();
-    wxClassInfo::InitializeClasses();
-
     wxXmlInitResourceModule();
     wxXmlResource::Get()->InitAllHandlers();