From f790ec82e7fb0e8fa30bd1b3d71dbbef9bd4dcf8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 16 Sep 2006 13:36:30 +0000 Subject: [PATCH] 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 --- docs/latex/wx/rect.tex | 19 +++++++++++++++++-- include/wx/gdicmn.h | 26 ++++++++++++++++++-------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/docs/latex/wx/rect.tex b/docs/latex/wx/rect.tex index e70e47d85b..3a45afaa27 100644 --- a/docs/latex/wx/rect.tex +++ b/docs/latex/wx/rect.tex @@ -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} diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index c2fbc87d75..242e0f9ea8 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -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); -- 2.47.2