X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..f115bfec38b810f06ccc47544a4e2e2e410f73b1:/interface/wx/region.h diff --git a/interface/wx/region.h b/interface/wx/region.h index 6d8d212213..f7b9a466a2 100644 --- a/interface/wx/region.h +++ b/interface/wx/region.h @@ -3,7 +3,7 @@ // Purpose: interface of wxRegionIterator // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -33,7 +33,6 @@ enum wxRegionContain /** @class wxRegionIterator - @wxheader{region.h} This class is used to iterate through the rectangles in a region, typically when examining the damaged regions of a window within an OnPaint call. @@ -121,7 +120,7 @@ public: A wxPython alias for this operator is called Next. @endWxPythonOnly */ - void operator ++(); + wxRegionIterator& operator ++(); /** Returns @true if there are still some rectangles; otherwise returns @false. @@ -135,7 +134,6 @@ public: /** @class wxRegion - @wxheader{region.h} A wxRegion represents a simple or complex region on a device context or window. @@ -159,6 +157,9 @@ class wxRegion : public wxGDIObject public: /** Default constructor. + + This constructor creates an invalid, or null, object, i.e. calling + IsOk() on it returns @false and IsEmpty() returns @true. */ wxRegion(); /** @@ -183,7 +184,7 @@ public: in the provided array. @a fillStyle parameter may have values @c wxWINDING_RULE or @c wxODDEVEN_RULE. */ - wxRegion(size_t n, const wxPoint* points, int fillStyle = wxWINDING_RULE); + wxRegion(size_t n, const wxPoint* points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE); /** Constructs a region using a bitmap. See Union() for more details. */ @@ -200,22 +201,30 @@ public: See @ref overview_refcount_destruct "reference-counted object destruction" for more info. */ - ~wxRegion(); + virtual ~wxRegion(); /** Clears the current region. + + The object becomes invalid, or null, after being cleared. */ - void Clear(); + virtual void Clear(); /** Returns a value indicating whether the given point is contained within the region. + This method always returns @c wxOutRegion for an invalid region but + may, nevertheless, be safely called in this case. + @return The return value is one of @c wxOutRegion and @c wxInRegion. */ - wxRegionContain Contains(long& x, long& y) const; + wxRegionContain Contains(wxCoord x, wxCoord y) const; /** Returns a value indicating whether the given point is contained within the region. + This method always returns @c wxOutRegion for an invalid region but + may, nevertheless, be safely called in this case. + @return The return value is one of @c wxOutRegion and @c wxInRegion. */ wxRegionContain Contains(const wxPoint& pt) const; @@ -223,17 +232,23 @@ public: Returns a value indicating whether the given rectangle is contained within the region. + This method always returns @c wxOutRegion for an invalid region but + may, nevertheless, be safely called in this case. + @return One of ::wxOutRegion, ::wxPartRegion or ::wxInRegion. @note On Windows, only ::wxOutRegion and ::wxInRegion are returned; a value ::wxInRegion then indicates that all or some part of the region is contained in this region. */ - wxRegionContain Contains(long& x, long& y, long& width, long& height) const; + wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord width, wxCoord height) const; /** Returns a value indicating whether the given rectangle is contained within the region. + This method always returns @c wxOutRegion for an invalid region but + may, nevertheless, be safely called in this case. + @return One of ::wxOutRegion, ::wxPartRegion or ::wxInRegion. @note On Windows, only ::wxOutRegion and ::wxInRegion are returned; a value @@ -245,22 +260,29 @@ public: /** Convert the region to a black and white bitmap with the white pixels being inside the region. + + This method can't be used for invalid region. */ wxBitmap ConvertToBitmap() const; //@{ /** Returns the outer bounds of the region. + + This method returns 0-sized bounding box for invalid regions. */ void GetBox(wxCoord& x, wxCoord& y, wxCoord& width, wxCoord& height) const; - const wxRect GetBox() const; + wxRect GetBox() const; //@} /** Finds the intersection of this region and another, rectangular region, specified using position and size. + This method always fails, i.e. returns @false, if this region is + invalid but may nevertheless be safely used even in this case. + @return @true if successful, @false otherwise. @remarks Creates the intersection of the two regions, that is, the parts @@ -272,6 +294,9 @@ public: /** Finds the intersection of this region and another, rectangular region. + This method always fails, i.e. returns @false, if this region is + invalid but may nevertheless be safely used even in this case. + @return @true if successful, @false otherwise. @remarks Creates the intersection of the two regions, that is, the parts @@ -282,6 +307,9 @@ public: /** Finds the intersection of this region and another region. + This method always fails, i.e. returns @false, if this region is + invalid but may nevertheless be safely used even in this case. + @return @true if successful, @false otherwise. @remarks Creates the intersection of the two regions, that is, the parts @@ -292,15 +320,17 @@ public: /** Returns @true if the region is empty, @false otherwise. + + Always returns @true if the region is invalid. */ - bool IsEmpty() const; + virtual bool IsEmpty() const; /** Returns @true if the region is equal to, i.e. covers the same area as, another one. - @note If both this region and @a region are invalid, they are - considered to be equal. + If both this region and @a region are both invalid, they are considered + to be equal. */ bool IsEqual(const wxRegion& region) const; @@ -309,6 +339,10 @@ public: Moves the region by the specified offsets in horizontal and vertical directions. + This method can't be called if the region is invalid as it doesn't make + sense to offset it then. Attempts to do it will result in assert + failure. + @return @true if successful, @false otherwise (the region is unchanged then). */ @@ -319,6 +353,9 @@ public: /** Subtracts a rectangular region from this region. + This method always fails, i.e. returns @false, if this region is + invalid but may nevertheless be safely used even in this case. + @return @true if successful, @false otherwise. @remarks This operation combines the parts of 'this' region that are not @@ -329,6 +366,9 @@ public: /** Subtracts a region from this region. + This method always fails, i.e. returns @false, if this region is + invalid but may nevertheless be safely used even in this case. + @return @true if successful, @false otherwise. @remarks This operation combines the parts of 'this' region that are not @@ -341,6 +381,10 @@ public: Finds the union of this region and another, rectangular region, specified using position and size. + This method can be used even if this region is invalid and has the + natural behaviour in this case, i.e. makes this region equal to the + given rectangle. + @return @true if successful, @false otherwise. @remarks This operation creates a region that combines all of this region @@ -351,6 +395,10 @@ public: /** Finds the union of this region and another, rectangular region. + This method can be used even if this region is invalid and has the + natural behaviour in this case, i.e. makes this region equal to the + given rectangle. + @return @true if successful, @false otherwise. @remarks This operation creates a region that combines all of this region @@ -361,6 +409,10 @@ public: /** Finds the union of this region and another region. + This method can be used even if this region is invalid and has the + natural behaviour in this case, i.e. makes this region equal to the + given @a region. + @return @true if successful, @false otherwise. @remarks This operation creates a region that combines all of this region @@ -398,6 +450,10 @@ public: Finds the Xor of this region and another, rectangular region, specified using position and size. + This method can be used even if this region is invalid and has the + natural behaviour in this case, i.e. makes this region equal to the + given rectangle. + @return @true if successful, @false otherwise. @remarks This operation creates a region that combines all of this region @@ -408,6 +464,10 @@ public: /** Finds the Xor of this region and another, rectangular region. + This method can be used even if this region is invalid and has the + natural behaviour in this case, i.e. makes this region equal to the + given rectangle. + @return @true if successful, @false otherwise. @remarks This operation creates a region that combines all of this region @@ -418,6 +478,10 @@ public: /** Finds the Xor of this region and another region. + This method can be used even if this region is invalid and has the + natural behaviour in this case, i.e. makes this region equal to the + given @a region. + @return @true if successful, @false otherwise. @remarks This operation creates a region that combines all of this region @@ -429,7 +493,7 @@ public: /** Assignment operator, using @ref overview_refcount. */ - void operator =(const wxRegion& region); + wxRegion& operator=(const wxRegion& region); }; /**