JUCE v8.0.9
JUCE API
 
Loading...
Searching...
No Matches
juce::detail::ButtonAccessibilityHandler Class Reference

#include <juce_ButtonAccessibilityHandler.h>

Inheritance diagram for juce::detail::ButtonAccessibilityHandler:
Collaboration diagram for juce::detail::ButtonAccessibilityHandler:

Classes

class  ButtonValueInterface
 

Public Types

enum class  AnnouncementPriority {
  low ,
  medium ,
  high
}
 A priority level that can help an accessibility client determine how to handle an announcement request. More...
 

Public Member Functions

 ButtonAccessibilityHandler (Button &buttonToWrap, AccessibilityRole roleIn)
 
const AccessibilityActionsgetActions () const noexcept
 Returns the set of actions that the UI element supports and the associated callbacks.
 
AccessibilityCellInterfacegetCellInterface () const
 Returns the cell interface for this UI element, or nullptr if it is not supported.
 
AccessibilityHandlergetChildAt (Point< int > screenPoint)
 Returns the deepest child of this UI element in the accessibility hierarchy that contains the given screen point, or nullptr if there is no child at this point.
 
AccessibilityHandlergetChildFocus ()
 Returns the deepest UI element which currently has focus.
 
std::vector< AccessibilityHandler * > getChildren () const
 Returns the unignored children of this UI element in the accessibility hierarchy.
 
const ComponentgetComponent () const noexcept
 Returns the Component that this handler represents.
 
ComponentgetComponent () noexcept
 Returns the Component that this handler represents.
 
AccessibleState getCurrentState () const override
 Returns the current state of the UI element.
 
virtual String getDescription () const
 A short description of the UI element.
 
String getHelp () const override
 Some help text for the UI element (if required).
 
AccessibilityNativeHandlegetNativeImplementation () const
 
AccessibilityHandlergetParent () const
 Returns the first unignored parent of this UI element in the accessibility hierarchy, or nullptr if this is a root element without a parent.
 
AccessibilityRole getRole () const noexcept
 The type of UI element that this accessibility handler represents.
 
AccessibilityTableInterfacegetTableInterface () const
 Returns the table interface for this UI element, or nullptr if it is not supported.
 
AccessibilityTextInterfacegetTextInterface () const
 Returns the text interface for this UI element, or nullptr if it is not supported.
 
String getTitle () const override
 The title of the UI element.
 
std::type_index getTypeIndex () const
 
AccessibilityValueInterfacegetValueInterface () const
 Returns the value interface for this UI element, or nullptr if it is not supported.
 
void giveAwayFocus () const
 If this UI element or any of its children in the accessibility hierarchy currently have focus, this will defocus it.
 
void grabFocus ()
 Tries to give focus to this UI element.
 
bool hasFocus (bool trueIfChildFocused) const
 Returns true if this UI element has the focus.
 
bool isIgnored () const
 Returns true if this UI element should be ignored by accessibility clients.
 
bool isParentOf (const AccessibilityHandler *possibleChild) const noexcept
 Checks whether a given UI element is a child of this one in the accessibility hierarchy.
 
bool isVisibleWithinParent () const
 Returns true if this UI element is visible within its parent.
 
void notifyAccessibilityEvent (AccessibilityEvent event) const
 Used to send a notification to any observing accessibility clients that something has changed in the UI element.
 

Static Public Member Functions

static void clearCurrentlyFocusedHandler ()
 
static ComponentgetComponentForNativeChild (void *nativeChild)
 
static void * getNativeChildForComponent (Component &component)
 
static void postAnnouncement (const String &announcementString, AnnouncementPriority priority)
 Posts an announcement to be made to the user.
 
static void postSystemNotification (const String &notificationTitle, const String &notificationBody)
 Posts a local system notification.
 
static void setNativeChildForComponent (Component &component, void *nativeChild)
 

Private Member Functions

void giveAwayFocusInternal () const
 
void grabFocusInternal (bool)
 
void takeFocus ()
 

Static Private Member Functions

static bool areAnyAccessibilityClientsActive ()
 
