Audacity 3.2.0
AccessibleLinksFormatter.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file AccessibleLinksFormatter.h
6 @brief Define a helper class to format text with link in a way, accessible to VI users.
7
8 Dmitry Vedenko
9 **********************************************************************/
10
11#pragma once
12
13#include <functional>
14#include <vector>
15
16#include "TranslatableString.h"
17
18class ShuttleGui;
19
30{
31public:
33 using LinkClickedHandler = std::function<void()>;
34
43
46 wxString placeholder, TranslatableString value, std::string targetURL);
47
50 wxString placeholder, TranslatableString value,
51 LinkClickedHandler handler);
52
54 void Populate(ShuttleGui& S) const;
55private:
56 struct FormatArgument final
57 {
58 wxString Placeholder;
60
62 std::string TargetURL;
63 };
64
65 struct ProcessedArgument final
66 {
67 const FormatArgument* Argument { nullptr };
68 size_t PlaceholderPosition { wxString::npos };
69 };
70
71 /* Find the positions of the placeholders and sort
72 * arguments according to the positions.
73 */
74 std::vector<ProcessedArgument>
75 ProcessArguments(wxString translatedMessage) const;
76
78 std::vector<FormatArgument> mFormatArguments;
79};
#define S(N)
Definition: ToChars.cpp:64
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
Holds a msgid for the translation catalog; may also bind format arguments.