]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't override DoGetSize, just let the default return the real size of
authorRobin Dunn <robin@alldunn.com>
Wed, 25 Oct 2006 20:23:06 +0000 (20:23 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 25 Oct 2006 20:23:06 +0000 (20:23 +0000)
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
src/generic/hyperlink.cpp

index c7e4ac4546ee3cf54e97f71021aec1a855b95f17..4ebe3bc98b6c1db37c3c1ec10744103a5711152e 100644 (file)
@@ -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
index ffb360855461eb3c1c1b56034e080d1ab9636aae..de7a4336ddcec3c60238baaeda9712760546349c 100644 (file)
@@ -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)
 {