Audacity 3.2.0
Functions
AccessibilityUtils.cpp File Reference
#include "AccessibilityUtils.h"
#include <deque>
#include <tuple>
#include <type_traits>
#include <wx/window.h>
#include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/radiobut.h>
#include <wx/slider.h>
#include <wx/statbox.h>
#include <wx/textctrl.h>
Include dependency graph for AccessibilityUtils.cpp:

Go to the source code of this file.

Functions

template<typename... Types>
bool IsOfType (wxWindow *window)
 
void SetupAccessibility (wxWindow *window)
 

Function Documentation

◆ IsOfType()

template<typename... Types>
bool IsOfType ( wxWindow *  window)

Audacity: A Digital Audio Editor

AccessibilityUtils.cpp

Dmitry Vedenko

Definition at line 32 of file AccessibilityUtils.cpp.

33{
34 std::tuple<std::add_pointer_t<Types>...> types;
35
36 return std::apply(
37 [window](auto... args) -> bool
38 { return ((dynamic_cast<decltype(args)>(window) != nullptr) || ...); },
39 types);
40}

Referenced by SetupAccessibility().

Here is the caller graph for this function:

◆ SetupAccessibility()

void SetupAccessibility ( wxWindow *  window)

Definition at line 42 of file AccessibilityUtils.cpp.

43{
44 std::deque<wxWindow*> elementsQueue;
45 elementsQueue.push_back(window);
46
47 while (!elementsQueue.empty())
48 {
49 auto element = elementsQueue.front();
50 elementsQueue.pop_front();
51
52 for (auto child : element->GetChildren())
53 elementsQueue.push_back(child);
54
55#if wxUSE_ACCESSIBILITY
56 if (element->GetAccessible() == nullptr)
57 {
58 if (IsOfType<
59 wxCheckBox, wxChoice, wxSlider, wxTextCtrl, wxStaticBox,
60 wxRadioButton>(element))
61 element->SetAccessible(safenew WindowAccessible(element));
62 }
63#endif
64
65 const auto label = element->GetLabel();
66
67 if (!label.empty())
68 element->SetName(wxStripMenuCodes(label));
69 }
70}
bool IsOfType(wxWindow *window)
#define safenew
Definition: MemoryX.h:10
TranslatableString label
Definition: TagsEditor.cpp:165
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...

References TranslatableString::empty(), IsOfType(), label, and safenew.

Referenced by audacity::cloud::audiocom::sync::CloudProjectPropertiesDialog::CloudProjectPropertiesDialog(), and audacity::cloud::audiocom::sync::AudioComDialogBase::ShowDialog().

Here is the call graph for this function:
Here is the caller graph for this function: