1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-02 17:23:18 +02:00

For GTK builds - use wxStaticText instead of wxHyperlinkCtrl.

It turns out, that wxHyperlinkCtrl has a dramatically different size with the GTK backend. This commit makes link to be only clickable using mouse, but AFAIK accessibility is not implemented for GTK backend anyway.
This commit is contained in:
Dmitry Vedenko 2021-07-22 09:31:33 -07:00
parent d73c9a3074
commit e8f48dfb58

View File

@ -15,8 +15,11 @@
#include <unordered_map>
#include <algorithm>
#ifndef __WXGTK__
#include <wx/hyperlink.h>
#else
#include <wx/stattext.h>
#endif
namespace
{
@ -108,7 +111,7 @@ void AccessibleLinksFormatter::Populate(ShuttleGui& S) const
}
// Add hyperlink
#ifndef __WXGTK__
wxHyperlinkCtrl* hyperlink = safenew wxHyperlinkCtrl(
S.GetParent(), wxID_ANY, argument->Value.Translation(),
argument->TargetURL);
@ -122,7 +125,18 @@ void AccessibleLinksFormatter::Populate(ShuttleGui& S) const
}
S.AddWindow(hyperlink, wxALIGN_TOP | wxALIGN_LEFT);
#else
wxStaticText* hyperlink = S.AddVariableText(argument->Value);
hyperlink->SetFont(hyperlink->GetFont().Underlined());
hyperlink->SetCursor(wxCURSOR_HAND);
hyperlink->Bind(wxEVT_LEFT_UP, [handler = argument->Handler, url = argument->TargetURL](wxEvent&) {
if (handler)
handler();
else if (!url.empty())
wxLaunchDefaultBrowser(url);
});
#endif
// Update the currentPostion to the first symbol after the
// Placeholder