JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_AccessibilityHandler.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29class AccessibilityNativeHandle;
30
41{
42public:
48 struct JUCE_API Interfaces
49 {
50 Interfaces() = default;
51
52 Interfaces (std::unique_ptr<AccessibilityValueInterface> ptr) : value (std::move (ptr)) {}
53 Interfaces (std::unique_ptr<AccessibilityTextInterface> ptr) : text (std::move (ptr)) {}
54 Interfaces (std::unique_ptr<AccessibilityTableInterface> ptr) : table (std::move (ptr)) {}
55 Interfaces (std::unique_ptr<AccessibilityCellInterface> ptr) : cell (std::move (ptr)) {}
56
61 : value (std::move (valueIn)),
62 text (std::move (textIn)),
63 table (std::move (tableIn)),
64 cell (std::move (cellIn))
65 {
66 }
67
72 };
73
88 AccessibilityHandler (Component& componentToWrap,
89 AccessibilityRole accessibilityRole,
90 AccessibilityActions actions = {},
91 Interfaces interfaces = {});
92
94 virtual ~AccessibilityHandler();
95
96 //==============================================================================
98 const Component& getComponent() const noexcept { return component; }
99
101 Component& getComponent() noexcept { return component; }
102
103 //==============================================================================
108 AccessibilityRole getRole() const noexcept { return role; }
109
124 virtual String getTitle() const { return component.getTitle(); }
125
140 virtual String getDescription() const { return component.getDescription(); }
141
152 virtual String getHelp() const { return component.getHelpText(); }
153
159 virtual AccessibleState getCurrentState() const;
160
162 bool isIgnored() const;
163
169 bool isVisibleWithinParent() const;
170
171 //==============================================================================
175 const AccessibilityActions& getActions() const noexcept;
176
181 AccessibilityValueInterface* getValueInterface() const;
182
187 AccessibilityTableInterface* getTableInterface() const;
188
193 AccessibilityCellInterface* getCellInterface() const;
194
199 AccessibilityTextInterface* getTextInterface() const;
200
201 //==============================================================================
205 AccessibilityHandler* getParent() const;
206
208 std::vector<AccessibilityHandler*> getChildren() const;
209
213 bool isParentOf (const AccessibilityHandler* possibleChild) const noexcept;
214
218 AccessibilityHandler* getChildAt (Point<int> screenPoint);
219
230 AccessibilityHandler* getChildFocus();
231
238 bool hasFocus (bool trueIfChildFocused) const;
239
248 void grabFocus();
249
258 void giveAwayFocus() const;
259
260 //==============================================================================
266 void notifyAccessibilityEvent (AccessibilityEvent event) const;
267
276 {
277 low,
278 medium,
279 high
280 };
281
287 static void postAnnouncement (const String& announcementString, AnnouncementPriority priority);
288
289 //==============================================================================
291 AccessibilityNativeHandle* getNativeImplementation() const;
293 std::type_index getTypeIndex() const { return typeIndex; }
295 static void clearCurrentlyFocusedHandler() { currentlyFocusedHandler = nullptr; }
296
309 static void* getNativeChildForComponent (Component& component);
311 static void setNativeChildForComponent (Component& component, void* nativeChild);
313 static Component* getComponentForNativeChild (void* nativeChild);
314
315private:
316 //==============================================================================
317 friend class AccessibilityNativeHandle;
318
319 //==============================================================================
320 void grabFocusInternal (bool);
321 void giveAwayFocusInternal() const;
322 void takeFocus();
323
324 static AccessibilityHandler* currentlyFocusedHandler;
325
326 //==============================================================================
327 Component& component;
328 std::type_index typeIndex;
329
330 const AccessibilityRole role;
331 AccessibilityActions actions;
332
333 Interfaces interfaces;
334
335 //==============================================================================
336 class AccessibilityNativeImpl;
338
339 static std::unique_ptr<AccessibilityNativeImpl> createNativeImpl (AccessibilityHandler&);
340
341 //==============================================================================
343};
344
345} // namespace juce
A simple wrapper for building a collection of supported accessibility actions and corresponding callb...
An abstract interface which represents a UI element that supports a cell interface.
Base class for accessible Components.
AccessibilityRole getRole() const noexcept
The type of UI element that this accessibility handler represents.
virtual String getTitle() const
The title of the UI element.
virtual String getHelp() const
Some help text for the UI element (if required).
virtual String getDescription() const
A short description of the UI element.
Component & getComponent() noexcept
Returns the Component that this handler represents.
const Component & getComponent() const noexcept
Returns the Component that this handler represents.
AnnouncementPriority
A priority level that can help an accessibility client determine how to handle an announcement reques...
An abstract interface which represents a UI element that supports a table interface.
An abstract interface which represents a UI element that supports a text interface.
An abstract interface representing the value of an accessibility element.
Represents the state of an accessible UI element.
The base class for all JUCE user-interface objects.
A pair of (x, y) coordinates.
Definition juce_Point.h:42
The JUCE String class!
Definition juce_String.h:53
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
AccessibilityEvent
A list of events that can be notified to any subscribed accessibility clients.
AccessibilityRole
The list of available roles for an AccessibilityHandler object.
Utility struct which holds one or more accessibility interfaces.