The Rect
class holds the four borders of a rectangle: left, top, right, and bottom.
Rect.h
namespace SmallWindows { class Rect; extern const Rect ZeroRect; class Rect { public:
The default constructor sets all the four borders to zero. The rectangle can be initialized by, or assigned to, another rectangle. It is also possible to initialize the rectangle with the top-left and bottom-right corners, as well as the top-left corner and a size holding the width and height of the rectangle:
Rect(); Rect(int left, int top, int right, int bottom); Rect(const Rect& rect); Rect& operator=(const Rect& rect); Rect(Point topLeft, Point bottomRight); Rect(Point topLeft, Size size);
Similar to SIZE
and POINT
in the previous sections, a rectangle can be initialized and assigned to a value of the Win32 API RECT
structure. A Rect
object can also be converted to a...