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
// 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
f.SetUnderlined(true);
SetFont(f);
- CacheBestSize(DoGetBestSize());
- SetMinSize(GetBestSize());
- SetSize (DoGetBestSize());
-
+ SetBestFittingSize(size);
+
return true;
}
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)
{