From 8d8fbb9d1bf9d40e840a9c4e80842049fb7ef1ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Skiba?= Date: Fri, 5 Nov 2004 19:54:29 +0000 Subject: [PATCH] Simplify wxRect construction at the wxPoint(0,0) with given size. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30297 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/rect.tex | 4 ++++ include/wx/gdicmn.h | 1 + src/common/gdicmn.cpp | 8 +++++++- src/univ/themes/gtk.cpp | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/latex/wx/rect.tex b/docs/latex/wx/rect.tex index 3a55f65f9b..4ea50eb7d5 100644 --- a/docs/latex/wx/rect.tex +++ b/docs/latex/wx/rect.tex @@ -34,6 +34,10 @@ Creates a wxRect object from top-left and bottom-right points. Creates a wxRect object from position and size values. +\func{}{wxRect}{\param{const wxSize\&}{ size}} + +Creates a wxRect object from size values at the origin. + \membersection{wxRect::x}\label{wxrectx} \member{int}{x} diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 83858f5c85..7741ee467e 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -314,6 +314,7 @@ public: { } wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); wxRect(const wxPoint& pos, const wxSize& size); + wxRect(const wxSize& size); // default copy ctor and assignment operators ok diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 8edaa3ecf2..58f901a085 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -125,6 +125,12 @@ wxRect::wxRect(const wxPoint& point, const wxSize& size) width = size.x; height = size.y; } +wxRect::wxRect(const wxSize& size) +{ + x = 0; y = 0; + width = size.x; height = size.y; +} + bool wxRect::operator==(const wxRect& rect) const { return ((x == rect.x) && @@ -854,7 +860,7 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize, // a different font if we create it with empty facename, but it is // still better than never matching anything in the cache at all // in this case - if ( same && !facename.IsEmpty() ) + if ( same && !facename.empty() ) { const wxString& fontFace = font->GetFaceName(); diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index 098e4d0960..ec14525c64 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -2266,7 +2266,7 @@ void wxGTKRenderer::InitComboBitmaps() wxCONTROL_DISABLED, }; - wxRect rect(wxPoint(0, 0), sizeArrow); + wxRect rect(sizeArrow); wxMemoryDC dc; for ( n = ComboState_Normal; n < ComboState_Max; n++ )