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_AccessibilityState.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
38class JUCE_API AccessibleState
39{
40public:
46 AccessibleState() = default;
47
48 //==============================================================================
53 [[nodiscard]] AccessibleState withCheckable() const noexcept { return withFlag (Flags::checkable); }
54
59 [[nodiscard]] AccessibleState withChecked() const noexcept { return withFlag (Flags::checked); }
60
65 [[nodiscard]] AccessibleState withCollapsed() const noexcept { return withFlag (Flags::collapsed); }
66
71 [[nodiscard]] AccessibleState withExpandable() const noexcept { return withFlag (Flags::expandable); }
72
77 [[nodiscard]] AccessibleState withExpanded() const noexcept { return withFlag (Flags::expanded); }
78
83 [[nodiscard]] AccessibleState withFocusable() const noexcept { return withFlag (Flags::focusable); }
84
89 [[nodiscard]] AccessibleState withFocused() const noexcept { return withFlag (Flags::focused); }
90
95 [[nodiscard]] AccessibleState withIgnored() const noexcept { return withFlag (Flags::ignored); }
96
101 [[nodiscard]] AccessibleState withSelectable() const noexcept { return withFlag (Flags::selectable); }
102
107 [[nodiscard]] AccessibleState withMultiSelectable() const noexcept { return withFlag (Flags::multiSelectable); }
108
113 [[nodiscard]] AccessibleState withSelected() const noexcept { return withFlag (Flags::selected); }
114
119 [[nodiscard]] AccessibleState withAccessibleOffscreen() const noexcept { return withFlag (Flags::accessibleOffscreen); }
120
121 //==============================================================================
126 bool isCheckable() const noexcept { return isFlagSet (Flags::checkable); }
127
132 bool isChecked() const noexcept { return isFlagSet (Flags::checked); }
133
138 bool isCollapsed() const noexcept { return isFlagSet (Flags::collapsed); }
139
144 bool isExpandable() const noexcept { return isFlagSet (Flags::expandable); }
145
150 bool isExpanded() const noexcept { return isFlagSet (Flags::expanded); }
151
156 bool isFocusable() const noexcept { return isFlagSet (Flags::focusable); }
157
162 bool isFocused() const noexcept { return isFlagSet (Flags::focused); }
163
168 bool isIgnored() const noexcept { return isFlagSet (Flags::ignored); }
169
174 bool isMultiSelectable() const noexcept { return isFlagSet (Flags::multiSelectable); }
175
180 bool isSelectable() const noexcept { return isFlagSet (Flags::selectable); }
181
186 bool isSelected() const noexcept { return isFlagSet (Flags::selected); }
187
192 bool isAccessibleOffscreen() const noexcept { return isFlagSet (Flags::accessibleOffscreen); }
193
194private:
195 enum Flags
196 {
197 checkable = (1 << 0),
198 checked = (1 << 1),
199 collapsed = (1 << 2),
200 expandable = (1 << 3),
201 expanded = (1 << 4),
202 focusable = (1 << 5),
203 focused = (1 << 6),
204 ignored = (1 << 7),
205 multiSelectable = (1 << 8),
206 selectable = (1 << 9),
207 selected = (1 << 10),
208 accessibleOffscreen = (1 << 11)
209 };
210
211 [[nodiscard]] AccessibleState withFlag (int flag) const noexcept
212 {
213 auto copy = *this;
214 copy.flags |= flag;
215
216 return copy;
217 }
218
219 bool isFlagSet (int flag) const noexcept
220 {
221 return (flags & flag) != 0;
222 }
223
224 int flags = 0;
225};
226
227} // namespace juce
Represents the state of an accessible UI element.
bool isCollapsed() const noexcept
Returns true if the UI element is collapsed.
bool isExpandable() const noexcept
Returns true if the UI element is expandable.
bool isAccessibleOffscreen() const noexcept
Returns true if the UI element is accessible offscreen.
AccessibleState withFocusable() const noexcept
Sets the focusable flag and returns the new state.
bool isMultiSelectable() const noexcept
Returns true if the UI element supports multiple item selection.
bool isChecked() const noexcept
Returns true if the UI element is checked.
bool isFocusable() const noexcept
Returns true if the UI element is focusable.
AccessibleState withExpandable() const noexcept
Sets the expandable flag and returns the new state.
AccessibleState withCheckable() const noexcept
Sets the checkable flag and returns the new state.
AccessibleState withAccessibleOffscreen() const noexcept
Sets the accessible offscreen flag and returns the new state.
bool isSelectable() const noexcept
Returns true if the UI element is selectable.
AccessibleState withSelectable() const noexcept
Sets the selectable flag and returns the new state.
AccessibleState withSelected() const noexcept
Sets the selected flag and returns the new state.
AccessibleState withFocused() const noexcept
Sets the focused flag and returns the new state.
AccessibleState withExpanded() const noexcept
Sets the expanded flag and returns the new state.
AccessibleState()=default
Constructor.
AccessibleState withChecked() const noexcept
Sets the checked flag and returns the new state.
bool isFocused() const noexcept
Returns true if the UI element is focused.
bool isExpanded() const noexcept
Returns true if the UI element is expanded.
bool isSelected() const noexcept
Returns true if the UI element is selected.
bool isIgnored() const noexcept
Returns true if the UI element is ignored.
AccessibleState withIgnored() const noexcept
Sets the ignored flag and returns the new state.
AccessibleState withCollapsed() const noexcept
Sets the collapsed flag and returns the new state.
AccessibleState withMultiSelectable() const noexcept
Sets the multiSelectable flag and returns the new state.
bool isCheckable() const noexcept
Returns true if the UI element is checkable.
JUCE Namespace.