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) {