X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0938d8506409863011956e79b92fc137a5bcccf..534f87c6c442aa2710a44352bd26d215fec1714b:/src/msw/hyperlink.cpp diff --git a/src/msw/hyperlink.cpp b/src/msw/hyperlink.cpp index a2ba44a8eb..f39d94ae17 100644 --- a/src/msw/hyperlink.cpp +++ b/src/msw/hyperlink.cpp @@ -3,7 +3,6 @@ // Purpose: Hyperlink control // Author: Rickard Westerlund // Created: 2010-08-03 -// RCS-ID: $Id$ // Copyright: (c) 2010 wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,7 +23,10 @@ #include "wx/hyperlink.h" #ifndef WX_PRECOMP - #include "wx/stattext.h" + #include "wx/app.h" + #include "wx/msw/wrapcctl.h" // include "properly" + #include "wx/msw/private.h" + #include "wx/msw/missing.h" #endif // ---------------------------------------------------------------------------- @@ -39,6 +41,10 @@ #define LWS_RIGHT 0x0020 #endif +#ifndef WC_LINK + #define WC_LINK L"SysLink" +#endif + // ---------------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------------- @@ -47,13 +53,19 @@ namespace { bool HasNativeHyperlinkCtrl() { - return wxGetWinVersion() >= wxWinVersion_XP; + // Notice that we really must test comctl32.dll version and not the OS + // version here as even under Vista/7 we could be not using the v6 e.g. + // if the program doesn't have the correct manifest for some reason. + return wxApp::GetComCtl32Version() >= 600; } wxString GetLabelForSysLink(const wxString& text, const wxString& url) { - return wxString("" - + wxStaticText::RemoveMarkup(text) + ""; + // Any "&"s in the text should appear on the screen and not be (mis) + // interpreted as mnemonics. + return wxString::Format("%s", + url, + wxControl::EscapeMnemonics(text)); } } @@ -143,7 +155,7 @@ wxSize wxHyperlinkCtrl::DoGetBestClientSize() const { // LM_GETIDEALSIZE only exists under Vista so use the generic version even // when using the native control under XP - if ( wxGetWinVersion() < wxWinVersion_6 ) + if ( !HasNativeHyperlinkCtrl() || (wxGetWinVersion() < wxWinVersion_6) ) return wxGenericHyperlinkCtrl::DoGetBestClientSize(); SIZE idealSize;