X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/914f51576275c0f5411db2eed52099c71a7489a3..032bc940fcde34cc649eaa111cd6aff1cda66104:/src/generic/hyperlink.cpp diff --git a/src/generic/hyperlink.cpp b/src/generic/hyperlink.cpp index 9d96c5e296..21f80fc131 100644 --- a/src/generic/hyperlink.cpp +++ b/src/generic/hyperlink.cpp @@ -53,6 +53,8 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_HYPERLINK) // reserved for internal use only #define wxHYPERLINKCTRL_POPUP_COPY_ID 16384 +const wxChar wxHyperlinkCtrlNameStr[] = wxT("hyperlink"); + // ---------------------------------------------------------------------------- // wxHyperlinkCtrl // ---------------------------------------------------------------------------- @@ -113,10 +115,8 @@ bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, f.SetUnderlined(true); SetFont(f); - CacheBestSize(DoGetBestSize()); - SetMinSize(GetBestSize()); - SetSize (DoGetBestSize()); - + SetInitialSize(size); + return true; } @@ -128,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) { @@ -202,13 +199,13 @@ void wxHyperlinkCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) void wxHyperlinkCtrl::OnLeftDown(wxMouseEvent& event) { // the left click must start from the hyperlink rect - m_clicking = GetLabelRect().Inside(event.GetPosition()); + m_clicking = GetLabelRect().Contains(event.GetPosition()); } void wxHyperlinkCtrl::OnLeftUp(wxMouseEvent& event) { // the click must be started and ended in the hyperlink rect - if (!m_clicking || !GetLabelRect().Inside(event.GetPosition())) + if (!m_clicking || !GetLabelRect().Contains(event.GetPosition())) return; SetForegroundColour(m_visitedColour); @@ -225,7 +222,7 @@ void wxHyperlinkCtrl::OnLeftUp(wxMouseEvent& event) void wxHyperlinkCtrl::OnRightUp(wxMouseEvent& event) { if( GetWindowStyle() & wxHL_CONTEXTMENU ) - if ( GetLabelRect().Inside(event.GetPosition()) ) + if ( GetLabelRect().Contains(event.GetPosition()) ) DoContextMenu(wxPoint(event.m_x, event.m_y)); } @@ -233,7 +230,7 @@ void wxHyperlinkCtrl::OnMotion(wxMouseEvent& event) { wxRect textrc = GetLabelRect(); - if (textrc.Inside(event.GetPosition())) + if (textrc.Contains(event.GetPosition())) { SetCursor(wxCursor(wxCURSOR_HAND)); SetForegroundColour(m_hoverColour);