## wxRect

A class for manipulating rectangles.

Derived from

None

Include files

<wx/gdicmn.h>

See also

wxPoint, wxSize

Members

wxRect::wxRect
wxRect::x
wxRect::y
wxRect::width
wxRect::height
wxRect::Deflate
wxRect::GetBottom
wxRect::GetHeight
wxRect::GetLeft
wxRect::GetPosition
wxRect::GetRight
wxRect::GetSize
wxRect::GetTop
wxRect::GetWidth
wxRect::GetX
wxRect::GetY
wxRect::Inflate
wxRect:Inside
wxRect:Intersects
wxRect::Offset
wxRect::SetHeight
wxRect::SetWidth
wxRect::SetX
wxRect::SetY
wxRect::operator =
wxRect::operator ==
wxRect::operator !=

### wxRect::wxRect

wxRect()

Default constructor.

wxRect(int x, int y, int width, int height)

Creates a wxRect object from x, y, width and height values.

wxRect(const wxPoint& topLeft, const wxPoint& bottomRight)

Creates a wxRect object from top-left and bottom-right points.

wxRect(const wxPoint& pos, const wxSize& size)

Creates a wxRect object from position and size values.

### wxRect::x

int x

x coordinate of the top-level corner of the rectangle.

### wxRect::y

int y

y coordinate of the top-level corner of the rectangle.

### wxRect::width

int width

Width member.

### wxRect::height

int height

Height member.

### wxRect::Deflate

void Deflate(wxCoord dx, wxCoord dy)

void Deflate(wxCoord diff)

wxRect Deflate(wxCoord dx, wxCoord dy) const

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.

The second form uses the same diff for both dx and dy.

The first two versions modify the rectangle in place, the last one returns a new rectangle leaving this one unchanged.

See also

Inflate

### wxRect::GetBottom

int GetBottom() const

Gets the bottom point of the rectangle.

### wxRect::GetHeight

int GetHeight() const

Gets the height member.

### wxRect::GetLeft

int GetLeft() const

Gets the left point of the rectangle (the same as wxRect::GetX).

### wxRect::GetPosition

wxPoint GetPosition() const

Gets the position.

### wxRect::GetRight

int GetRight() const

Gets the right point of the rectangle.

### wxRect::GetSize

wxSize GetSize() const

Gets the size.

### wxRect::GetTop

int GetTop() const

Gets the top point of the rectangle (the same as wxRect::GetY).

### wxRect::GetWidth

int GetWidth() const

Gets the width member.

### wxRect::GetX

int GetX() const

Gets the x member.

### wxRect::GetY

int GetY() const

Gets the y member.

### wxRect::Inflate

void Inflate(wxCoord dx, wxCoord dy)

void Inflate(wxCoord diff)

wxRect Inflate(wxCoord dx, wxCoord dy) const

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.

The second form uses the same diff for both dx and dy.

The first two versions modify the rectangle in place, the last one returns a new rectangle leaving this one unchanged.

See also

Deflate

### wxRect:Inside

bool Inside(int x, int y) const

bool Inside(const wxPoint& pt) const

Returns `TRUE` if the given point is inside the rectangle (or on its boundary) and `FALSE` otherwise.

### wxRect:Intersects

bool Intersects(const wxRect& rect) const

Returns `TRUE` if this rectangle has a non empty intersection with the rectangle rect and `FALSE` otherwise.

### wxRect::Offset

void Offset(wxCoord dx, wxCoord dy)

void Offset(const wxPoint& pt)

Moves the rectangle by the specified offset. If dx is positive, the rectangle is moved to the right, if dy is positive, it is moved to the bottom, otherwise it is moved to the left or top respectively.

### wxRect::SetHeight

void SetHeight(int height)

Sets the height.

### wxRect::SetWidth

void SetWidth(int width)

Sets the width.

### wxRect::SetX

void SetX(int x)

Sets the x position.

### wxRect::SetY

void SetY(int y)

Sets the y position.

### wxRect::operator =

void operator =(const wxRect& rect)

Assignment operator.

### wxRect::operator ==

bool operator ==(const wxRect& rect)

Equality operator.

### wxRect::operator !=

bool operator !=(const wxRect& rect)

Inequality operator.