Add wx.Position

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2007-04-12 00:41:45 +00:00
parent 26ee65c723
commit 363868e5eb
4 changed files with 61 additions and 3 deletions

View File

@@ -122,6 +122,7 @@ inline wxPyCoreAPI* wxPyGetCoreAPIPtr()
#define wxArrayDouble2PyList_helper(a) (wxPyGetCoreAPIPtr()->p_wxArrayDoublePyList_helper(a)) #define wxArrayDouble2PyList_helper(a) (wxPyGetCoreAPIPtr()->p_wxArrayDoublePyList_helper(a))
#define wxPoint2D_LIST_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxPoint2D_LIST_helper(a, b)) #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 wxRect2D_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxRect2D_helper(a,b))
#define wxPosition_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxPosition_helper(a,b))
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@@ -253,6 +253,7 @@ bool wxRect_helper(PyObject* source, wxRect** obj);
bool wxColour_helper(PyObject* source, wxColour** obj); bool wxColour_helper(PyObject* source, wxColour** obj);
bool wxPoint2D_helper(PyObject* source, wxPoint2D** obj); bool wxPoint2D_helper(PyObject* source, wxPoint2D** obj);
bool wxRect2D_helper(PyObject* source, wxRect2D** 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); bool wxPySimple_typecheck(PyObject* source, const wxChar* classname, int seqLen);
@@ -434,6 +435,7 @@ struct wxPyCoreAPI {
PyObject* (*p_wxArrayDoublePyList_helper)(const wxArrayDouble& arr); PyObject* (*p_wxArrayDoublePyList_helper)(const wxArrayDouble& arr);
wxPoint2D* (*p_wxPoint2D_LIST_helper)(PyObject* source, size_t* npoints); wxPoint2D* (*p_wxPoint2D_LIST_helper)(PyObject* source, size_t* npoints);
bool (*p_wxRect2D_helper)(PyObject* source, wxRect2D** obj); 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???? // virtual int FilterEvent(wxEvent& event); // This one too????
// For catching Apple Events // For catching Apple Events
virtual void MacOpenFile(const wxString &fileName); virtual void MacOpenFile(const wxString& fileName);
virtual void MacPrintFile(const wxString &fileName); virtual void MacOpenURL(const wxString& url);
virtual void MacPrintFile(const wxString& fileName);
virtual void MacNewFile(); virtual void MacNewFile();
virtual void MacReopenApp(); virtual void MacReopenApp();

View File

@@ -240,7 +240,8 @@ static wxPyCoreAPI API = {
wxArrayDouble2PyList_helper, wxArrayDouble2PyList_helper,
wxPoint2D_LIST_helper, wxPoint2D_LIST_helper,
wxRect2D_helper, wxRect2D_helper,
wxPosition_helper,
}; };
#endif #endif

View File

@@ -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; %immutable;