From 363868e5ebe36d928c27ad5aae304d3af7159463 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 12 Apr 2007 00:41:45 +0000 Subject: [PATCH 1/1] Add wx.Position git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/include/wx/wxPython/wxPython.h | 1 + wxPython/include/wx/wxPython/wxPython_int.h | 7 ++- wxPython/src/_core_api.i | 3 +- wxPython/src/_gdicmn.i | 53 +++++++++++++++++++++ 4 files changed, 61 insertions(+), 3 deletions(-) diff --git a/wxPython/include/wx/wxPython/wxPython.h b/wxPython/include/wx/wxPython/wxPython.h index be46badb21..e6868887b8 100644 --- a/wxPython/include/wx/wxPython/wxPython.h +++ b/wxPython/include/wx/wxPython/wxPython.h @@ -122,6 +122,7 @@ inline wxPyCoreAPI* wxPyGetCoreAPIPtr() #define wxArrayDouble2PyList_helper(a) (wxPyGetCoreAPIPtr()->p_wxArrayDoublePyList_helper(a)) #define wxPoint2D_LIST_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxPoint2D_LIST_helper(a, b)) #define wxRect2D_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxRect2D_helper(a,b)) +#define wxPosition_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxPosition_helper(a,b)) //---------------------------------------------------------------------- diff --git a/wxPython/include/wx/wxPython/wxPython_int.h b/wxPython/include/wx/wxPython/wxPython_int.h index 9d36adf324..6cc85dd8ce 100644 --- a/wxPython/include/wx/wxPython/wxPython_int.h +++ b/wxPython/include/wx/wxPython/wxPython_int.h @@ -253,6 +253,7 @@ bool wxRect_helper(PyObject* source, wxRect** obj); bool wxColour_helper(PyObject* source, wxColour** obj); bool wxPoint2D_helper(PyObject* source, wxPoint2D** obj); bool wxRect2D_helper(PyObject* source, wxRect2D** obj); +bool wxPosition_helper(PyObject* source, wxPosition** obj); bool wxPySimple_typecheck(PyObject* source, const wxChar* classname, int seqLen); @@ -434,6 +435,7 @@ struct wxPyCoreAPI { PyObject* (*p_wxArrayDoublePyList_helper)(const wxArrayDouble& arr); wxPoint2D* (*p_wxPoint2D_LIST_helper)(PyObject* source, size_t* npoints); bool (*p_wxRect2D_helper)(PyObject* source, wxRect2D** obj); + bool (*p_wxPosition_helper)(PyObject* source, wxPosition** obj); }; @@ -641,8 +643,9 @@ public: // virtual int FilterEvent(wxEvent& event); // This one too???? // For catching Apple Events - virtual void MacOpenFile(const wxString &fileName); - virtual void MacPrintFile(const wxString &fileName); + virtual void MacOpenFile(const wxString& fileName); + virtual void MacOpenURL(const wxString& url); + virtual void MacPrintFile(const wxString& fileName); virtual void MacNewFile(); virtual void MacReopenApp(); diff --git a/wxPython/src/_core_api.i b/wxPython/src/_core_api.i index 9fcad55a74..b85f62cae2 100644 --- a/wxPython/src/_core_api.i +++ b/wxPython/src/_core_api.i @@ -240,7 +240,8 @@ static wxPyCoreAPI API = { wxArrayDouble2PyList_helper, wxPoint2D_LIST_helper, wxRect2D_helper, - + wxPosition_helper, + }; #endif diff --git a/wxPython/src/_gdicmn.i b/wxPython/src/_gdicmn.i index 87b2b5c900..ac15dc4d98 100644 --- a/wxPython/src/_gdicmn.i +++ b/wxPython/src/_gdicmn.i @@ -1106,6 +1106,59 @@ public: }; +//--------------------------------------------------------------------------- + +class wxPosition +{ +public: + wxPosition(int row=0, int col=0); + ~wxPosition(); + + int GetRow() const; + int GetColumn() const; + int GetCol() const; + void SetRow(int row); + void SetColumn(int column); + void SetCol(int column); + + %extend { + DocStr(__eq__, "Test for equality of wx.Position objects.", ""); + bool __eq__(PyObject* other) { + wxPosition temp, *obj = &temp; + if ( other == Py_None ) return false; + if ( ! wxPosition_helper(other, &obj) ) { + PyErr_Clear(); + return false; + } + return self->operator==(*obj); + } + + + DocStr(__ne__, "Test for inequality of wx.Position objects.", ""); + bool __ne__(PyObject* other) { + wxPosition temp, *obj = &temp; + if ( other == Py_None ) return true; + if ( ! wxPosition_helper(other, &obj)) { + PyErr_Clear(); + return true; + } + return self->operator!=(*obj); + } + } + + %nokwargs operator+; + %nokwargs operator-; + wxPosition operator+(const wxPosition& p) const; + wxPosition operator-(const wxPosition& p) const; + wxPosition operator+(const wxSize& s) const; + wxPosition operator-(const wxSize& s) const; + + %property(row, GetRow, SetRow); + %property(col, GetCol, SetCol); +}; + + + //--------------------------------------------------------------------------- %immutable; -- 2.45.2