+DocStr(wxRect2D,
+ "wx.Rect2D is a rectangle, with position and size, in a 2D coordinate system
+with floating point component values.", "");
+
+class wxRect2D
+{
+public:
+ wxRect2D(wxDouble x=0.0, wxDouble y=0.0, wxDouble w=0.0, wxDouble h=0.0);
+
+ ~wxRect2D();
+
+ wxPoint2D GetPosition();
+ wxSize GetSize();
+
+ // for the edge and corner accessors there are two setters conterparts,
+ // the Set.. functions keep the other corners at their position whenever
+ // sensible, the Move.. functions keep the size of the rect and move the
+ // other corners apropriately
+
+ wxDouble GetLeft() const;
+ void SetLeft( wxDouble n );
+ void MoveLeftTo( wxDouble n );
+ wxDouble GetTop() const;
+ void SetTop( wxDouble n );
+ void MoveTopTo( wxDouble n );
+ wxDouble GetBottom() const;
+ void SetBottom( wxDouble n );
+ void MoveBottomTo( wxDouble n );
+ wxDouble GetRight() const;
+ void SetRight( wxDouble n );
+ void MoveRightTo( wxDouble n );
+
+ wxPoint2D GetLeftTop() const;
+ void SetLeftTop( const wxPoint2D &pt );
+ void MoveLeftTopTo( const wxPoint2D &pt );
+ wxPoint2D GetLeftBottom() const;
+ void SetLeftBottom( const wxPoint2D &pt );
+ void MoveLeftBottomTo( const wxPoint2D &pt );
+ wxPoint2D GetRightTop() const;
+ void SetRightTop( const wxPoint2D &pt );
+ void MoveRightTopTo( const wxPoint2D &pt );
+ wxPoint2D GetRightBottom() const;
+ void SetRightBottom( const wxPoint2D &pt );
+ void MoveRightBottomTo( const wxPoint2D &pt );
+ wxPoint2D GetCentre() const;
+ void SetCentre( const wxPoint2D &pt );
+ void MoveCentreTo( const wxPoint2D &pt );
+ wxOutCode GetOutcode(const wxPoint2D &pt) const;
+ bool Contains( const wxPoint2D &pt ) const;
+ %Rename(ContainsRect, bool , Contains( const wxRect2D &rect ) const);
+ bool IsEmpty() const;
+ bool HaveEqualSize( const wxRect2D &rect ) const;
+
+ %nokwargs Inset;
+ void Inset( wxDouble x , wxDouble y );
+ void Inset( wxDouble left , wxDouble top ,wxDouble right , wxDouble bottom );
+ void Offset( const wxPoint2D &pt );
+
+ void ConstrainTo( const wxRect2D &rect );
+
+ wxPoint2D Interpolate( wxInt32 widthfactor , wxInt32 heightfactor );
+
+ //static void Intersect( const wxRect2D &src1 , const wxRect2D &src2 , wxRect2D *dest );
+
+ void Intersect( const wxRect2D &otherRect );
+ wxRect2D CreateIntersection( const wxRect2D &otherRect ) const;
+ bool Intersects( const wxRect2D &rect ) const;
+
+ // static void Union( const wxRect2D &src1 , const wxRect2D &src2 , wxRect2D *dest );
+
+ void Union( const wxRect2D &otherRect );
+ //void Union( const wxPoint2D &pt );
+
+ wxRect2D CreateUnion( const wxRect2D &otherRect ) const;
+
+ %nokwargs Scale;
+ void Scale( wxDouble f );
+ void Scale( int num , int denum );
+
+ //wxRect2D& operator = (const wxRect2D& rect);
+ //bool operator == (const wxRect2D& rect) const;
+ //bool operator != (const wxRect2D& rect) const;
+
+ %extend {
+ //KeepGIL(__eq__);
+ DocStr(__eq__, "Test for equality of wx.Rect2D objects.", "");
+ bool __eq__(PyObject* other) {
+ wxRect2D temp, *obj = &temp;
+ if ( other == Py_None ) return false;
+ if ( ! wxRect2D_helper(other, &obj) ) {
+ PyErr_Clear();
+ return false;
+ }
+ return self->operator==(*obj);
+ }
+
+
+ //KeepGIL(__ne__);
+ DocStr(__ne__, "Test for inequality of wx.Rect2D objects.", "");
+ bool __ne__(PyObject* other) {
+ wxRect2D temp, *obj = &temp;
+ if ( other == Py_None ) return true;
+ if ( ! wxRect2D_helper(other, &obj)) {
+ PyErr_Clear();
+ return true;
+ }
+ return self->operator!=(*obj);
+ }
+ }
+
+
+ %Rename(x, wxDouble , m_x);
+ %Rename(y, wxDouble , m_y);
+ %Rename(width, wxDouble , m_width);
+ %Rename(height, wxDouble , m_height);
+
+ %extend {
+ void Set( wxDouble x=0 , wxDouble y=0, wxDouble width=0, wxDouble height=0 ) {
+ self->m_x = x;
+ self->m_y = y;
+ self->m_width = width;
+ self->m_height = height;
+ }
+
+ DocAStr(Get,
+ "Get() -> (x,y, width, height)",
+ "Return x, y, width and height y properties as a tuple.", "");
+ PyObject* Get() {
+ //wxPyBlock_t blocked = wxPyBeginBlockThreads();
+ PyObject* tup = PyTuple_New(4);
+ PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->m_x));
+ PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->m_y));
+ PyTuple_SET_ITEM(tup, 2, PyFloat_FromDouble(self->m_width));
+ PyTuple_SET_ITEM(tup, 3, PyFloat_FromDouble(self->m_height));
+ //wxPyEndBlockThreads(blocked);
+ return tup;
+ }
+ }
+
+ %pythoncode {
+ def __str__(self): return str(self.Get())
+ def __repr__(self): return 'wx.Rect2D'+str(self.Get())
+ def __len__(self): return len(self.Get())
+ def __getitem__(self, index): return self.Get()[index]
+ def __setitem__(self, index, val):
+ if index == 0: self.x = val
+ elif index == 1: self.y = val
+ elif index == 2: self.width = val
+ elif index == 3: self.height = val
+ else: raise IndexError
+ def __nonzero__(self): return self.Get() != (0.0, 0.0, 0.0, 0.0)
+ __safe_for_unpickling__ = True
+ def __reduce__(self): return (wx.Rect2D, self.Get())
+ }
+
+};
+