X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c605285c8e427236193c0e368e6f0700659e262..bc50a2ae95f2ab36b16ceedc7902a9cbfb2f70ea:/wxPython/src/_defs.i diff --git a/wxPython/src/_defs.i b/wxPython/src/_defs.i index 014339c36b..1ceba2c622 100644 --- a/wxPython/src/_defs.i +++ b/wxPython/src/_defs.i @@ -12,8 +12,8 @@ //--------------------------------------------------------------------------- -// Globally turn on the autodoc feature +// Globally turn on the autodoc feature %feature("autodoc", "1"); // 0 == no param types, 1 == show param types // Turn on kwargs by default @@ -22,24 +22,39 @@ // Don't generate separate wrappers for each default args combination %feature("compactdefaultargs"); +#if SWIG_VERSION < 0x010328 // Don't generate default ctors or dtors if the C++ doesn't have them %feature("nodefault"); - +#else // This is the SWIG 1.3.28 way to do the above... -// // Don't generate default ctors or dtors if the C++ doesn't have them -// %feature("nodefaultctor"); -// %feature("nodefaultdtor"); +%feature("nodefaultctor"); +%feature("nodefaultdtor"); +#endif + +// For now, just supress the warning about using Python keywords as parameter +// names. Will need to come back later and correct these rather than just +// hide them... +#pragma SWIG nowarn=314 //--------------------------------------------------------------------------- -// Tell SWIG to wrap all the wrappers with our thread protection by default +// Tell SWIG to wrap all the wrappers with our thread protection +%define %threadWrapperOn %exception { PyThreadState* __tstate = wxPyBeginAllowThreads(); $action wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } +%enddef + +// This one will turn off the generation of the thread wrapper code +%define %threadWrapperOff +%exception +%enddef +// Turn it on by default +%threadWrapperOn // This one can be used to add a check for an existing wxApp before the real // work is done. An exception is raised if there isn't one. @@ -75,10 +90,20 @@ typedef unsigned long wxUIntPtr; #define %pythonAppend %feature("pythonappend") #define %pythonPrepend %feature("pythonprepend") -#define %kwargs %feature("kwargs") -#define %nokwargs %feature("kwargs", "0") #define %noautodoc %feature("noautodoc") +#if SWIG_VERSION >= 0x010327 +#undef %kwargs +#define %kwargs %feature("kwargs", "1") +#define %nokwargs %feature("kwargs", "0") +#else +#define %kwargs %feature("kwargs") +#define %nokwargs %feature("nokwargs") +#endif + +#define %disownarg(typespec) %typemap(in) typespec = SWIGTYPE* DISOWN +#define %cleardisown(typespec) %typemap(in) typespec + #ifndef %pythoncode @@ -357,6 +382,23 @@ typedef unsigned long wxUIntPtr; %enddef #endif + +//--------------------------------------------------------------------------- +// Generates a base_On* method that just wraps a call to the On*, and mark it +// deprecated. We need this because there is no longer any need for a +// base_On* method to be able to call the C++ base class method, since our +// virtualization code can now sense when an attempt is being made to call +// the base class version from the derived class override. + +%define %MAKE_BASE_FUNC(Class, Method) + %pythoncode { + def base_##Method(*args, **kw): + return Class.Method(*args, **kw) + base_##Method = wx._deprecated(base_##Method, + "Please use Class.Method instead.") + } +%enddef + //--------------------------------------------------------------------------- // Forward declarations and %renames for some classes, so the autodoc strings // will be able to use the right types even when the real class declaration is