added wxRect::GetTopRight/BottomLeft() for consistency with the existing GetTopLeft/BottomRight()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41249 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-09-16 13:36:30 +00:00
parent 7ca253a50f
commit f790ec82e7
2 changed files with 35 additions and 10 deletions

View File

@@ -147,14 +147,29 @@ Gets the position.
\constfunc{wxPoint}{GetTopLeft}{\void}
Gets the topleft position of the rectangle. (Same as GetPosition).
Gets the position of the top left corner of the rectangle, same as
\helpref{GetPosition}{wxrectgetposition}.
\membersection{wxRect::GetTopRight}\label{wxrectgettopright}
\constfunc{wxPoint}{GetTopRight}{\void}
Gets the position of the top right corner.
\membersection{wxRect::GetBottomLeft}\label{wxrectgetbottomleft}
\constfunc{wxPoint}{GetBottomLeft}{\void}
Gets the position of the bottom left corner.
\membersection{wxRect::GetBottomRight}\label{wxrectgetbottomright}
\constfunc{wxPoint}{GetBottomRight}{\void}
Gets the bottom right position. Returns the bottom right point inside the rectangle.
Gets the position of the bottom right corner.
\membersection{wxRect::GetRight}\label{wxrectgetright}

View File

@@ -354,6 +354,16 @@ public:
bool IsEmpty() const { return (width <= 0) || (height <= 0); }
int GetLeft() const { return x; }
int GetTop() const { return y; }
int GetBottom() const { return y + height - 1; }
int GetRight() const { return x + width - 1; }
void SetLeft(int left) { x = left; }
void SetRight(int right) { width = right - x + 1; }
void SetTop(int top) { y = top; }
void SetBottom(int bottom) { height = bottom - y + 1; }
wxPoint GetTopLeft() const { return GetPosition(); }
wxPoint GetLeftTop() const { return GetTopLeft(); }
void SetTopLeft(const wxPoint &p) { SetPosition(p); }
@@ -364,15 +374,15 @@ public:
void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); }
void SetRightBottom(const wxPoint &p) { SetBottomRight(p); }
int GetLeft() const { return x; }
int GetTop() const { return y; }
int GetBottom() const { return y + height - 1; }
int GetRight() const { return x + width - 1; }
wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); }
wxPoint GetRightTop() const { return GetTopRight(); }
void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); }
void SetRightTop(const wxPoint &p) { SetTopLeft(p); }
void SetLeft(int left) { x = left; }
void SetRight(int right) { width = right - x + 1; }
void SetTop(int top) { y = top; }
void SetBottom(int bottom) { height = bottom - y + 1; }
wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); }
wxPoint GetLeftBottom() const { return GetBottomLeft(); }
void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); }
void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); }
// operations with rect
wxRect& Inflate(wxCoord dx, wxCoord dy);