static std::unique_ptr< AccessibilityNativeImpl > createNativeImpl (AccessibilityHandler &)
 
static AccessibilityActions getAccessibilityActions (Button &button)
 
static Interfaces getAccessibilityInterfaces (Button &button)
 
static bool isRadioButton (const Button &button) noexcept
 

Private Attributes

AccessibilityActions actions
 
Buttonbutton
 
Componentcomponent
 
Interfaces interfaces
 
std::unique_ptr< AccessibilityNativeImpl > nativeImpl
 
const AccessibilityRole role
 
std::type_index typeIndex
 

Static Private Attributes

static AccessibilityHandlercurrentlyFocusedHandler = nullptr
 

Member Enumeration Documentation

◆ AnnouncementPriority

A priority level that can help an accessibility client determine how to handle an announcement request.

Exactly what this controls is platform-specific, but generally a low priority announcement will be read when the screen reader is free, whereas a high priority announcement will interrupt the current speech.

Enumerator
low 
medium 
high 

Constructor & Destructor Documentation

◆ ButtonAccessibilityHandler()

juce::detail::ButtonAccessibilityHandler::ButtonAccessibilityHandler ( Button buttonToWrap,
AccessibilityRole  roleIn 
)
inline

Member Function Documentation

◆ areAnyAccessibilityClientsActive()

static bool juce::AccessibilityHandler::areAnyAccessibilityClientsActive ( )
staticprivateinherited

◆ clearCurrentlyFocusedHandler()

static void juce::AccessibilityHandler::clearCurrentlyFocusedHandler ( )
inlinestaticinherited

◆ createNativeImpl()

static std::unique_ptr< AccessibilityNativeImpl > juce::AccessibilityHandler::createNativeImpl ( AccessibilityHandler )
staticprivateinherited

◆ getAccessibilityActions()

◆ getAccessibilityInterfaces()

static Interfaces juce::detail::ButtonAccessibilityHandler::getAccessibilityInterfaces ( Button button)
inlinestaticprivate

◆ getActions()

const AccessibilityActions & juce::AccessibilityHandler::getActions ( ) const
noexceptinherited

Returns the set of actions that the UI element supports and the associated callbacks.

◆ getCellInterface()

AccessibilityCellInterface * juce::AccessibilityHandler::getCellInterface ( ) const
inherited

Returns the cell interface for this UI element, or nullptr if it is not supported.

See also
AccessibilityCellInterface

◆ getChildAt()

AccessibilityHandler * juce::AccessibilityHandler::getChildAt ( Point< int >  screenPoint)
inherited

Returns the deepest child of this UI element in the accessibility hierarchy that contains the given screen point, or nullptr if there is no child at this point.

◆ getChildFocus()

AccessibilityHandler * juce::AccessibilityHandler::getChildFocus ( )
inherited

Returns the deepest UI element which currently has focus.

This can be a child of this UI element or, if no child is focused, this element itself.

Note that this can be different to the value of the Component with keyboard focus returned by Component::getCurrentlyFocusedComponent().

See also
hasFocus

◆ getChildren()

std::vector< AccessibilityHandler * > juce::AccessibilityHandler::getChildren ( ) const
inherited

Returns the unignored children of this UI element in the accessibility hierarchy.

◆ getComponent() [1/2]

const Component & juce::AccessibilityHandler::getComponent ( ) const
inlinenoexceptinherited

◆ getComponent() [2/2]

Component & juce::AccessibilityHandler::getComponent ( )
inlinenoexceptinherited

Returns the Component that this handler represents.

◆ getComponentForNativeChild()

static Component * juce::AccessibilityHandler::getComponentForNativeChild ( void *  nativeChild)
staticinherited

◆ getCurrentState()

AccessibleState juce::detail::ButtonAccessibilityHandler::getCurrentState ( ) const
inlineoverridevirtual

Returns the current state of the UI element.

The default implementation of this method will set the focusable flag and, if this UI element is currently focused, will also set the focused flag.

Reimplemented from juce::AccessibilityHandler.

References button, juce::AccessibilityHandler::getCurrentState(), juce::Button::getToggleState(), and juce::Button::isToggleable().

◆ getDescription()

