X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d56cebe7a497773d8753ea2ab874c4445bac18dc..a81c3c2383f9096ef5e96b708a0f1c1ffe7cc6a8:/wxPython/contrib/xrc/xrc.i diff --git a/wxPython/contrib/xrc/xrc.i b/wxPython/contrib/xrc/xrc.i index 13b1fe766f..3e6869004f 100644 --- a/wxPython/contrib/xrc/xrc.i +++ b/wxPython/contrib/xrc/xrc.i @@ -32,6 +32,13 @@ //--------------------------------------------------------------------------- +enum wxXmlResourceFlags +{ + wxXRC_USE_LOCALE = 1, + wxXRC_NO_SUBCLASSING = 2 +}; + + // This class holds XML resources from one or more .xml files // (or derived forms, either binary or zipped -- see manual for // details). @@ -39,14 +46,17 @@ class wxXmlResource : public wxObject { public: - // Ctor. If use_locale is TRUE, translatable strings are - // translated via _(). You can disable it by passing use_locale=FALSE - // (for example if you provide resource file for each locale) - %name(wxXmlResourceEmpty)wxXmlResource(bool use_locale = TRUE); // TODO, a better %name + // Ctor. + // Flags: wxXRC_USE_LOCALE + // translatable strings will be translated via _() + // wxXRC_NO_SUBCLASSING + // subclass property of object nodes will be ignored + // (useful for previews in XRC editors) + %name(wxXmlResourceEmpty)wxXmlResource(int flags = wxXRC_USE_LOCALE); // TODO, a better %name %addmethods { - wxXmlResource(const wxString* filemask, bool use_locale = TRUE) { - wxXmlResource* res = new wxXmlResource(*filemask, use_locale); + wxXmlResource(const wxString* filemask, int flags = wxXRC_USE_LOCALE) { + wxXmlResource* res = new wxXmlResource(*filemask, flags); res->InitAllHandlers(); return res; } @@ -112,7 +122,7 @@ public: // Returns numeric ID that is equivalent to string id used in XML // resource. To be used in event tables // Macro XMLID is provided for convenience - static int GetXMLID(const char *str_id); + static int GetXRCID(const wxString& str_id); // Returns version info (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a) long GetVersion() const; @@ -121,29 +131,30 @@ public: // is less than the argument, +1 if greater and 0 if they equal. int CompareVersion(int major, int minor, int release, int revision) const; -}; -//---------------------------------------------------------------------- + // Gets global resources object or create one if none exists + static wxXmlResource *Get(); + // Sets global resources object and returns pointer to previous one (may be NULL). + static wxXmlResource *Set(wxXmlResource *res); -%readonly -// Global instance of resource class. For your convenience. -wxXmlResource *wxTheXmlResource; -%readwrite +}; //---------------------------------------------------------------------- %pragma(python) code = " -def XMLID(str_id): - return wxXmlResource_GetXMLID(str_id) +def XRCID(str_id): + return wxXmlResource_GetXRCID(str_id) -def XMLCTRL(window, str_id, *args): - return window.FindWindowById(XMLID(str_id)) +def XRCCTRL(window, str_id, *ignoreargs): + return window.FindWindowById(XRCID(str_id)) +XMLID = XRCID +XMLCTRL = XRCCTRL " //---------------------------------------------------------------------- -// TODO: Add wxXmlResourceHandler and etc. +// TODO: Add wxXmlResourceHandler and allow it to be derived from. //---------------------------------------------------------------------- @@ -152,10 +163,15 @@ def XMLCTRL(window, str_id, *args): wxClassInfo::CleanUpClasses(); wxClassInfo::InitializeClasses(); - wxXmlInitXmlModule(); wxXmlInitResourceModule(); - wxTheXmlResource->InitAllHandlers(); + wxXmlResource::Get()->InitAllHandlers(); %} -//--------------------------------------------------------------------------- +//---------------------------------------------------------------------- +// This file gets appended to the shadow class file. +//---------------------------------------------------------------------- + +%pragma(python) include="_xrcextras.py"; + +