X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1b8c7ba607a15a2ff8a04448138df9ffff7df6c5..c437fde9f90fc7dfcac79053d214fc9146d7be21:/wxPython/src/_gdicmn.i?ds=sidebyside diff --git a/wxPython/src/_gdicmn.i b/wxPython/src/_gdicmn.i index 5b62dd38d2..22a3d83fbc 100644 --- a/wxPython/src/_gdicmn.i +++ b/wxPython/src/_gdicmn.i @@ -191,7 +191,7 @@ of this object (i.e. equal to -1) with those of the other.", ""); "Get() -> (width,height)", "Returns the width and height properties as a tuple.", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); @@ -264,7 +264,7 @@ public: "Get() -> (x,y)", "Return the x and y properties as a tuple. ", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x)); PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y)); @@ -377,7 +377,7 @@ public: "Get() -> (x,y)", "Return the x and y properties as a tuple. ", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); @@ -453,6 +453,8 @@ public: wxSize GetSize() const; void SetSize( const wxSize &s ); + bool IsEmpty() const; + wxPoint GetTopLeft() const; void SetTopLeft(const wxPoint &p); wxPoint GetBottomRight() const; @@ -484,15 +486,51 @@ public: DocDeclStr( wxRect&, Inflate(wxCoord dx, wxCoord dy), - "Increase the rectangle size by dx in x direction and dy in y -direction. Both (or one of) parameters may be negative to decrease the -rectangle size.", ""); + "Increases the size of the rectangle. + +The left border is moved farther left and the right border is moved +farther right by ``dx``. The upper border is moved farther up and the +bottom border is moved farther down by ``dy``. (Note the the width and +height of the rectangle thus change by ``2*dx`` and ``2*dy``, +respectively.) If one or both of ``dx`` and ``dy`` are negative, the +opposite happens: the rectangle size decreases in the respective +direction. + +The change is made to the rectangle inplace, if instead you need a +copy that is inflated, preserving the original then make the copy +first:: + + copy = wx.Rect(*original) + copy.Inflate(10,15) + +", " +Inflating and deflating behaves *naturally*. Defined more precisely, +that means: + + * Real inflates (that is, ``dx`` and/or ``dy`` >= 0) are not + constrained. Thus inflating a rectangle can cause its upper left + corner to move into the negative numbers. (The versions prior to + 2.5.4 forced the top left coordinate to not fall below (0, 0), + which implied a forced move of the rectangle.) + + * Deflates are clamped to not reduce the width or height of the + rectangle below zero. In such cases, the top-left corner is + nonetheless handled properly. For example, a rectangle at (10, + 10) with size (20, 40) that is inflated by (-15, -15) will + become located at (20, 25) at size (0, 10). Finally, observe + that the width and height are treated independently. In the + above example, the width is reduced by 20, whereas the height is + reduced by the full 30 (rather than also stopping at 20, when + the width reached zero). + +:see: `Deflate` +"); DocDeclStr( wxRect&, Deflate(wxCoord dx, wxCoord dy), - "Decrease the rectangle size by dx in x direction and dy in y -direction. Both (or one of) parameters may be negative to increase the -rectngle size. This method is the opposite of Inflate.", ""); + "Decrease the rectangle size. This method is the opposite of `Inflate` +in that Deflate(a,b) is equivalent to Inflate(-a,-b). Please refer to +`Inflate` for a full description.", ""); DocDeclStrName( void, Offset(wxCoord dx, wxCoord dy), @@ -556,7 +594,7 @@ bottom, otherwise it is moved to the left or top respectively.", "", "Get() -> (x,y,width,height)", "Return the rectangle properties as a tuple.", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(4); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); @@ -602,7 +640,7 @@ DocAStr(wxIntersectRect, dest = reg1.GetBox(); if (dest != wxRect(0,0,0,0)) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxRect* newRect = new wxRect(dest); obj = wxPyConstructObject((void*)newRect, wxT("wxRect"), true); wxPyEndBlockThreads(blocked); @@ -690,7 +728,7 @@ public: "Get() -> (x,y)", "Return x and y properties as a tuple.", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->m_x)); PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->m_y));