virtual String juce::AccessibilityHandler::getDescription ( ) const
inlinevirtualinherited

A short description of the UI element.

This may be read out by the system. It should not include the type of the UI element and should ideally be a single word, for example "Open" for a button that opens a window.

The default implementation will call Component::getDescription(), but you can override this to return a different string if required.

If neither a name nor a description is provided then the UI element may be ignored by accessibility clients.

This must be a localised string.

◆ getHelp()

String juce::detail::ButtonAccessibilityHandler::getHelp ( ) const
inlineoverridevirtual

Some help text for the UI element (if required).

This may be read out by the system. This string functions in a similar way to a tooltip, for example "Click to open window." for a button which opens a window.

The default implementation will call Component::getHelpText(), but you can override this to return a different string if required.

This must be a localised string.

Reimplemented from juce::AccessibilityHandler.

References button, and juce::SettableTooltipClient::getTooltip().

◆ getNativeChildForComponent()

static void * juce::AccessibilityHandler::getNativeChildForComponent ( Component component)
staticinherited

The following functions provide the means to associate JUCE Components with OS specific types that provide their own accessibility mechanisms. This way accessibility navigation can move from a JUCE Component to a native, embedded window and back.

These functions assume that the concrete types behind the void* are

  • Windows: HWND
  • MacOS: NSView*
  • iOS: UIView*
  • Android: GlobalRef that points to an android.view.View

◆ getNativeImplementation()

AccessibilityNativeHandle * juce::AccessibilityHandler::getNativeImplementation ( ) const
inherited

◆ getParent()

AccessibilityHandler * juce::AccessibilityHandler::getParent ( ) const
inherited

Returns the first unignored parent of this UI element in the accessibility hierarchy, or nullptr if this is a root element without a parent.

Referenced by juce::detail::AccessibilityHelpers::getEnclosingHandlerWithInterface().

◆ getRole()

AccessibilityRole juce::AccessibilityHandler::getRole ( ) const
inlinenoexceptinherited

The type of UI element that this accessibility handler represents.

See also
AccessibilityRole

◆ getTableInterface()

AccessibilityTableInterface * juce::AccessibilityHandler::getTableInterface ( ) const
inherited

◆ getTextInterface()

AccessibilityTextInterface * juce::AccessibilityHandler::getTextInterface ( ) const
inherited

Returns the text interface for this UI element, or nullptr if it is not supported.

See also
AccessibilityTextInterface

◆ getTitle()

String juce::detail::ButtonAccessibilityHandler::getTitle ( ) const
inlineoverridevirtual

The title of the UI element.

This will be read out by the system and should be concise, preferably matching the visible title of the UI element (if any). For example, this might be the text of a button or a simple label.

The default implementation will call Component::getTitle(), but you can override this to return a different string if required.

If neither a name nor a description is provided then the UI element may be ignored by accessibility clients.

This must be a localised string.

Reimplemented from juce::AccessibilityHandler.

References button, juce::Button::getButtonText(), and juce::AccessibilityHandler::getTitle().

◆ getTypeIndex()

std::type_index juce::AccessibilityHandler::getTypeIndex ( ) const
inlineinherited

◆ getValueInterface()

AccessibilityValueInterface * juce::AccessibilityHandler::getValueInterface ( ) const
inherited

Returns the value interface for this UI element, or nullptr if it is not supported.

See also
AccessibilityValueInterface

Referenced by juce::UIAValueProvider::get_IsReadOnly(), and juce::UIAValueProvider::get_Value().

◆ giveAwayFocus()

void juce::AccessibilityHandler::giveAwayFocus ( ) const
inherited

If this UI element or any of its children in the accessibility hierarchy currently have focus, this will defocus it.

This will also give away the keyboard focus from the Component it represents, and notify any listening accessibility clients that the current focus has changed.

See also
hasFocus, grabFocus

◆ giveAwayFocusInternal()

void juce::AccessibilityHandler::giveAwayFocusInternal ( ) const
privateinherited

◆ grabFocus()

void juce::AccessibilityHandler::grabFocus ( )
inherited

Tries to give focus to this UI element.

