Editors, Renderers and Attrs need to have a destructor so SWIG won't
complain about it, but since they are protected in C++ we need to give them a dummy one. In the future these shoud be changed to use %ref/%unref and let SWIG manage the refcount for us. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ce1522a1f2
commit
607a3fa066
@ -104,6 +104,8 @@ typedef unsigned long wxUIntPtr;
|
||||
#define %disownarg(typespec) %typemap(in) typespec = SWIGTYPE* DISOWN
|
||||
#define %cleardisown(typespec) %typemap(in) typespec
|
||||
|
||||
#define %ref %feature("ref")
|
||||
#define %unref %feature("unref")
|
||||
|
||||
|
||||
#ifndef %pythoncode
|
||||
|
@ -24,6 +24,7 @@
|
||||
%rename(GRID_MIN_ROW_HEIGHT) wxGRID_MIN_ROW_HEIGHT;
|
||||
%rename(GRID_MIN_COL_WIDTH) wxGRID_MIN_COL_WIDTH;
|
||||
%rename(GRID_DEFAULT_SCROLLBAR_WIDTH) wxGRID_DEFAULT_SCROLLBAR_WIDTH;
|
||||
%rename(GridCellWorker) wxGridCellWorker;
|
||||
%rename(GridCellRenderer) wxGridCellRenderer;
|
||||
%rename(PyGridCellRenderer) wxPyGridCellRenderer;
|
||||
%rename(GridCellStringRenderer) wxGridCellStringRenderer;
|
||||
|
@ -491,11 +491,14 @@ enum {
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// wxGridCellRenderer is an ABC, and several derived classes are available.
|
||||
// Classes implemented in Python should be derived from wxPyGridCellRenderer.
|
||||
|
||||
// TODO: Use these to have SWIG automatically handle the IncRef/DecRef calls:
|
||||
//
|
||||
// %ref wxGridCellWorker "$this->IncRef();";
|
||||
// %unref wxGridCellWorker "$this->DecRef();";
|
||||
//
|
||||
|
||||
class wxGridCellRenderer
|
||||
class wxGridCellWorker
|
||||
{
|
||||
public:
|
||||
%extend {
|
||||
@ -503,12 +506,25 @@ public:
|
||||
if (!self->GetClientObject())
|
||||
self->SetClientObject(new wxPyOORClientData(_self));
|
||||
}
|
||||
|
||||
// A dummy dtor to shut up SWIG. (The real one is protected and can
|
||||
// only be called by DecRef)
|
||||
~wxGridCellWorker() {
|
||||
}
|
||||
}
|
||||
|
||||
void SetParameters(const wxString& params);
|
||||
void IncRef();
|
||||
void DecRef();
|
||||
};
|
||||
|
||||
|
||||
|
||||
// wxGridCellRenderer is an ABC, and several derived classes are available.
|
||||
// Classes implemented in Python should be derived from wxPyGridCellRenderer.
|
||||
|
||||
class wxGridCellRenderer : public wxGridCellWorker
|
||||
{
|
||||
virtual void Draw(wxGrid& grid,
|
||||
wxGridCellAttr& attr,
|
||||
wxDC& dc,
|
||||
@ -523,6 +539,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
// The C++ version of wxPyGridCellRenderer
|
||||
%{
|
||||
class wxPyGridCellRenderer : public wxGridCellRenderer
|
||||
@ -703,16 +720,9 @@ public:
|
||||
// wxGridCellEditor is an ABC, and several derived classes are available.
|
||||
// Classes implemented in Python should be derived from wxPyGridCellEditor.
|
||||
|
||||
class wxGridCellEditor
|
||||
class wxGridCellEditor : public wxGridCellWorker
|
||||
{
|
||||
public:
|
||||
%extend {
|
||||
void _setOORInfo(PyObject* _self) {
|
||||
if (!self->GetClientObject())
|
||||
self->SetClientObject(new wxPyOORClientData(_self));
|
||||
}
|
||||
}
|
||||
|
||||
bool IsCreated();
|
||||
wxControl* GetControl();
|
||||
void SetControl(wxControl* control);
|
||||
@ -720,10 +730,6 @@ public:
|
||||
wxGridCellAttr* GetCellAttr();
|
||||
void SetCellAttr(wxGridCellAttr* attr);
|
||||
|
||||
void SetParameters(const wxString& params);
|
||||
void IncRef();
|
||||
void DecRef();
|
||||
|
||||
virtual void Create(wxWindow* parent,
|
||||
wxWindowID id,
|
||||
wxEvtHandler* evtHandler);
|
||||
@ -992,10 +998,19 @@ public:
|
||||
|
||||
wxGridCellAttr(wxGridCellAttr *attrDefault = NULL);
|
||||
|
||||
%extend {
|
||||
// A dummy dtor to shut up SWIG. (The real one is protected and can
|
||||
// only be called by DecRef)
|
||||
~wxGridCellAttr() {
|
||||
}
|
||||
}
|
||||
|
||||
wxGridCellAttr *Clone() const;
|
||||
void MergeWith(wxGridCellAttr *mergefrom);
|
||||
|
||||
void IncRef();
|
||||
void DecRef();
|
||||
|
||||
void SetTextColour(const wxColour& colText);
|
||||
void SetBackgroundColour(const wxColour& colBack);
|
||||
void SetFont(const wxFont& font);
|
||||
|
@ -40,6 +40,8 @@ wxGRID_LABEL_EDGE_ZONE = wx.grid.GRID_LABEL_EDGE_ZONE
|
||||
wxGRID_MIN_ROW_HEIGHT = wx.grid.GRID_MIN_ROW_HEIGHT
|
||||
wxGRID_MIN_COL_WIDTH = wx.grid.GRID_MIN_COL_WIDTH
|
||||
wxGRID_DEFAULT_SCROLLBAR_WIDTH = wx.grid.GRID_DEFAULT_SCROLLBAR_WIDTH
|
||||
wxGridCellWorker = wx.grid.GridCellWorker
|
||||
wxGridCellWorkerPtr = wx.grid.GridCellWorkerPtr
|
||||
wxGridCellRenderer = wx.grid.GridCellRenderer
|
||||
wxGridCellRendererPtr = wx.grid.GridCellRendererPtr
|
||||
wxPyGridCellRenderer = wx.grid.PyGridCellRenderer
|
||||
|
Loading…
Reference in New Issue
Block a user