Implemented the first phase of OOR (Original Object Return). See the

text in the demo for more details of what this means, but in a
nutshell methods such as wxWindow.GetParent or FindWindowById will now
return a shadow object of the proper type if it can.  By "proper type"
I mean that if the wxWindow pointer returned from FindWindowById
really points to a wxButton then the Python object constructed will be
of a wxButtonPtr class instead of wxWindowPtr as before.  This should
reduce or eliminiate the need for wxPyTypeCast.  (Woo Hoo!)  The
objects returned are still not the original Python object, but that is
the next step.  (Although it will probably only work on Python 2.1 and
beyond because it will use weak references.)

A few other minor tweaks and fixes and additions for things found
while doing the OOR stuff.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10197 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-05-17 22:47:09 +00:00
parent 6618870d16
commit 9416aa89ca
106 changed files with 6303 additions and 3423 deletions

View File

@@ -43,27 +43,27 @@
%{
#define PYCALLBACK_GCA_INTINT(PCLASS, CBNAME) \
wxGridCellAttr* CBNAME(int a, int b) { \
wxGridCellAttr* rval = NULL; \
bool doSave = wxPyRestoreThread(); \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
PyObject* ro; \
wxGridCellAttr* ptr; \
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", a, b)); \
if (ro) { \
#define PYCALLBACK_GCA_INTINTKIND(PCLASS, CBNAME) \
wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
wxGridCellAttr* rval = NULL; \
bool doSave = wxPyRestoreThread(); \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
PyObject* ro; \
wxGridCellAttr* ptr; \
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iii)", a, b, c)); \
if (ro) { \
if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellAttr_p")) \
rval = ptr; \
Py_DECREF(ro); \
} \
} \
else \
rval = PCLASS::CBNAME(a, b); \
wxPySaveThread(doSave); \
return rval; \
} \
wxGridCellAttr *base_##CBNAME(int a, int b) { \
return PCLASS::CBNAME(a, b); \
rval = ptr; \
Py_DECREF(ro); \
} \
} \
else \
rval = PCLASS::CBNAME(a, b, c); \
wxPySaveThread(doSave); \
return rval; \
} \
wxGridCellAttr *base_##CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
return PCLASS::CBNAME(a, b, c); \
}
@@ -809,9 +809,20 @@ public:
class wxGridCellAttr
{
public:
enum wxAttrKind
{
Any,
Default,
Cell,
Row,
Col,
Merged
};
wxGridCellAttr();
wxGridCellAttr *Clone() const;
void MergeWith(wxGridCellAttr *mergefrom);
void IncRef();
void DecRef();
void SetTextColour(const wxColour& colText);
@@ -822,6 +833,7 @@ public:
void SetRenderer(wxGridCellRenderer *renderer);
void SetEditor(wxGridCellEditor* editor);
void SetKind(wxAttrKind kind);
bool HasTextColour() const;
bool HasBackgroundColour() const;
@@ -829,6 +841,7 @@ public:
bool HasAlignment() const;
bool HasRenderer() const;
bool HasEditor() const;
bool HasReadWriteMode() const;
const wxColour& GetTextColour() const;
const wxColour& GetBackgroundColour() const;
@@ -849,7 +862,8 @@ public:
wxGridCellAttrProvider();
// ???? virtual ~wxGridCellAttrProvider();
wxGridCellAttr *GetAttr(int row, int col) const;
wxGridCellAttr *GetAttr(int row, int col,
wxGridCellAttr::wxAttrKind kind) const;
void SetAttr(wxGridCellAttr *attr, int row, int col);
void SetRowAttr(wxGridCellAttr *attr, int row);
void SetColAttr(wxGridCellAttr *attr, int col);
@@ -867,7 +881,7 @@ class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
public:
wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {};
PYCALLBACK_GCA_INTINT(wxGridCellAttrProvider, GetAttr);
PYCALLBACK_GCA_INTINTKIND(wxGridCellAttrProvider, GetAttr);
PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr);
PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr);
PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr);
@@ -885,7 +899,8 @@ public:
void _setSelf(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellAttrProvider)"
wxGridCellAttr *base_GetAttr(int row, int col);
wxGridCellAttr *base_GetAttr(int row, int col,
wxGridCellAttr::wxAttrKind kind);
void base_SetAttr(wxGridCellAttr *attr, int row, int col);
void base_SetRowAttr(wxGridCellAttr *attr, int row);
void base_SetColAttr(wxGridCellAttr *attr, int col);
@@ -897,7 +912,7 @@ public:
class wxGridTableBase
class wxGridTableBase : public wxObject
{
public:
// wxGridTableBase(); This is an ABC
@@ -946,7 +961,8 @@ public:
virtual bool CanHaveAttributes();
virtual wxGridCellAttr *GetAttr( int row, int col );
virtual wxGridCellAttr *GetAttr( int row, int col,
wxGridCellAttr::wxAttrKind kind);
virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
virtual void SetRowAttr(wxGridCellAttr *attr, int row);
virtual void SetColAttr(wxGridCellAttr *attr, int col);
@@ -980,7 +996,7 @@ public:
PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue);
PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue);
PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes);
PYCALLBACK_GCA_INTINT(wxGridTableBase, GetAttr);
PYCALLBACK_GCA_INTINTKIND(wxGridTableBase, GetAttr);
PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr);
PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr);
PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
@@ -1108,7 +1124,8 @@ public:
void base_SetRowLabelValue( int row, const wxString& value );
void base_SetColLabelValue( int col, const wxString& value );
bool base_CanHaveAttributes();
wxGridCellAttr *base_GetAttr( int row, int col );
wxGridCellAttr *base_GetAttr( int row, int col,
wxGridCellAttr::wxAttrKind kind );
void base_SetAttr(wxGridCellAttr* attr, int row, int col);
void base_SetRowAttr(wxGridCellAttr *attr, int row);
void base_SetColAttr(wxGridCellAttr *attr, int col);
@@ -1431,6 +1448,8 @@ public:
wxString GetColLabelValue( int col );
wxColour GetGridLineColour();
wxColour GetCellHighlightColour();
int GetCellHighlightPenWidth();
int GetCellHighlightROPenWidth();
void SetRowLabelSize( int width );
void SetColLabelSize( int height );
@@ -1443,6 +1462,8 @@ public:
void SetColLabelValue( int col, const wxString& );
void SetGridLineColour( const wxColour& );
void SetCellHighlightColour( const wxColour& );
void SetCellHighlightPenWidth(int width);
void SetCellHighlightROPenWidth(int width);
void EnableDragRowSize( bool enable = TRUE );
void DisableDragRowSize();
@@ -1595,6 +1616,15 @@ public:
// grid may occupy more space than needed for its rows/columns, this
// function allows to set how big this extra space is
void SetMargins(int extraWidth, int extraHeight);
// Accessors for component windows
wxWindow* GetGridWindow();
wxWindow* GetGridRowLabelWindow();
wxWindow* GetGridColLabelWindow();
wxWindow* GetGridCornerLabelWindow();
};