If the UI element is focusable and not ignored this will update the currently focused element, try to give keyboard focus to the Component it represents, and notify any listening accessibility clients that the current focus has changed.

See also
hasFocus, giveAwayFocus

◆ grabFocusInternal()

void juce::AccessibilityHandler::grabFocusInternal ( bool  )
privateinherited

◆ hasFocus()

bool juce::AccessibilityHandler::hasFocus ( bool  trueIfChildFocused) const
inherited

Returns true if this UI element has the focus.

Parameters
trueIfChildFocusedif this is true, this method will also return true if any child of this UI element in the accessibility hierarchy has focus

Referenced by juce::UIATextProvider::GetCaretRange().

◆ isIgnored()

bool juce::AccessibilityHandler::isIgnored ( ) const
inherited

Returns true if this UI element should be ignored by accessibility clients.

◆ isParentOf()

bool juce::AccessibilityHandler::isParentOf ( const AccessibilityHandler possibleChild) const
noexceptinherited

Checks whether a given UI element is a child of this one in the accessibility hierarchy.

◆ isRadioButton()

static bool juce::detail::ButtonAccessibilityHandler::isRadioButton ( const Button button)
inlinestaticprivatenoexcept

◆ isVisibleWithinParent()

bool juce::AccessibilityHandler::isVisibleWithinParent ( ) const
inherited

Returns true if this UI element is visible within its parent.

This will always return true for UI elements with the AccessibleState::accessibleOffscreen flag set.

◆ notifyAccessibilityEvent()

void juce::AccessibilityHandler::notifyAccessibilityEvent ( AccessibilityEvent  event) const
inherited

Used to send a notification to any observing accessibility clients that something has changed in the UI element.

See also
AccessibilityEvent

◆ postAnnouncement()

static void juce::AccessibilityHandler::postAnnouncement ( const String announcementString,
AnnouncementPriority  priority 
)
staticinherited

Posts an announcement to be made to the user.

Parameters
announcementStringa localised string containing the announcement to be read out
prioritythe appropriate priority level for the announcement

◆ postSystemNotification()

static void juce::AccessibilityHandler::postSystemNotification ( const String notificationTitle,
const String notificationBody 
)
staticinherited

Posts a local system notification.

In order for this to do anything, the following conditions must be met.

  • At build time:
    • The juce_gui_extra module must be included in the project.
    • Push notifications must be enabled by setting the preprocessor definition JUCE_PUSH_NOTIFICATIONS=1
  • At run time:
    • An accessibility client (narrator, voiceover etc.) must be active.

Additionally, on Android, an icon is required for notifications. This must be specified by adding the path to the icon file called "accessibilitynotificationicon" in the "Extra Android Raw Resources" setting in the Projucer.

This will use the push notification client on macOS, iOS and Android. On Windows this will create a system tray icon to post the notification.

Parameters
notificationTitlethe title of the notification
notificationBodythe main body text of the notification

◆ setNativeChildForComponent()

static void juce::AccessibilityHandler::setNativeChildForComponent ( Component component,
void *  nativeChild 
)
staticinherited

◆ takeFocus()

void juce::AccessibilityHandler::takeFocus ( )
privateinherited

Member Data Documentation

◆ actions

AccessibilityActions juce::AccessibilityHandler::actions
privateinherited

Referenced by getAccessibilityActions().

◆ button

Button& juce::detail::ButtonAccessibilityHandler::button
private

◆ component

Component& juce::AccessibilityHandler::component
privateinherited

◆ currentlyFocusedHandler

AccessibilityHandler* juce::AccessibilityHandler::currentlyFocusedHandler = nullptr
inlinestaticprivateinherited

◆ interfaces

Interfaces juce::AccessibilityHandler::interfaces
privateinherited

◆ nativeImpl

std::unique_ptr<AccessibilityNativeImpl> juce::AccessibilityHandler::nativeImpl
privateinherited

◆ role

const AccessibilityRole juce::AccessibilityHandler::role
privateinherited

◆ typeIndex

std::type_index juce::AccessibilityHandler::typeIndex
privateinherited

The documentation for this class was generated from the following file: