class WXDLLEXPORT wxToolBar;
class WXXMLDLLEXPORT wxXmlResourceHandler;
+class WXXMLDLLEXPORT wxXmlSubclassFactory;
+class WXXMLDLLEXPORT wxXmlSubclassFactoriesList;
+class wxXmlResourceModule;
// These macros indicate current version of XML resources (this information is
#define WX_XMLRES_CURRENT_VERSION_MINOR 3
#define WX_XMLRES_CURRENT_VERSION_RELEASE 0
#define WX_XMLRES_CURRENT_VERSION_REVISION 1
-#define WX_XMLRES_CURRENT_VERSION_STRING "2.3.0.1"
+#define WX_XMLRES_CURRENT_VERSION_STRING _T("2.3.0.1")
#define WX_XMLRES_CURRENT_VERSION \
(WX_XMLRES_CURRENT_VERSION_MAJOR * 256*256*256 + \
// 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(wxXmlSubclassFactory *factory);
// Loads menu from resource. Returns NULL on failure.
wxMenu *LoadMenu(const wxString& name);
static wxXmlResource *Set(wxXmlResource *res);
// Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
- int GetFlags() { return m_flags; }
+ int GetFlags() const { return m_flags; }
+ // Set flags after construction.
+ void SetFlags(int flags) { m_flags = flags; }
protected:
// Scans the resources list for unloaded files and loads them. Also reloads
// Helper function: finds a resource (calls UpdateResources) and returns a node containing it.
wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive);
- // Creates a resource from information in the given node.
- wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL);
+ // Creates a resource from information in the given node
+ // (Uses only 'handlerToUse' if != NULL)
+ wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent,
+ wxObject *instance = NULL,
+ wxXmlResourceHandler *handlerToUse = NULL);
private:
long m_version;
#endif
friend class wxXmlResourceHandler;
+ friend class wxXmlResourceModule;
+
+ static wxXmlSubclassFactoriesList *ms_subclassFactories;
// singleton instance:
static wxXmlResource *ms_instance;
void wxXmlInitResourceModule();
+// This class is used to create instances of XRC "object" nodes with "subclass"
+// property. It is _not_ supposed to be used by XRC users, you should instead
+// register your subclasses via wxWindows' RTTI mechanism. This class is useful
+// only for language bindings developer who need a way to implement subclassing
+// in wxWindows ports that don't support wxRTTI (e.g. wxPython).
+class WXXMLDLLEXPORT wxXmlSubclassFactory
+{
+public:
+ // Try to create instance of given class and return it, return NULL on failure:
+ virtual wxObject *Create(const wxString& className) = 0;
+ virtual ~wxXmlSubclassFactory() {}
+};
+
+
/* -------------------------------------------------------------------------
Backward compatibility macros. Do *NOT* use, they may disappear in future
versions of the XRC library!
------------------------------------------------------------------------- */
-#define ADD_STYLE XRC_ADD_STYLE
-#define wxTheXmlResource wxXmlResource::Get()
-#define XMLID XRCID
-#define XMLCTRL XRCCTRL
-#define GetXMLID GetXRCID
+#if WXWIN_COMPATIBILITY_2_4
+ #define ADD_STYLE XRC_ADD_STYLE
+ #define wxTheXmlResource wxXmlResource::Get()
+ #define XMLID XRCID
+ #define XMLCTRL XRCCTRL
+ #define GetXMLID GetXRCID
+#endif
#endif // _WX_XMLRES_H_