1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 00:29:41 +02:00

Change the link color to the default color of wxHyperlinkCtrl

This commit is contained in:
Dmitry Vedenko 2021-07-23 15:48:03 +03:00
parent 9a07826cd2
commit b28533328f

View File

@ -14,10 +14,11 @@
#include <unordered_map>
#include <algorithm>
#include <memory>
#ifndef __WXGTK__
#include <wx/hyperlink.h>
#else
#ifdef __WXGTK__
#include <wx/stattext.h>
#endif
@ -73,6 +74,16 @@ void AccessibleLinksFormatter::Populate(ShuttleGui& S) const
return;
}
#ifdef __WXGTK__
// Non empty label is required, as wxHyperlinkCtrl would assert otherwise
std::unique_ptr<wxHyperlinkCtrl> tempHyperlink
= std::make_unique<wxHyperlinkCtrl>(S.GetParent(), wxID_ANY, wxT("temp"), wxString());
const wxColour hyperlinkColour = tempHyperlink->GetNormalColour();
tempHyperlink.reset();
#endif
wxString translated = mMessage.Translation();
std::vector<ProcessedArgument> processedArguments =
@ -129,7 +140,9 @@ void AccessibleLinksFormatter::Populate(ShuttleGui& S) const
wxStaticText* hyperlink = S.AddVariableText(argument->Value);
hyperlink->SetFont(hyperlink->GetFont().Underlined());
hyperlink->SetForegroundColour(hyperlinkColour);
hyperlink->SetCursor(wxCURSOR_HAND);
hyperlink->Bind(wxEVT_LEFT_UP, [handler = argument->Handler, url = argument->TargetURL](wxEvent&) {
if (handler)
handler();