# if this breaks something at your end, let me know and we can
# figure out some solution for both of us.
if [ "$SWIGDIR" = "" ]; then
- SWIGDIR=$PROJECTS\\SWIG-cvs
+ SWIGDIR=$PROJECTS\\SWIG-1.3.27
fi
FLAGS="USE_SWIG=1 SWIG=$SWIGDIR\\swig.exe"
('WXUSINGDLL', '1'),
('SWIG_TYPE_TABLE', WXPYTHON_TYPE_TABLE),
+ ('SWIG_PYTHON_OUTPUT_TUPLE', None),
('WXP_USE_THREAD', '1'),
]
WXDIR = '..'
includes = ['include', 'src']
defines = [('SWIG_TYPE_TABLE', WXPYTHON_TYPE_TABLE),
- ('HAVE_CONFIG_H', None),
+ ('SWIG_PYTHON_OUTPUT_TUPLE', None),
('WXP_USE_THREAD', '1'),
]
if UNDEF_NDEBUG:
swig_cmd = SWIG
swig_force = force
swig_args = ['-c++',
- '-Wall',
+ #'-Wall',
'-python',
'-new_repr',
'-modern',
void SetStateImageList(wxImageList *imageList);
void SetButtonsImageList(wxImageList *imageList);
- %apply SWIGTYPE *DISOWN { wxImageList *imageList };
+ %disownarg( wxImageList *imageList );
void AssignImageList(wxImageList *imageList);
void AssignStateImageList(wxImageList *imageList);
void AssignButtonsImageList(wxImageList *imageList);
- %clear wxImageList *imageList;
+ %cleardisown( wxImageList *imageList );
// adds a column
%pythonAppend wxPyArtProvider "self._setCallbackInfo(self, ArtProvider)"
wxPyArtProvider();
+ ~wxPyArtProvider();
void _setCallbackInfo(PyObject* self, PyObject* _class);
+ %disownarg( wxPyArtProvider *provider );
DocDeclStr(
static void , PushProvider(wxPyArtProvider *provider),
"Add new provider to the top of providers stack.", "");
+ %cleardisown( wxPyArtProvider *provider );
DocDeclStr(
static bool , PopProvider(),
"Remove latest added provider and delete it.", "");
-
+ %pythonAppend RemoveProvider "args[1].thisown = 1";
DocDeclStr(
static bool , RemoveProvider(wxPyArtProvider *provider),
"Remove provider. The provider must have been added previously! The
+ %pythonAppend Destroy "args[0].thisown = 0"
%extend { void Destroy() { delete self; }}
};
- %apply SWIGTYPE *DISOWN { wxDataObject *data };
+ %disownarg( wxDataObject *data );
DocDeclStr(
virtual bool , AddData( wxDataObject *data ),
:see: `wx.DataObject`", "");
-
- %clear wxDataObject *data;
+ %cleardisown( wxDataObject *data );
+
DocDeclStr(
virtual bool , IsSupported( const wxDataFormat& format ),
dialog is shown, this is the index selected by the user.", "");
- DocStr(GetFilenames,
- "Returns a list of filenames chosen in the dialog. This function
+ %extend {
+ DocStr(GetFilenames,
+ "Returns a list of filenames chosen in the dialog. This function
should only be used with the dialogs which have wx.MULTIPLE style, use
GetFilename for the others.", "");
-
- DocStr(GetPaths,
- "Fills the array paths with the full paths of the files chosen. This
-function should only be used with the dialogs which have wx.MULTIPLE
-style, use GetPath for the others.", "");
-
- %extend {
PyObject* GetFilenames() {
wxArrayString arr;
self->GetFilenames(arr);
return wxArrayString2PyList_helper(arr);
}
+ DocStr(GetPaths,
+ "Fills the array paths with the full paths of the files chosen. This
+function should only be used with the dialogs which have wx.MULTIPLE
+style, use GetPath for the others.", "");
+
PyObject* GetPaths() {
wxArrayString arr;
self->GetPaths(arr);
};
- %apply SWIGTYPE *DISOWN { wxConfigBase *config };
+ %disownarg( wxConfigBase *config );
DocDeclStr(
static wxConfigBase *, Set(wxConfigBase *config),
"Sets the global config object (the one returned by Get) and returns a
reference to the previous global config object.", "");
- %clear wxConfigBase *config;
+ %cleardisown( wxConfigBase *config );
DocDeclStr(
static wxConfigBase *, Get(bool createOnDemand = true),
PyObject* robj = NULL;
swig_type_info* swigType = wxPyFindSwigType(className);
- wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyConvertSwigPtr"));
+ wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyMakeSwigPtr"));
+#if SWIG_VERSION < 0x010328
#ifdef SWIG_COBJECT_TYPES
robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)swigType->name);
#else
PyString_FromString(result) : 0;
}
#endif
-
+#else // SWIG_VERSION >= 1.3.28
+ robj = PySwigObject_New(ptr, swigType, 0);
+#endif
return robj;
}
class wxHelpProvider
{
public:
+ %disownarg( wxHelpProvider *helpProvider );
+ %newobject Set;
DocDeclStr(
static wxHelpProvider *, Set(wxHelpProvider *helpProvider),
"Sset the current, application-wide help provider. Returns the previous
one. Unlike some other classes, the help provider is not created on
demand. This must be explicitly done by the application.", "");
+ %cleardisown( wxHelpProvider *helpProvider );
DocDeclStr(
static wxHelpProvider *, Get(),
reused, the wrong help string will be found.", "");
+ %pythonAppend Destroy "args[0].thisown = 0"
%extend { void Destroy() { delete self; } }
};
- // return all formats in the provided array (of size GetFormatCount())
- //virtual void GetAllFormats(wxDataFormat *formats,
- // Direction dir = Get) const;
- DocAStr(GetAllFormats,
- "GetAllFormats(self, int dir=Get) -> [formats]",
- "Returns a list of all the wx.DataFormats that this dataobject supports
-in the given direction.", "");
%extend {
+ DocAStr(GetAllFormats,
+ "GetAllFormats(self, int dir=Get) -> [formats]",
+ "Returns a list of all the wx.DataFormats that this dataobject supports
+in the given direction.", "");
PyObject* GetAllFormats(Direction dir = Get) {
size_t count = self->GetFormatCount(dir);
wxDataFormat* formats = new wxDataFormat[count];
// True if data copied successfully, False otherwise
// virtual bool GetDataHere(const wxDataFormat& format, void *buf) const;
- DocAStr(GetDataHere,
- "GetDataHere(self, DataFormat format) -> String",
- "Get the data bytes in the specified format, returns None on failure.
-", "
-:todo: This should use the python buffer interface isntead...");
%extend {
+ DocAStr(GetDataHere,
+ "GetDataHere(self, DataFormat format) -> String",
+ "Get the data bytes in the specified format, returns None on failure.", "
+:todo: This should use the python buffer interface isntead...");
PyObject* GetDataHere(const wxDataFormat& format) {
PyObject* rval = NULL;
size_t size = self->GetDataSize(format);
- DocAStr(GetDataHere,
- "GetDataHere(self) -> String",
- "Returns the data bytes from the data object as a string, returns None
+ %extend {
+ DocAStr(GetDataHere,
+ "GetDataHere(self) -> String",
+ "Returns the data bytes from the data object as a string, returns None
on failure. Must be implemented in the derived class if the object
supports rendering its data.", "");
- %extend {
PyObject* GetDataHere() {
PyObject* rval = NULL;
size_t size = self->GetDataSize();
}
- DocAStr(SetData,
- "SetData(self, String data) -> bool",
- "Copy the data value to the data object. Must be implemented in the
+ %extend {
+ DocAStr(SetData,
+ "SetData(self, String data) -> bool",
+ "Copy the data value to the data object. Must be implemented in the
derived class if the object supports setting its data.
", "");
- %extend {
bool SetData(PyObject* data) {
bool rval;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
public:
wxDataObjectComposite();
- %apply SWIGTYPE *DISOWN { wxDataObjectSimple *dataObject };
+ %disownarg( wxDataObjectSimple *dataObject );
DocDeclStr(
void , Add(wxDataObjectSimple *dataObject, bool preferred = false),
"Adds the dataObject to the list of supported objects and it becomes
the preferred object if preferred is True.", "");
- %clear wxDataObjectSimple *dataObject;
+ %cleardisown( wxDataObjectSimple *dataObject );
};
//---------------------------------------------------------------------------
wxCustomDataObject();
- DocAStr(SetData,
- "SetData(self, String data) -> bool",
- "Copy the data value to the data object.", "");
%extend {
+ DocAStr(SetData,
+ "SetData(self, String data) -> bool",
+ "Copy the data value to the data object.", "");
bool SetData(PyObject* data) {
bool rval;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
"Get the size of the data.", "");
- DocAStr(GetData,
- "GetData(self) -> String",
- "Returns the data bytes from the data object as a string.", "");
%extend {
+ DocAStr(GetData,
+ "GetData(self) -> String",
+ "Returns the data bytes from the data object as a string.", "");
PyObject* GetData() {
PyObject* obj;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
//---------------------------------------------------------------------------
-// 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
// 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.
#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
+#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
public:
%pythonAppend wxPyDropTarget
"self._setCallbackInfo(self, DropTarget)"
- %apply SWIGTYPE *DISOWN { wxDataObject *dataObject };
+
+ %disownarg( wxDataObject *dataObject );
wxPyDropTarget(wxDataObject *dataObject = NULL);
void _setCallbackInfo(PyObject* self, PyObject* _class);
wxDataObject *GetDataObject();
void SetDataObject(wxDataObject *dataObject);
- %clear wxDataObject *dataObject;
+ %cleardisown( wxDataObject *dataObject );
wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
}
}
+ %pythonAppend _setOORInfo "args[0].thisown = 0";
%extend {
void _setOORInfo(PyObject* _self, bool incref=true) {
if (_self && _self != Py_None) {
{
public:
wxGBPosition(int row=0, int col=0);
-
+ ~wxGBPosition();
+
int GetRow() const;
int GetCol() const;
void SetRow(int row);
colspan. The default is (1,1). (Meaning that the item occupies one
cell in each direction.", "");
+ ~wxGBSpan();
+
int GetRowspan() const;
int GetColspan() const;
void SetRowspan(int rowspan);
You will probably never need to create a wx.GBSizerItem directly as they
are created automatically when the sizer's Add method is called.", "");
+ ~wxGBSizerItem();
+
+
%extend {
DocStr(wxGBSizerItem( wxWindow *window, const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL ),
"Construct a `wx.GBSizerItem` for a window.", "");
DocStr(wxGBSizerItem( wxSizer *sizer,const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL ),
"Construct a `wx.GBSizerItem` for a sizer", "");
+ %disownarg( wxSizer *sizer );
%RenameCtor(GBSizerItemSizer, wxGBSizerItem( wxSizer *sizer,
const wxGBPosition& pos,
const wxGBSpan& span,
}
return new wxGBSizerItem(sizer, pos, span, flag, border, data);
}
+ %cleardisown( wxSizer *sizer );
DocStr(wxGBSizerItem( int width,int height,const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL),
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
+ if ( info.sizer )
+ PyObject_SetAttrString(item,"thisown",Py_False);
wxPyEndBlockThreads(blocked);
// Now call the real Add method if a valid item type was found
return NULL;
}
}
-
+
+ %disownarg( wxGBSizerItem *item );
DocDeclAStrName(
wxGBSizerItem* , Add( wxGBSizerItem *item ),
"Add(self, GBSizerItem item) -> wx.GBSizerItem",
the item was successfully placed at its given cell position, False if
something was already there.", "",
AddItem);
+ %cleardisown( wxGBSizerItem *item );
DocDeclStr(
wxSize , GetCellSize(int row, int col) const,
// GetSelection which only works for listboxes with single selection)
//virtual int GetSelections(wxArrayInt& aSelections) const;
%extend {
- PyObject* GetSelections() {
- wxArrayInt lst;
- self->GetSelections(lst);
- PyObject *tup = PyTuple_New(lst.GetCount());
- for(size_t i=0; i<lst.GetCount(); i++) {
- PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i]));
- }
- return tup;
- }
+ PyObject* GetSelections() {
+ wxArrayInt lst;
+ self->GetSelections(lst);
+ PyObject *tup = PyTuple_New(lst.GetCount());
+ for(size_t i=0; i<lst.GetCount(); i++) {
+ PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i]));
+ }
+ return tup;
+ }
}
// set the specified item at the first visible item or scroll to max
wxListItemAttr(const wxColour& colText = wxNullColour,
const wxColour& colBack = wxNullColour,
const wxFont& font = wxNullFont);
-
+ ~wxListItemAttr();
// setters
void SetTextColour(const wxColour& colText);
wxColour GetBackgroundColour();
wxFont GetFont();
+ void AssignFrom(const wxListItemAttr& source);
+
+ %pythonAppend Destroy "args[0].thisown = 0"
%extend { void Destroy() { delete self; } }
};
// Sets the image list
void SetImageList(wxImageList *imageList, int which);
- // is there a way to tell SWIG to disown this???
-
- %apply SWIGTYPE *DISOWN { wxImageList *imageList };
+ %disownarg( wxImageList *imageList );
void AssignImageList(wxImageList *imageList, int which);
- %clear wxImageList *imageList;
+ %cleardisown( wxImageList *imageList );
// are we in report mode?
bool InReportView() const;
{
public:
wxLog();
-
+ ~wxLog();
// these functions allow to completely disable all log messages
// is logging disabled now?
// create one if none exists
static wxLog *GetActiveTarget();
+ %disownarg( wxLog* pLogger );
+ %newobject SetActiveTarget;
// change log target, pLogger may be NULL
static wxLog *SetActiveTarget(wxLog *pLogger);
-
+ %cleardisown( wxLog* pLogger );
+
// suspend the message flushing of the main target until the next call
// to Resume() - this is mainly for internal use (to prevent wxYield()
// from flashing the messages)
}
}
+ %pythonAppend Destroy "args[0].thisown = 0";
%extend { void Destroy() { delete self; } }
};
unsigned long wxSysErrorCode();
const wxString wxSysErrorMsg(unsigned long nErrCode = 0);
-%{// Make somce wrappers that double any % signs so they are 'escaped'
+%{// Make some wrappers that double any % signs so they are 'escaped'
void wxPyLogFatalError(const wxString& msg)
{
wxString m(msg);
bool Delete(int id);
%Rename(DeleteItem, bool, Delete(wxMenuItem *item));
- // delete the item from menu and destroy it (if it's a submenu)
+ %pythonAppend Destroy "args[0].thisown = 0"
%extend { void Destroy() { delete self; } }
+
+ // delete the item from menu and destroy it (if it's a submenu)
%Rename(DestroyId, bool, Destroy(int id));
%Rename(DestroyItem, bool, Destroy(wxMenuItem *item));
class wxToolTip : public wxObject {
public:
+ %typemap(out) wxToolTip*; // turn off this typemap
wxToolTip(const wxString &tip);
+ // Turn it back on again
+ %typemap(out) wxToolTip* { $result = wxPyMake_wxObject($1, $owner); }
+ ~wxToolTip();
+
void SetTip(const wxString& tip);
wxString GetTip();
// *** Not in the "public" interface void SetWindow(wxWindow *win);
class wxCaret {
public:
wxCaret(wxWindow* window, const wxSize& size);
-// ~wxCaret(); Window takes ownership
+ ~wxCaret();
%extend {
+ %pythonAppend Destroy "args[0].thisown = 0"
DocStr(Destroy,
"Deletes the C++ object this Python object is a proxy for.", "");
void Destroy() {
%}
+
+#if 0
+%{
+ void t_output_tester1(int* a, int* b, int* c, int* d)
+ {
+ *a = 1234;
+ *b = 2345;
+ *c = 3456;
+ *d = 4567;
+ }
+ PyObject* t_output_tester2(int* a, int* b, int* c, int* d)
+ {
+ *a = 1234;
+ *b = 2345;
+ *c = 3456;
+ *d = 4567;
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ PyObject* t_output_tester3(int* a, int* b, int* c, int* d)
+ {
+ *a = 1234;
+ *b = 2345;
+ *c = 3456;
+ *d = 4567;
+ PyObject* res = PyTuple_New(2);
+ PyTuple_SetItem(res, 0, PyInt_FromLong(1));
+ PyTuple_SetItem(res, 1, PyInt_FromLong(2));
+ return res;
+ }
+ PyObject* t_output_tester4()
+ {
+ PyObject* res = PyTuple_New(2);
+ PyTuple_SetItem(res, 0, PyInt_FromLong(132));
+ PyTuple_SetItem(res, 1, PyInt_FromLong(244));
+ return res;
+ }
+%}
+
+%newobject t_output_tester2;
+%newobject t_output_tester3;
+%newobject t_output_tester4;
+
+void t_output_tester1(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
+PyObject* t_output_tester2(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
+PyObject* t_output_tester3(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
+PyObject* t_output_tester4();
+
+#endif
+
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
virtual void SetImageList(wxImageList *imageList);
// as SetImageList() but we will delete the image list ourselves
- %apply SWIGTYPE *DISOWN { wxImageList *imageList };
+ %disownarg( wxImageList *imageList );
void AssignImageList(wxImageList *imageList);
- %clear wxImageList *imageList;
+ %cleardisown( wxImageList *imageList );
// get pointer (may be NULL) to the associated image list
wxImageList* GetImageList() const;
return self->GetClassInfo()->GetClassName();
}
+ %pythonAppend Destroy "args[0].thisown = 0"
DocStr(Destroy,
"Deletes the C++ object this Python object is a proxy for.", "");
void Destroy() {
{
PyObject* o;
o = PyInt_FromLong((long) (*$1));
+#if SWIG_VERSION < 0x010328
$result = t_output_helper($result, o);
+#else
+ $result = SWIG_Python_AppendOutput($result, o);
+#endif
}
int wxKill(long pid, wxSignal sig = wxSIGTERM, wxKillError* rc, int flags = wxKILL_NOCHILDREN);
:see: `wx.SizerItemSpacer`, `wx.SizerItemWindow`, `wx.SizerItemSizer`", "");
+
+ ~wxSizerItem();
%extend {
int border, PyObject* userData=NULL ),
"Constructs a `wx.SizerItem` for tracking a subsizer", "");
+ %disownarg( wxSizer *sizer );
%RenameCtor(SizerItemSizer, wxSizerItem( wxSizer *sizer, int proportion, int flag,
int border, PyObject* userData=NULL ))
{
}
return new wxSizerItem(sizer, proportion, flag, border, data);
}
+ %cleardisown( wxSizer *sizer );
}
wxSizer *, GetSizer(),
"Get the subsizer (if any) that is managed by this sizer item.", "");
+ %disownarg( wxSizer *sizer );
DocDeclStr(
void , SetSizer( wxSizer *sizer ),
"Set the subsizer to be managed by this sizer item.", "");
+ %cleardisown( wxSizer *sizer );
DocDeclStr(
class wxSizer : public wxObject {
public:
// wxSizer(); **** abstract, can't instantiate
- // ~wxSizer();
+
+ ~wxSizer();
%extend {
void _setOORInfo(PyObject* _self) {
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
+ if ( info.sizer )
+ PyObject_SetAttrString(item,"thisown",Py_False);
wxPyEndBlockThreads(blocked);
// Now call the real Add method if a valid item type was found
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
+ if ( info.sizer )
+ PyObject_SetAttrString(item,"thisown",Py_False);
wxPyEndBlockThreads(blocked);
// Now call the real Insert method if a valid item type was found
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
+ if ( info.sizer )
+ PyObject_SetAttrString(item,"thisown",Py_False);
wxPyEndBlockThreads(blocked);
// Now call the real Prepend method if a valid item type was found
return self._SetItemMinSize(item, args[0])
}
+
+ %disownarg( wxSizerItem *item );
+
DocDeclAStrName(
wxSizerItem* , Add( wxSizerItem *item ),
"AddItem(self, SizerItem item)",
"Prepends a `wx.SizerItem` to the sizer.", "",
PrependItem);
+ %cleardisown( wxSizerItem *item );
%pythoncode {
// See also wxPy_ReinitStockObjects in helpers.cpp
%immutable;
+%threadWrapperOff;
wxFont* const wxNORMAL_FONT;
wxFont* const wxSMALL_FONT;
const wxFont wxNullFont;
const wxColour wxNullColour;
+%threadWrapperOn;
%mutable;
%pythonAppend wxPyTaskBarIcon "self._setCallbackInfo(self, TaskBarIcon, 0)"
wxPyTaskBarIcon();
+ ~wxPyTaskBarIcon();
void _setCallbackInfo(PyObject* self, PyObject* _class, int incref);
+ %pythonAppend Destroy "args[0].thisown = 0";
%extend {
void Destroy() {
self->RemoveIcon();
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
-
- %pythoncode {
- def SendSizeEvent(self):
- self.ProcessEvent(wx.SizeEvent((-1,-1)))
- }
};
//---------------------------------------------------------------------------
class wxPyTreeItemData {
public:
wxPyTreeItemData(PyObject* obj = NULL);
-
+ ~wxPyTreeItemData();
+
PyObject* GetData();
void SetData(PyObject* obj);
const wxTreeItemId& GetId();
void SetId(const wxTreeItemId& id);
+ %pythonAppend Destroy "args[0].thisown = 0"
%extend { void Destroy() { delete self; } }
};
wxTreeItemAttr(const wxColour& colText = wxNullColour,
const wxColour& colBack = wxNullColour,
const wxFont& font = wxNullFont);
-
+ ~wxTreeItemAttr();
+
// setters
void SetTextColour(const wxColour& colText);
void SetBackgroundColour(const wxColour& colBack);
wxColour GetBackgroundColour();
wxFont GetFont();
+ %pythonAppend Destroy "args[0].thisown = 0"
%extend { void Destroy() { delete self; } }
};
void SetImageList(wxImageList *imageList);
void SetStateImageList(wxImageList *imageList);
- %apply SWIGTYPE *DISOWN { wxImageList *imageList };
+ %disownarg( wxImageList *imageList );
void AssignImageList(wxImageList *imageList);
void AssignStateImageList(wxImageList *imageList);
- %clear wxImageList *imageList;
+ %cleardisown( wxImageList *imageList );
// retrieve items label
%extend {
// associate a wxPyTreeItemData with the tree item
+ %disownarg( wxPyTreeItemData* data );
void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) {
data->SetId(item); // set the id
self->SetItemData(item, data);
}
+ %cleardisown( wxPyTreeItemData* data );
// associate a Python object with the tree item
void SetItemPyData(const wxTreeItemId& item, PyObject* obj) {
wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
+ %disownarg( wxPyTreeItemData* data );
// add the root node to the tree
wxTreeItemId AddRoot(const wxString& text,
wxPyTreeItemData *data = NULL);
-
+ %cleardisown( wxPyTreeItemData* data );
+
// delete this item and associated data if any
void Delete(const wxTreeItemId& item);
+ %pythonAppend Destroy "args[0].thisown = 0"
DocDeclStr(
virtual bool , Destroy(),
"Destroys the window safely. Frames and dialogs are not destroyed
+ %disownarg( wxCaret *caret );
DocDeclStr(
void , SetCaret(wxCaret *caret),
"Sets the caret associated with the window.", "");
+ %cleardisown( wxCaret *caret );
DocDeclStr(
wxCaret *, GetCaret() const,
DocStr(SetToolTip,
"Attach a tooltip to the window.", "");
%Rename(SetToolTipString, void, SetToolTip( const wxString &tip ));
+
+ %disownarg( wxToolTip *tip );
void SetToolTip( wxToolTip *tip );
+ %cleardisown( wxToolTip *tip );
DocDeclStr(
wxToolTip* , GetToolTip() const,
// drag and drop
// -------------
- // set/retrieve the drop target associated with this window (may be
- // NULL; it's owned by the window and will be deleted by it)
- %apply SWIGTYPE *DISOWN { wxPyDropTarget *dropTarget };
-
+ %disownarg( wxPyDropTarget *dropTarget );
DocDeclStr(
virtual void , SetDropTarget( wxPyDropTarget *dropTarget ),
"Associates a drop target with this window. If the window already has
a drop target, it is deleted.", "");
-
- %clear wxPyDropTarget *dropTarget;
+ %cleardisown( wxPyDropTarget *dropTarget );
DocDeclStr(
handler when the window is resized.", "");
+ %disownarg( wxSizer *sizer );
DocDeclStr(
void , SetSizer(wxSizer *sizer, bool deleteOld = true ),
"Sets the window to have the given layout sizer. The window will then
void , SetSizerAndFit( wxSizer *sizer, bool deleteOld = true ),
"The same as SetSizer, except it also sets the size hints for the
window based on the sizer's minimum size.", "");
-
+ %cleardisown( wxSizer *sizer );
+
DocDeclStr(
wxSizer *, GetSizer() const,
if hasattr(self, '_setCallbackInfo'):
self._setCallbackInfo(self, self.__class__)
}
+
+ %pythoncode {
+ def SendSizeEvent(self):
+ self.GetEventhandler().ProcessEvent(wx.SizeEvent((-1,-1)))
+ }
};
//---------------------------------------------------------------------------
// OOR related typemaps and helper functions
-%typemap(out) wxGridCellRenderer* { $result = wxPyMake_wxGridCellRenderer($1, $owner); }
-%typemap(out) wxGridCellEditor* { $result = wxPyMake_wxGridCellEditor($1, $owner); }
-%typemap(out) wxGridCellAttr* { $result = wxPyMake_wxGridCellAttr($1, $owner); }
-%typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1, $owner); }
-%typemap(out) wxGridTableBase* { $result = wxPyMake_wxGridTableBase($1, $owner); }
+%typemap(out) wxGridCellRenderer* { $result = wxPyMake_wxGridCellRenderer($1, (bool)$owner); }
+%typemap(out) wxGridCellEditor* { $result = wxPyMake_wxGridCellEditor($1, (bool)$owner); }
+%typemap(out) wxGridCellAttr* { $result = wxPyMake_wxGridCellAttr($1, (bool)$owner); }
+%typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1, (bool)$owner); }
+%typemap(out) wxGridTableBase* { $result = wxPyMake_wxGridTableBase($1, (bool)$owner); }
%{
virtual void StartingKey(wxKeyEvent& event);
virtual void StartingClick();
virtual void HandleReturn(wxKeyEvent& event);
+
+ %pythonAppend Destroy "args[0].thisown = 0"
virtual void Destroy();
};
wxPyGridTableBase();
void _setCallbackInfo(PyObject* self, PyObject* _class);
+ %pythonAppend Destroy "args[0].thisown = 0"
%extend { void Destroy() { delete self; } }
wxString base_GetTypeName( int row, int col );
wxHtmlHelpData* GetData();
wxHtmlHelpController* GetController() const;
+
+ %disownarg( wxHtmlHelpController* controller );
void SetController(wxHtmlHelpController* controller);
+ %cleardisown( wxHtmlHelpController* controller );
// Displays page x. If not found it will offect the user a choice of
// searching books.
wxHtmlHelpController* GetController() const;
/// Sets the help controller associated with the window.
+ %disownarg( wxHtmlHelpController* controller );
void SetController(wxHtmlHelpController* controller);
+ %cleardisown( wxHtmlHelpController* controller );
/// Returns the help window.
wxHtmlHelpWindow* GetHelpWindow() const;
wxHtmlHelpController* GetController() const;
/// Sets the controller associated with this dialog.
+ %disownarg( wxHtmlHelpController* controller );
void SetController(wxHtmlHelpController* controller);
+ %cleardisown( wxHtmlHelpController* controller );
/// Returns the help window.
wxHtmlHelpWindow* GetHelpWindow() const;
void MakeModalIfNeeded();
wxWindow* FindTopLevelWindow();
-
- %pythoncode { def Destroy(self): pass }
};
// NOTE: For those classes that also call _setOORInfo these typemaps should be
// disabled for the constructor.
-%typemap(out) wxEvtHandler* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMenu* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxValidator* { $result = wxPyMake_wxObject($1, $owner); }
-
-%typemap(out) wxApp* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyApp* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxDC* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxFSFile* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxFileSystem* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxImageList* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxImage* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxListItem* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMenuItem* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMouseEvent* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxObject* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyPrintout* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxToolBarToolBase* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxToolTip* { $result = wxPyMake_wxObject($1, $owner); }
-
-
-%typemap(out) wxBitmapButton* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxButton* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxControl* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxGrid* { $result = wxPyMake_wxObject($1, $owner); }
-//%typemap(out) wxListCtrl* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMDIChildFrame* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMDIClientWindow* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMenuBar* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxNotebook* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxStaticBox* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxStatusBar* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxTextCtrl* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxToolBar* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxToolBarBase* { $result = wxPyMake_wxObject($1, $owner); }
-//%typemap(out) wxTreeCtrl* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyTreeCtrl* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxWindow* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxWizardPage* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyWizardPage* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPanel* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxScrolledWindow* { $result = wxPyMake_wxObject($1, $owner); }
-
-%typemap(out) wxSizer* { $result = wxPyMake_wxObject($1, $owner); }
+%typemap(out) wxEvtHandler* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMenu* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxValidator* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+
+%typemap(out) wxApp* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyApp* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxDC* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxFSFile* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxFileSystem* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxImageList* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxImage* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxListItem* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMenuItem* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMouseEvent* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxObject* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyPrintout* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxToolBarToolBase* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxToolTip* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+
+
+%typemap(out) wxBitmapButton* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxButton* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxControl* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxGrid* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+//%typemap(out) wxListCtrl* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMDIChildFrame* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMDIClientWindow* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMenuBar* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxNotebook* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxStaticBox* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxStatusBar* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxTextCtrl* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxToolBar* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxToolBarBase* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+//%typemap(out) wxTreeCtrl* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyTreeCtrl* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxWindow* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxWizardPage* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyWizardPage* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPanel* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxScrolledWindow* { $result = wxPyMake_wxObject($1, (bool)$owner); }
+
+%typemap(out) wxSizer* { $result = wxPyMake_wxObject($1, (bool)$owner); }
//---------------------------------------------------------------------------
-// There standard t_output_helper has been changed to return a list rather
-// than a tuple, we'll replace it with the old implementation here.
-
-
-%fragment("t_output_helper","header") %{
- static PyObject* t_output_helper(PyObject* target, PyObject* o) {
- PyObject* o2;
- PyObject* o3;
-
- if (!target) {
- target = o;
- } else if (target == Py_None) {
- Py_DECREF(Py_None);
- target = o;
- } else {
- if (!PyTuple_Check(target)) {
- o2 = target;
- target = PyTuple_New(1);
- PyTuple_SetItem(target, 0, o2);
- }
- o3 = PyTuple_New(1);
- PyTuple_SetItem(o3, 0, o);
-
- o2 = target;
- target = PySequence_Concat(o2, o3);
- Py_DECREF(o2);
- Py_DECREF(o3);
+//----------------------------------------------------------------------
+
+// The standard t_output_helper has been changed to return a list rather than
+// a tuple, we'll replace it with the old implementation here. In SWIG 1.3.27
+// and earlier it is implemented as a $fragment, so it is only inserted in to
+// the modules that need it. For SWIG 1.3.28 we just need to add a -D on the
+// compile command line to turn on this version of the AppendOuput function.
+#if SWIG_VERSION < 0x010328
+%fragment("t_output_helper","header")
+%{
+ static PyObject* t_output_helper(PyObject* result, PyObject* obj)
+ {
+ PyObject* o2;
+ PyObject* o3;
+ if (!result) {
+ result = obj;
+ } else if (result == Py_None) {
+ Py_DECREF(result);
+ result = obj;
+ } else {
+ if (!PyTuple_Check(result)) {
+ o2 = result;
+ result = PyTuple_New(1);
+ PyTuple_SET_ITEM(result, 0, o2);
+ }
+ o3 = PyTuple_New(1);
+ PyTuple_SetItem(o3, 0, obj);
+ o2 = result;
+ result = PySequence_Concat(o2, o3);
+ Py_DECREF(o2);
+ Py_DECREF(o3);
+ }
+ return result;
}
- return target;
- }
%}
+#endif
+
+
+//----------------------------------------------------------------------
// These fragments are inserted in modules that need to convert PyObjects to
// integer values, my versions allow any numeric type to be used, as long as
// it can be converted to a PyInt. (Specifically, I allow floats where the
// default SWIG_AsVal_long would just raise an exception.
//
+#if SWIG_VERSION < 0x010328
%fragment(SWIG_AsVal_frag(long), "header") {
SWIGINTERN int
return 1;
}
else {
- SWIG_type_error("number", obj);
+ SWIG_Python_TypeError("number", obj);
}
return 0;
}
{
long v = 0;
if (SWIG_AsVal_long(obj, &v) && v < 0) {
- SWIG_type_error("unsigned number", obj);
+ SWIG_Python_TypeError("unsigned number", obj);
}
else if (val)
*val = (unsigned long)v;
return 1;
}
else {
- SWIG_type_error("number", obj);
+ SWIG_Python_TypeError("number", obj);
}
return 0;
}
}
+
+
+#else // SWIG_VERSION >= 1.3.28
+
+%fragment(SWIG_AsVal_frag(long), "header") {
+SWIGINTERN int
+SWIG_AsVal(long)(PyObject* obj, long* val)
+{
+ if (PyNumber_Check(obj)) {
+ if (val) *val = PyInt_AsLong(obj);
+ return SWIG_OK;
+ }
+ return SWIG_TypeError;
+}
+}
+
+
+%fragment(SWIG_AsVal_frag(unsigned long), "header",
+ fragment=SWIG_AsVal_frag(long)) {
+SWIGINTERN int
+SWIG_AsVal(unsigned long)(PyObject* obj, unsigned long* val)
+{
+ long v = 0;
+ if (SWIG_AsVal_long(obj, &v) && v < 0) {
+ return SWIG_TypeError;
+ }
+ else if (val)
+ *val = (unsigned long)v;
+ return SWIG_OK;
+}
+}
+
+
+%fragment(SWIG_AsVal_frag(double), "header") {
+SWIGINTERN int
+SWIG_AsVal(double)(PyObject *obj, double* val)
+{
+ if (PyNumber_Check(obj)) {
+ if (val) *val = PyFloat_AsDouble(obj);
+ return SWIG_OK;
+ }
+ return SWIG_TypeError;
+}
+}
+
+
+#endif // SWIG_VERSION