X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c75a4cf0f94cbe53bfde4fbcddff741158fbc7c..aa43bcc774710923c26e046d187953175b308478:/wxPython/src/_defs.i diff --git a/wxPython/src/_defs.i b/wxPython/src/_defs.i index 04c2c31fea..1aa7ff32b0 100644 --- a/wxPython/src/_defs.i +++ b/wxPython/src/_defs.i @@ -12,20 +12,56 @@ //--------------------------------------------------------------------------- -// 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 +%feature("kwargs", "1"); + +// 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... +%feature("nodefaultctor"); +%feature("nodefaultdtor"); +#endif + +// For all items that don't have a %rename already, give them a %rename that +// removes the leading 'wx' (except for wxEVT_* items.) +%rename("%(wxpy)s") ""; + +// 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 { + $action + if (PyErr_Occurred()) SWIG_fail; +} +%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. @@ -39,8 +75,16 @@ } %enddef - +// This macro can be used to disable the releasing of the GIL when calling the +// C++ function. This is like using threadWrapperOff for just this function. +%define KeepGIL(name) +%exception name { + $action + if (PyErr_Occurred()) SWIG_fail; +} +%enddef + //--------------------------------------------------------------------------- // some type definitions to simplify things for SWIG @@ -61,14 +105,23 @@ typedef unsigned long wxUIntPtr; #define %pythonAppend %feature("pythonappend") #define %pythonPrepend %feature("pythonprepend") +#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") -#define %noautodoc %feature("noautodoc") +#endif +#define %disownarg(typespec) %typemap(in) typespec = SWIGTYPE* DISOWN +#define %cleardisown(typespec) %typemap(in) typespec + +#define %ref %feature("ref") +#define %unref %feature("unref") -//#ifndef %shadow -//#define %shadow %insert("shadow") -//#endif #ifndef %pythoncode #define %pythoncode %insert("python") @@ -105,6 +158,9 @@ typedef unsigned long wxUIntPtr; %typemap(constcode) wxEventType "PyDict_SetItemString(d, \"$symname\", PyInt_FromLong($value));"; +%define %property(NAME, STUFF...) + %pythoncode { NAME = property(STUFF) } +%enddef //---------------------------------------------------------------------- // Macros for the docstring and autodoc features of SWIG. These will @@ -346,6 +402,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 @@ -423,6 +496,8 @@ enum { wxCLIP_CHILDREN, wxCLIP_SIBLINGS, + wxWINDOW_STYLE_MASK, + wxALWAYS_SHOW_SB, wxRETAINED, @@ -458,7 +533,9 @@ enum { wxRB_USE_CHECKBOX, wxST_SIZEGRIP, wxST_NO_AUTORESIZE, - + wxST_DOTS_MIDDLE, + wxST_DOTS_END, + wxFLOOD_SURFACE, wxFLOOD_BORDER, wxODDEVEN_RULE, @@ -497,6 +574,7 @@ enum { wxSIZE_AUTO, wxSIZE_USE_EXISTING, wxSIZE_ALLOW_MINUS_ONE, + wxSIZE_FORCE, wxPORTRAIT, wxLANDSCAPE, wxPRINT_QUALITY_HIGH, @@ -506,6 +584,7 @@ enum { wxID_ANY, wxID_SEPARATOR, + wxID_NONE, wxID_LOWEST, wxID_OPEN, @@ -520,15 +599,19 @@ enum { wxID_HELP, wxID_PRINT, wxID_PRINT_SETUP, + wxID_PAGE_SETUP, wxID_PREVIEW, wxID_ABOUT, wxID_HELP_CONTENTS, wxID_HELP_COMMANDS, wxID_HELP_PROCEDURES, wxID_HELP_CONTEXT, + wxID_HELP_INDEX, + wxID_HELP_SEARCH, wxID_CLOSE_ALL, wxID_PREFERENCES, + wxID_EDIT, wxID_CUT, wxID_COPY, wxID_PASTE, @@ -551,6 +634,7 @@ enum { wxID_VIEW_SORTSIZE, wxID_VIEW_SORTTYPE, + wxID_FILE, wxID_FILE1, wxID_FILE2, wxID_FILE3, @@ -608,31 +692,6 @@ enum { wxID_HIGHEST, - wxOPEN, - wxSAVE, - wxHIDE_READONLY, - wxOVERWRITE_PROMPT, - wxFILE_MUST_EXIST, - wxMULTIPLE, - wxCHANGE_DIR, - - wxACCEL_ALT, - wxACCEL_CTRL, - wxACCEL_SHIFT, - wxACCEL_NORMAL, - - wxPD_AUTO_HIDE, - wxPD_APP_MODAL, - wxPD_CAN_ABORT, - wxPD_ELAPSED_TIME, - wxPD_ESTIMATED_TIME, - wxPD_REMAINING_TIME, - wxPD_SMOOTH, - wxPD_CAN_SKIP, - - wxDD_NEW_DIR_BUTTON, - wxDD_DEFAULT_STYLE, - wxMENU_TEAROFF, wxMB_DOCKABLE, wxNO_FULL_REPAINT_ON_RESIZE, @@ -1128,27 +1187,18 @@ enum wxHitTest }; -%{ -#if ! wxUSE_HOTKEY -enum wxHotkeyModifier -{ - wxMOD_NONE = 0, - wxMOD_ALT = 1, - wxMOD_CONTROL = 2, - wxMOD_SHIFT = 4, - wxMOD_WIN = 8 -}; -#define wxEVT_HOTKEY 9999 -#endif -%} -enum wxHotkeyModifier +enum wxKeyModifier { - wxMOD_NONE = 0, - wxMOD_ALT = 1, - wxMOD_CONTROL = 2, - wxMOD_SHIFT = 4, - wxMOD_WIN = 8 + wxMOD_NONE, + wxMOD_ALT, + wxMOD_CONTROL, + wxMOD_ALTGR, + wxMOD_SHIFT, + wxMOD_META, + wxMOD_WIN, + wxMOD_CMD, + wxMOD_ALL }; @@ -1160,6 +1210,14 @@ enum wxUpdateUI }; +enum wxLayoutDirection +{ + wxLayout_Default, + wxLayout_LeftToRight, + wxLayout_RightToLeft +}; + + //---------------------------------------------------------------------------