From b4b5a92e0bb26443af521f47d02a8cadb9be1e70 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 25 Oct 2006 20:23:06 +0000 Subject: [PATCH] Don't override DoGetSize, just let the default return the real size of the widget like normal. Since the former implementation used GetBestSize, which uses a DC, which on Mac calls window->GetSize, this resulted in an infinite recursion. Also use SetBestFittingSize in the ctor and move CacheBestSize to DoGetBestSize where it belongs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42409 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/hyperlink.h | 1 - src/generic/hyperlink.cpp | 15 +++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/wx/hyperlink.h b/include/wx/hyperlink.h index c7e4ac4546..4ebe3bc98b 100644 --- a/include/wx/hyperlink.h +++ b/include/wx/hyperlink.h @@ -133,7 +133,6 @@ protected: // Returns the best size for the window, which is the size needed // to display the text label. - virtual void DoGetSize(int *width, int *height) const; virtual wxSize DoGetBestSize() const; // creates a context menu with "Copy URL" menuitem diff --git a/src/generic/hyperlink.cpp b/src/generic/hyperlink.cpp index ffb3608554..de7a4336dd 100644 --- a/src/generic/hyperlink.cpp +++ b/src/generic/hyperlink.cpp @@ -115,10 +115,8 @@ bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, f.SetUnderlined(true); SetFont(f); - CacheBestSize(DoGetBestSize()); - SetMinSize(GetBestSize()); - SetSize (DoGetBestSize()); - + SetBestFittingSize(size); + return true; } @@ -130,14 +128,11 @@ wxSize wxHyperlinkCtrl::DoGetBestSize() const dc.SetFont(GetFont()); dc.GetTextExtent(GetLabel(), &w, &h); - return wxSize(w, h); + wxSize best(w, h); + CacheBestSize(best); + return best; } -void wxHyperlinkCtrl::DoGetSize(int *width, int *height) const -{ - if (width) *width = GetBestSize().GetWidth(); - if (height) *height = GetBestSize().GetHeight(); -} void wxHyperlinkCtrl::SetNormalColour(const wxColour &colour) { -- 2.45.2