Qt 4.8
Classes | Macros | Typedefs | Functions | Variables
qaccessible_mac.mm File Reference
#include "qaccessible.h"
#include "qaccessible_mac_p.h"
#include "qhash.h"
#include "qset.h"
#include "qpointer.h"
#include "qapplication.h"
#include "qmainwindow.h"
#include "qtextdocument.h"
#include "qdebug.h"
#include "qabstractslider.h"
#include "qsplitter.h"
#include "qtabwidget.h"
#include "qlistview.h"
#include "qtableview.h"
#include "qdockwidget.h"
#include <private/qt_mac_p.h>
#include <private/qwidget_p.h>
#include <CoreFoundation/CoreFoundation.h>
#include "qaccessible_mac_carbon.cpp"

Go to the source code of this file.

Classes

struct  IsWindowAndNotDrawerOrSheetTest
 
struct  IsWindowTest
 
struct  QAccessibleTextBinding
 
class  QItemViewInterfaceFactory
 
class  QMultipleHIObjectFactory
 
class  QStandardInterfaceFactory
 

Macros

#define QAXApplicationRole   kAXApplicationRole
 
#define QAXButtonRole   kAXButtonRole
 
#define QAXCancelAction   kAXCancelAction
 
#define QAXCheckBoxRole   kAXCheckBoxRole
 
#define QAXChildrenAttribute   kAXChildrenAttribute
 
#define QAXCloseButtonAttribute   kAXCloseButtonAttribute
 
#define QAXColumnRole   kAXColumnRole
 
#define QAXConfirmAction   kAXConfirmAction
 
#define QAXContentsAttribute   kAXContentsAttribute
 
#define QAXDecrementAction   kAXDecrementAction
 
#define QAXDecrementArrowSubrole   kAXDecrementArrowSubrole
 
#define QAXDecrementPageSubrole   kAXDecrementPageSubrole
 
#define QAXDescriptionAttribute   kAXDescriptionAttribute
 
#define QAXEnabledAttribute   kAXEnabledAttribute
 
#define QAXExpandedAttribute   kAXExpandedAttribute
 
#define QAXFocusedAttribute   kAXFocusedAttribute
 
#define QAXFocusedUIElementChangedNotification   kAXFocusedUIElementChangedNotification
 
#define QAXFocusedWindowChangedNotification   kAXFocusedWindowChangedNotification
 
#define QAXGroupRole   kAXGroupRole
 
#define QAXGrowAreaAttribute   kAXGrowAreaAttribute
 
#define QAXGrowAreaRole   kAXGrowAreaRole
 
#define QAXHelpAttribute   kAXHelpAttribute
 
#define QAXHorizontalOrientationValue   kAXHorizontalOrientationValue
 
#define QAXHorizontalScrollBarAttribute   kAXHorizontalScrollBarAttribute
 
#define QAXIncrementAction   kAXIncrementAction
 
#define QAXIncrementArrowSubrole   kAXIncrementArrowSubrole
 
#define QAXIncrementorRole   kAXIncrementorRole
 
#define QAXIncrementPageSubrole   kAXIncrementPageSubrole
 
#define QAXLinkedUIElementsAttribute   kAXLinkedUIElementsAttribute
 
#define QAXListRole   kAXListRole
 
#define QAXMainAttribute   kAXMainAttribute
 
#define QAXMaxValueAttribute   kAXMaxValueAttribute
 
#define QAXMenuBarRole   kAXMenuBarRole
 
#define QAXMenuButtonRole   kAXMenuButtonRole
 
#define QAXMenuClosedNotification   kAXMenuClosedNotification
 
#define QAXMenuItemRole   kAXMenuItemRole
 
#define QAXMenuOpenedNotification   kAXMenuOpenedNotification
 
#define QAXMenuRole   kAXMenuRole
 
#define QAXMinimizeButtonAttribute   kAXMinimizeButtonAttribute
 
#define QAXMinimizedAttribute   kAXMinimizedAttribute
 
#define QAXMinValueAttribute   kAXMinValueAttribute
 
#define QAXNextContentsAttribute   kAXNextContentsAttribute
 
#define QAXOrientationAttribute   kAXOrientationAttribute
 
#define QAXParentAttribute   kAXParentAttribute
 
#define QAXPickAction   kAXPickAction
 
#define QAXPopUpButtonRole   kAXPopUpButtonRole
 
#define QAXPositionAttribute   kAXPositionAttribute
 
#define QAXPressAction   kAXPressAction
 
#define QAXPreviousContentsAttribute   kAXPreviousContentsAttribute
 
#define QAXProgressIndicatorRole   kAXProgressIndicatorRole
 
#define QAXRadioButtonRole   kAXRadioButtonRole
 
#define QAXRoleAttribute   kAXRoleAttribute
 
#define QAXRoleDescriptionAttribute   kAXRoleDescriptionAttribute
 
#define QAXRowRole   kAXRowRole
 
#define QAXRowsAttribute   kAXRowsAttribute
 
#define QAXScrollAreaRole   kAXScrollAreaRole
 
#define QAXScrollBarRole   kAXScrollBarRole
 
#define QAXSelectedAttribute   kAXSelectedAttribute
 
#define QAXSelectedChildrenAttribute   kAXSelectedChildrenAttribute
 
#define QAXSelectedRowsAttribute   kAXSelectedRowsAttribute
 
#define QAXSizeAttribute   kAXSizeAttribute
 
#define QAXSliderRole   kAXSliderRole
 
#define QAXSplitGroupRole   kAXSplitGroupRole
 
#define QAXSplitterRole   kAXSplitterRole
 
#define QAXSplittersAttribute   kAXSplittersAttribute
 
#define QAXStaticTextRole   kAXStaticTextRole
 
#define QAXSubroleAttribute   kAXSubroleAttribute
 
#define QAXTabGroupRole   kAXTabGroupRole
 
#define QAXTableRole   kAXTableRole
 
#define QAXTabsAttribute   kAXTabsAttribute
 
#define QAXTextFieldRole   kAXTextFieldRole
 
#define QAXTitleAttribute   kAXTitleAttribute
 
#define QAXTitleUIElementAttribute   kAXTitleUIElementAttribute
 
#define QAXToolbarButtonAttribute   kAXToolbarButtonAttribute
 
#define QAXToolbarRole   kAXToolbarRole
 
#define QAXTopLevelUIElementAttribute   kAXTopLevelUIElementAttribute
 
#define QAXUnknownRole   kAXUnknownRole
 
#define QAXValueAttribute   kAXValueAttribute
 
#define QAXValueChangedNotification   kAXValueChangedNotification
 
#define QAXValueIndicatorRole   kAXValueIndicatorRole
 
#define QAXVerticalOrientationValue   kAXVerticalOrientationValue
 
#define QAXVerticalScrollBarAttribute   kAXVerticalScrollBarAttribute
 
#define QAXVisibleRowsAttribute   kAXVisibleRowsAttribute
 
#define QAXWindowAttribute   kAXWindowAttribute
 
#define QAXWindowCreatedNotification   kAXWindowCreatedNotification
 
#define QAXWindowMovedNotification   kAXWindowMovedNotification
 
#define QAXWindowRole   kAXWindowRole
 
#define QAXZoomButtonAttribute   kAXZoomButtonAttribute
 

Typedefs

typedef CFStringRef const QAXRoleType
 

Functions

static OSStatus accessibilityEventHandler (EventHandlerCallRef next_ref, EventRef event, void *data)
 
static void appendIfSupported (CFMutableArrayRef array, CFStringRef attribute, const QAInterface &interface)
 
static OSStatus applicationEventHandler (EventHandlerCallRef next_ref, EventRef event, void *)
 
static int buttonValue (QAInterface element)
 
static QInterfaceFactorycreateFactory (const QAInterface &interface)
 
static AXUIElementRef getAccessibleObjectParameter (EventRef event)
 
static OSStatus getAllActionNames (EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
 
static OSStatus getAllAttributeNames (EventRef event, const QAInterface &interface, EventHandlerCallRef next_ref)
 
static OSStatus getChildAtPoint (EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
 
static OSStatus getNamedAttribute (EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
 
static QString getValue (const QAInterface &interface)
 
static OSStatus handleChildrenAttribute (EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
 
static OSStatus handleContentsAttribute (EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
 
static OSStatus handleOrientationAttribute (EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
 
static OSStatus handleParentAttribute (EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
 
static OSStatus handlePositionAttribute (EventHandlerCallRef, EventRef event, const QAInterface &interface)
 
static OSStatus handleRowsAttribute (EventHandlerCallRef, EventRef event, QAInterface &tableView)
 
static OSStatus handleScrollBarAttribute (EventHandlerCallRef next_ref, EventRef event, QAInterface &scrollArea, Qt::Orientation orientation)
 
static OSStatus handleSelectedRowsAttribute (EventHandlerCallRef, EventRef event, QAInterface &tableView)
 
static OSStatus handleSizeAttribute (EventHandlerCallRef, EventRef event, const QAInterface &interface)
 
static OSStatus handleSplitterContentsAttribute (EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface, QCFString nextOrPrev)
 
static OSStatus handleSplittersAttribute (EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
 
static void handleStringAttribute (EventRef event, QAccessible::Text text, const QAInterface &interface)
 
static OSStatus handleSubroleAttribute (EventHandlerCallRef, EventRef event, const QAInterface &interface)
 
static OSStatus handleTabsAttribute (EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
 
static OSStatus handleTopLevelUIElementAttribute (EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
 
static OSStatus handleVisibleRowsAttribute (EventHandlerCallRef, EventRef event, QAInterface &tableView)
 
static OSStatus handleWindowAttribute (EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
 
static bool isEmbeddedTabBar (const QAInterface &interface)
 
static bool isItemView (const QAInterface &interface)
 
bool isItInteresting (const QAInterface &interface)
 
static OSStatus isNamedAttributeSettable (EventRef event, const QAInterface &interface)
 
static bool isStandaloneTabBar (const QAInterface &interface)
 
static bool isTabWidget (const QAInterface &interface)
 
QList< QAElementlookup (const QList< QAInterface > &interfaces)
 
static CFStringRef macRole (const QAInterface &interface)
 
static bool managesChildren (const QAInterface &interface)
 
template<typename TestType >
OSStatus navigateAncestors (EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface, CFStringRef attribute)
 
QDebug operator<< (QDebug debug, const QAInterface &interface)
 
static OSStatus performNamedAction (EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
 
 Q_GLOBAL_STATIC (QAccessibleHierarchyManager, accessibleHierarchyManager)
 
uint qHash (const QAInterface &item)
 
uint qHash (QAElement element)
 
static bool qt_mac_append_cf_uniq (CFMutableArrayRef array, CFTypeRef value)
 
bool qt_mac_is_macdrawer (const QWidget *w)
 
bool qt_mac_is_macsheet (const QWidget *w)
 
static QAElement scrollAreaGetContents (const QAInterface &scrollArea)
 
static QAElement scrollAreaGetScrollBar (const QAInterface &scrollArea, Qt::Orientation orientation)
 
static QAInterface scrollAreaGetScrollBarInterface (const QAInterface &scrollArea, Qt::Orientation orientation)
 
static bool scrollAreaHasScrollBar (const QAInterface &scrollArea, Qt::Orientation orientation)
 
static Qt::Orientation scrollBarOrientation (const QAInterface &scrollBar)
 
static OSStatus setAttributeValue (EventRef event, const QList< QAElement > &elements)
 
static OSStatus setNamedAttribute (EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
 
static QCFString subrole (const QAInterface &interface)
 
static QList< QAccessible::ActionsupportedPredefinedActions (const QAInterface &interface)
 
static bool supportsAttribute (CFStringRef attribute, const QAInterface &interface)
 
static QList< QAElementtabBarGetTabs (const QAInterface &interface)
 
static QList< QAElementtabWidgetGetChildren (const QAInterface &interface)
 
static QAElement tabWidgetGetContents (const QAInterface &interface)
 
static QList< QAElementtabWidgetGetTabs (const QAInterface &interface)
 
static int textForRoleAndAttribute (QAccessible::Role role, CFStringRef attribute)
 
static QCFString translateAction (const QAccessible::Action action)
 
static QAccessible::Action translateAction (const CFStringRef actionName)
 

Variables

static QObjectrootObject = 0
 
struct QAccessibleTextBinding text_bindings [][10]
 

Macro Definition Documentation

◆ QAXApplicationRole

#define QAXApplicationRole   kAXApplicationRole

Definition at line 164 of file qaccessible_mac.mm.

◆ QAXButtonRole

#define QAXButtonRole   kAXButtonRole

Definition at line 165 of file qaccessible_mac.mm.

◆ QAXCancelAction

#define QAXCancelAction   kAXCancelAction

Definition at line 166 of file qaccessible_mac.mm.

Referenced by translateAction().

◆ QAXCheckBoxRole

#define QAXCheckBoxRole   kAXCheckBoxRole

Definition at line 167 of file qaccessible_mac.mm.

◆ QAXChildrenAttribute

#define QAXChildrenAttribute   kAXChildrenAttribute

Definition at line 168 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), getNamedAttribute(), and supportsAttribute().

◆ QAXCloseButtonAttribute

#define QAXCloseButtonAttribute   kAXCloseButtonAttribute

Definition at line 169 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXColumnRole

#define QAXColumnRole   kAXColumnRole

Definition at line 170 of file qaccessible_mac.mm.

◆ QAXConfirmAction

#define QAXConfirmAction   kAXConfirmAction

Definition at line 171 of file qaccessible_mac.mm.

Referenced by translateAction().

◆ QAXContentsAttribute

#define QAXContentsAttribute   kAXContentsAttribute

Definition at line 172 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXDecrementAction

#define QAXDecrementAction   kAXDecrementAction

Definition at line 173 of file qaccessible_mac.mm.

Referenced by translateAction().

◆ QAXDecrementArrowSubrole

#define QAXDecrementArrowSubrole   kAXDecrementArrowSubrole

Definition at line 174 of file qaccessible_mac.mm.

Referenced by subrole().

◆ QAXDecrementPageSubrole

#define QAXDecrementPageSubrole   kAXDecrementPageSubrole

Definition at line 175 of file qaccessible_mac.mm.

Referenced by subrole().

◆ QAXDescriptionAttribute

#define QAXDescriptionAttribute   kAXDescriptionAttribute

◆ QAXEnabledAttribute

#define QAXEnabledAttribute   kAXEnabledAttribute

Definition at line 177 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXExpandedAttribute

#define QAXExpandedAttribute   kAXExpandedAttribute

Definition at line 178 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

◆ QAXFocusedAttribute

#define QAXFocusedAttribute   kAXFocusedAttribute

◆ QAXFocusedUIElementChangedNotification

#define QAXFocusedUIElementChangedNotification   kAXFocusedUIElementChangedNotification

Definition at line 180 of file qaccessible_mac.mm.

Referenced by QAccessible::updateAccessibility().

◆ QAXFocusedWindowChangedNotification

#define QAXFocusedWindowChangedNotification   kAXFocusedWindowChangedNotification

Definition at line 181 of file qaccessible_mac.mm.

Referenced by QAccessible::updateAccessibility().

◆ QAXGroupRole

#define QAXGroupRole   kAXGroupRole

Definition at line 182 of file qaccessible_mac.mm.

◆ QAXGrowAreaAttribute

#define QAXGrowAreaAttribute   kAXGrowAreaAttribute

Definition at line 183 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXGrowAreaRole

#define QAXGrowAreaRole   kAXGrowAreaRole

Definition at line 184 of file qaccessible_mac.mm.

◆ QAXHelpAttribute

#define QAXHelpAttribute   kAXHelpAttribute

◆ QAXHorizontalOrientationValue

#define QAXHorizontalOrientationValue   kAXHorizontalOrientationValue

Definition at line 186 of file qaccessible_mac.mm.

Referenced by handleOrientationAttribute().

◆ QAXHorizontalScrollBarAttribute

#define QAXHorizontalScrollBarAttribute   kAXHorizontalScrollBarAttribute

Definition at line 187 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXIncrementAction

#define QAXIncrementAction   kAXIncrementAction

Definition at line 188 of file qaccessible_mac.mm.

Referenced by translateAction().

◆ QAXIncrementArrowSubrole

#define QAXIncrementArrowSubrole   kAXIncrementArrowSubrole

Definition at line 189 of file qaccessible_mac.mm.

Referenced by subrole().

◆ QAXIncrementorRole

#define QAXIncrementorRole   kAXIncrementorRole

Definition at line 191 of file qaccessible_mac.mm.

◆ QAXIncrementPageSubrole

#define QAXIncrementPageSubrole   kAXIncrementPageSubrole

Definition at line 190 of file qaccessible_mac.mm.

Referenced by subrole().

◆ QAXLinkedUIElementsAttribute

#define QAXLinkedUIElementsAttribute   kAXLinkedUIElementsAttribute

Definition at line 192 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXListRole

#define QAXListRole   kAXListRole

Definition at line 193 of file qaccessible_mac.mm.

◆ QAXMainAttribute

#define QAXMainAttribute   kAXMainAttribute

Definition at line 194 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames().

◆ QAXMaxValueAttribute

#define QAXMaxValueAttribute   kAXMaxValueAttribute

Definition at line 195 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXMenuBarRole

#define QAXMenuBarRole   kAXMenuBarRole

Definition at line 196 of file qaccessible_mac.mm.

◆ QAXMenuButtonRole

#define QAXMenuButtonRole   kAXMenuButtonRole

Definition at line 197 of file qaccessible_mac.mm.

◆ QAXMenuClosedNotification

#define QAXMenuClosedNotification   kAXMenuClosedNotification

Definition at line 198 of file qaccessible_mac.mm.

Referenced by QAccessible::updateAccessibility().

◆ QAXMenuItemRole

#define QAXMenuItemRole   kAXMenuItemRole

Definition at line 199 of file qaccessible_mac.mm.

◆ QAXMenuOpenedNotification

#define QAXMenuOpenedNotification   kAXMenuOpenedNotification

Definition at line 200 of file qaccessible_mac.mm.

Referenced by QAccessible::updateAccessibility().

◆ QAXMenuRole

#define QAXMenuRole   kAXMenuRole

Definition at line 201 of file qaccessible_mac.mm.

◆ QAXMinimizeButtonAttribute

#define QAXMinimizeButtonAttribute   kAXMinimizeButtonAttribute

Definition at line 203 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXMinimizedAttribute

#define QAXMinimizedAttribute   kAXMinimizedAttribute

Definition at line 204 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXMinValueAttribute

#define QAXMinValueAttribute   kAXMinValueAttribute

Definition at line 202 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXNextContentsAttribute

#define QAXNextContentsAttribute   kAXNextContentsAttribute

Definition at line 205 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXOrientationAttribute

#define QAXOrientationAttribute   kAXOrientationAttribute

Definition at line 206 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXParentAttribute

#define QAXParentAttribute   kAXParentAttribute

Definition at line 207 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

◆ QAXPickAction

#define QAXPickAction   kAXPickAction

Definition at line 208 of file qaccessible_mac.mm.

Referenced by translateAction().

◆ QAXPopUpButtonRole

#define QAXPopUpButtonRole   kAXPopUpButtonRole

Definition at line 209 of file qaccessible_mac.mm.

◆ QAXPositionAttribute

#define QAXPositionAttribute   kAXPositionAttribute

Definition at line 210 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXPressAction

#define QAXPressAction   kAXPressAction

Definition at line 211 of file qaccessible_mac.mm.

Referenced by translateAction().

◆ QAXPreviousContentsAttribute

#define QAXPreviousContentsAttribute   kAXPreviousContentsAttribute

◆ QAXProgressIndicatorRole

#define QAXProgressIndicatorRole   kAXProgressIndicatorRole

Definition at line 213 of file qaccessible_mac.mm.

◆ QAXRadioButtonRole

#define QAXRadioButtonRole   kAXRadioButtonRole

Definition at line 214 of file qaccessible_mac.mm.

◆ QAXRoleAttribute

#define QAXRoleAttribute   kAXRoleAttribute

Definition at line 215 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXRoleDescriptionAttribute

#define QAXRoleDescriptionAttribute   kAXRoleDescriptionAttribute

Definition at line 216 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

◆ QAXRowRole

#define QAXRowRole   kAXRowRole

Definition at line 217 of file qaccessible_mac.mm.

◆ QAXRowsAttribute

#define QAXRowsAttribute   kAXRowsAttribute

Definition at line 218 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXScrollAreaRole

#define QAXScrollAreaRole   kAXScrollAreaRole

◆ QAXScrollBarRole

#define QAXScrollBarRole   kAXScrollBarRole

Definition at line 220 of file qaccessible_mac.mm.

◆ QAXSelectedAttribute

#define QAXSelectedAttribute   kAXSelectedAttribute

Definition at line 221 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

◆ QAXSelectedChildrenAttribute

#define QAXSelectedChildrenAttribute   kAXSelectedChildrenAttribute

Definition at line 222 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

◆ QAXSelectedRowsAttribute

#define QAXSelectedRowsAttribute   kAXSelectedRowsAttribute

Definition at line 223 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXSizeAttribute

#define QAXSizeAttribute   kAXSizeAttribute

Definition at line 224 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXSliderRole

#define QAXSliderRole   kAXSliderRole

Definition at line 225 of file qaccessible_mac.mm.

◆ QAXSplitGroupRole

#define QAXSplitGroupRole   kAXSplitGroupRole

Definition at line 226 of file qaccessible_mac.mm.

◆ QAXSplitterRole

#define QAXSplitterRole   kAXSplitterRole

Definition at line 227 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and macRole().

◆ QAXSplittersAttribute

#define QAXSplittersAttribute   kAXSplittersAttribute

Definition at line 228 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXStaticTextRole

#define QAXStaticTextRole   kAXStaticTextRole

Definition at line 229 of file qaccessible_mac.mm.

◆ QAXSubroleAttribute

#define QAXSubroleAttribute   kAXSubroleAttribute

Definition at line 230 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), getNamedAttribute(), and supportsAttribute().

◆ QAXTabGroupRole

#define QAXTabGroupRole   kAXTabGroupRole

Definition at line 231 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames().

◆ QAXTableRole

#define QAXTableRole   kAXTableRole

Definition at line 232 of file qaccessible_mac.mm.

◆ QAXTabsAttribute

#define QAXTabsAttribute   kAXTabsAttribute

Definition at line 233 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXTextFieldRole

#define QAXTextFieldRole   kAXTextFieldRole

Definition at line 234 of file qaccessible_mac.mm.

◆ QAXTitleAttribute

#define QAXTitleAttribute   kAXTitleAttribute

◆ QAXTitleUIElementAttribute

#define QAXTitleUIElementAttribute   kAXTitleUIElementAttribute

Definition at line 236 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames().

◆ QAXToolbarButtonAttribute

#define QAXToolbarButtonAttribute   kAXToolbarButtonAttribute

Definition at line 237 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXToolbarRole

#define QAXToolbarRole   kAXToolbarRole

Definition at line 238 of file qaccessible_mac.mm.

◆ QAXTopLevelUIElementAttribute

#define QAXTopLevelUIElementAttribute   kAXTopLevelUIElementAttribute

◆ QAXUnknownRole

#define QAXUnknownRole   kAXUnknownRole

Definition at line 240 of file qaccessible_mac.mm.

Referenced by isItInteresting(), and macRole().

◆ QAXValueAttribute

#define QAXValueAttribute   kAXValueAttribute

◆ QAXValueChangedNotification

#define QAXValueChangedNotification   kAXValueChangedNotification

Definition at line 242 of file qaccessible_mac.mm.

Referenced by QAccessible::updateAccessibility().

◆ QAXValueIndicatorRole

#define QAXValueIndicatorRole   kAXValueIndicatorRole

Definition at line 243 of file qaccessible_mac.mm.

◆ QAXVerticalOrientationValue

#define QAXVerticalOrientationValue   kAXVerticalOrientationValue

Definition at line 244 of file qaccessible_mac.mm.

Referenced by handleOrientationAttribute().

◆ QAXVerticalScrollBarAttribute

#define QAXVerticalScrollBarAttribute   kAXVerticalScrollBarAttribute

Definition at line 245 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXVisibleRowsAttribute

#define QAXVisibleRowsAttribute   kAXVisibleRowsAttribute

Definition at line 246 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

◆ QAXWindowAttribute

#define QAXWindowAttribute   kAXWindowAttribute

◆ QAXWindowCreatedNotification

#define QAXWindowCreatedNotification   kAXWindowCreatedNotification

Definition at line 248 of file qaccessible_mac.mm.

Referenced by QAccessible::updateAccessibility().

◆ QAXWindowMovedNotification

#define QAXWindowMovedNotification   kAXWindowMovedNotification

Definition at line 249 of file qaccessible_mac.mm.

Referenced by QAccessible::updateAccessibility().

◆ QAXWindowRole

#define QAXWindowRole   kAXWindowRole

Definition at line 250 of file qaccessible_mac.mm.

◆ QAXZoomButtonAttribute

#define QAXZoomButtonAttribute   kAXZoomButtonAttribute

Definition at line 251 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), and getNamedAttribute().

Typedef Documentation

◆ QAXRoleType

typedef CFStringRef const QAXRoleType

Definition at line 163 of file qaccessible_mac.mm.

Function Documentation

◆ accessibilityEventHandler()

static OSStatus accessibilityEventHandler ( EventHandlerCallRef  next_ref,
EventRef  event,
void *  data 
)
static

Definition at line 2288 of file qaccessible_mac.mm.

2289 {
2290  Q_UNUSED(data)
2291 
2292  // Return if this event is not a AccessibleGetNamedAttribute event.
2293  const UInt32 eclass = GetEventClass(event);
2294  if (eclass != kEventClassAccessibility)
2295  return eventNotHandledErr;
2296 
2297  // Get the AXUIElementRef and QAInterface pointer
2298  AXUIElementRef element = 0;
2299  GetEventParameter(event, kEventParamAccessibleObject, typeCFTypeRef, 0, sizeof(element), 0, &element);
2300  QAInterface interface = accessibleHierarchyManager()->lookup(element);
2301  if (interface.isValid() == false)
2302  return eventNotHandledErr;
2303 
2304  const UInt32 ekind = GetEventKind(event);
2305  OSStatus status = noErr;
2306  switch (ekind) {
2307  case kEventAccessibleGetAllAttributeNames:
2308  status = getAllAttributeNames(event, interface, next_ref);
2309  break;
2310  case kEventAccessibleGetNamedAttribute:
2311  status = getNamedAttribute(next_ref, event, interface);
2312  break;
2313  case kEventAccessibleIsNamedAttributeSettable:
2314  status = isNamedAttributeSettable(event, interface);
2315  break;
2316  case kEventAccessibleGetChildAtPoint:
2317  status = getChildAtPoint(next_ref, event, interface);
2318  break;
2319  case kEventAccessibleGetAllActionNames:
2320  status = getAllActionNames(next_ref, event, interface);
2321  break;
2322  case kEventAccessibleGetFocusedChild:
2323  status = CallNextEventHandler(next_ref, event);
2324  break;
2325  case kEventAccessibleSetNamedAttribute:
2326  status = setNamedAttribute(next_ref, event, interface);
2327  break;
2328  case kEventAccessiblePerformNamedAction:
2329  status = performNamedAction(next_ref, event, interface);
2330  break;
2331  default:
2332  status = CallNextEventHandler(next_ref, event);
2333  break;
2334  };
2335  return status;
2336 }
EventRef event
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
static OSStatus getAllActionNames(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
static OSStatus setNamedAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
static OSStatus isNamedAttributeSettable(EventRef event, const QAInterface &interface)
static OSStatus getChildAtPoint(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
static const char * data(const QByteArray &arr)
static OSStatus getAllAttributeNames(EventRef event, const QAInterface &interface, EventHandlerCallRef next_ref)
signed long OSStatus
static OSStatus performNamedAction(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
QList< QAElement > lookup(const QList< QAInterface > &interfaces)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
static OSStatus getNamedAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)

◆ appendIfSupported()

static void appendIfSupported ( CFMutableArrayRef  array,
CFStringRef  attribute,
const QAInterface interface 
)
static

Definition at line 1410 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames().

1411 {
1412  if (supportsAttribute(attribute, interface))
1413  qt_mac_append_cf_uniq(array, attribute);
1414 }
static bool supportsAttribute(CFStringRef attribute, const QAInterface &interface)
static bool qt_mac_append_cf_uniq(CFMutableArrayRef array, CFTypeRef value)

◆ applicationEventHandler()

static OSStatus applicationEventHandler ( EventHandlerCallRef  next_ref,
EventRef  event,
void *   
)
static

Definition at line 1110 of file qaccessible_mac.mm.

1111 {
1113  accessibleHierarchyManager()->registerChildren(rootInterface);
1114 
1115  return CallNextEventHandler(next_ref, event);
1116 }
EventRef event
static QObject * rootObject
#define qApp
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...

◆ buttonValue()

static int buttonValue ( QAInterface  element)
static

Definition at line 1127 of file qaccessible_mac.mm.

Referenced by getNamedAttribute(), and getValue().

1128 {
1129  const QAccessible::State state = element.state();
1130  if (state & QAccessible::Mixed)
1131  return 2;
1132  else if(state & QAccessible::Checked)
1133  return 1;
1134  else
1135  return 0;
1136 }
State state() const
State
Definition: qaudio.h:59

◆ createFactory()

static QInterfaceFactory * createFactory ( const QAInterface interface)
static

Definition at line 1022 of file qaccessible_mac.mm.

Referenced by qHash(), and QAccessibleHierarchyManager::registerInterface().

1023 {
1024  if (isItemView(interface)) {
1025  return new QItemViewInterfaceFactory(interface);
1026  } if (managesChildren(interface)) {
1027  return new QMultipleHIObjectFactory(interface);
1028  }
1029 
1030  return new QStandardInterfaceFactory(interface);
1031 }
static bool isItemView(const QAInterface &interface)
static bool managesChildren(const QAInterface &interface)

◆ getAccessibleObjectParameter()

static AXUIElementRef getAccessibleObjectParameter ( EventRef  event)
inlinestatic

Definition at line 1097 of file qaccessible_mac.mm.

1098 {
1099  AXUIElementRef element;
1100  GetEventParameter(event, kEventParamAccessibleObject, typeCFTypeRef, 0,
1101  sizeof(element), 0, &element);
1102  return element;
1103 }
EventRef event

◆ getAllActionNames()

static OSStatus getAllActionNames ( EventHandlerCallRef  next_ref,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 2181 of file qaccessible_mac.mm.

Referenced by accessibilityEventHandler().

2182 {
2183  Q_UNUSED(next_ref);
2184 
2185  CFMutableArrayRef actions = 0;
2186  GetEventParameter(event, kEventParamAccessibleActionNames, typeCFMutableArrayRef, 0,
2187  sizeof(actions), 0, &actions);
2188 
2189  // Add supported predefined actions.
2190  const QList<QAccessible::Action> predefinedActions = supportedPredefinedActions(interface);
2191  for (int i = 0; i < predefinedActions.count(); ++i) {
2192  const QCFString action = translateAction(predefinedActions.at(i));
2193  if (action != QCFString())
2194  qt_mac_append_cf_uniq(actions, action);
2195  }
2196 
2197  // Add user actions
2198  const int actionCount = interface.userActionCount();
2199  for (int i = 0; i < actionCount; ++i) {
2200  const QString actionName = interface.actionText(i, QAccessible::Name);
2201  qt_mac_append_cf_uniq(actions, QCFString::toCFStringRef(actionName));
2202  }
2203 
2204  return noErr;
2205 }
static QCFString translateAction(const QAccessible::Action action)
EventRef event
static CFStringRef toCFStringRef(const QString &str)
Definition: qcore_mac.cpp:69
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QString class provides a Unicode character string.
Definition: qstring.h:83
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QString actionText(int action, Text text) const
static QList< QAccessible::Action > supportedPredefinedActions(const QAInterface &interface)
int userActionCount() const
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
static bool qt_mac_append_cf_uniq(CFMutableArrayRef array, CFTypeRef value)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ getAllAttributeNames()

static OSStatus getAllAttributeNames ( EventRef  event,
const QAInterface interface,
EventHandlerCallRef  next_ref 
)
static

Definition at line 1419 of file qaccessible_mac.mm.

Referenced by accessibilityEventHandler().

1420 {
1421  // Call system event handler.
1422  OSStatus err = CallNextEventHandler(next_ref, event);
1423  if(err != noErr && err != eventNotHandledErr)
1424  return err;
1425  CFMutableArrayRef attrs = 0;
1426  GetEventParameter(event, kEventParamAccessibleAttributeNames, typeCFMutableArrayRef, 0,
1427  sizeof(attrs), 0, &attrs);
1428 
1429  if (!attrs)
1430  return eventNotHandledErr;
1431 
1432  // Append attribute names that are always supported.
1439 
1440  // Append these names if the QInterafceItem returns any data for them.
1441  appendIfSupported(attrs, CFStringRef(QAXTitleAttribute), interface);
1442  appendIfSupported(attrs, CFStringRef(QAXValueAttribute), interface);
1445  appendIfSupported(attrs, CFStringRef(QAXHelpAttribute), interface);
1449 
1450  // Append attribute names based on the interaface role.
1451  switch (interface.role()) {
1452  case QAccessible::Window:
1460  break;
1462  case QAccessible::CheckBox:
1465  break;
1468  break;
1469  case QAccessible::Splitter:
1471  break;
1472  case QAccessible::Table:
1476  break;
1477  default:
1478  break;
1479  }
1480 
1481  // Append attribute names based on the mac accessibility role.
1482  const QCFString mac_role = macRole(interface);
1483  if (mac_role == CFStringRef(QAXSplitterRole)) {
1487  } else if (mac_role == CFStringRef(QAXScrollAreaRole)) {
1488  if (scrollAreaHasScrollBar(interface, Qt::Horizontal))
1490  if (scrollAreaHasScrollBar(interface, Qt::Vertical))
1493  } else if (mac_role == CFStringRef(QAXTabGroupRole)) {
1495  // Only tab widgets can have the contents attribute, there is no way of getting
1496  // the contents from a QTabBar.
1497  if (isTabWidget(interface))
1499  }
1500 
1501  return noErr;
1502 }
static void appendIfSupported(CFMutableArrayRef array, CFStringRef attribute, const QAInterface &interface)
const struct __CFString * CFStringRef
#define QAXSplitterRole
EventRef event
#define QAXTitleAttribute
#define QAXOrientationAttribute
#define QAXTabGroupRole
#define QAXSplittersAttribute
#define QAXMainAttribute
#define QAXVerticalScrollBarAttribute
#define QAXContentsAttribute
#define QAXRoleAttribute
#define QAXTopLevelUIElementAttribute
#define QAXSelectedRowsAttribute
#define QAXCloseButtonAttribute
#define QAXSubroleAttribute
#define QAXZoomButtonAttribute
#define QAXChildrenAttribute
#define QAXHorizontalScrollBarAttribute
#define QAXNextContentsAttribute
signed long OSStatus
#define QAXLinkedUIElementsAttribute
#define QAXSizeAttribute
#define QAXToolbarButtonAttribute
#define QAXMinimizedAttribute
Role role() const
#define QAXPreviousContentsAttribute
#define QAXRowsAttribute
#define QAXHelpAttribute
#define QAXGrowAreaAttribute
#define QAXVisibleRowsAttribute
static CFStringRef macRole(const QAInterface &interface)
#define QAXScrollAreaRole
#define QAXWindowAttribute
static bool scrollAreaHasScrollBar(const QAInterface &scrollArea, Qt::Orientation orientation)
#define QAXPositionAttribute
#define QAXValueAttribute
#define QAXMaxValueAttribute
#define QAXEnabledAttribute
#define QAXDescriptionAttribute
#define QAXTabsAttribute
#define QAXTitleUIElementAttribute
static bool qt_mac_append_cf_uniq(CFMutableArrayRef array, CFTypeRef value)
static bool isTabWidget(const QAInterface &interface)
#define QAXMinimizeButtonAttribute
#define QAXMinValueAttribute

◆ getChildAtPoint()

static OSStatus getChildAtPoint ( EventHandlerCallRef  next_ref,
EventRef  event,
QAInterface interface 
)
static

Definition at line 2076 of file qaccessible_mac.mm.

Referenced by accessibilityEventHandler().

2077 {
2078  Q_UNUSED(next_ref);
2079  if (interface.isValid() == false)
2080  return eventNotHandledErr;
2081 
2082  // Add the children for this interface to the global QAccessibelHierachyManager.
2083  accessibleHierarchyManager()->registerChildren(interface);
2084 
2085  Point where;
2086  GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, 0, sizeof(where), 0, &where);
2087  const QAInterface childInterface = interface.childAt(where.h, where.v);
2088 
2089  if (childInterface.isValid() == false || childInterface == interface)
2090  return eventNotHandledErr;
2091 
2092  const QAElement element = accessibleHierarchyManager()->lookup(childInterface);
2093  if (element.isValid() == false)
2094  return eventNotHandledErr;
2095 
2096  AXUIElementRef elementRef = element.element();
2097  CFRetain(elementRef);
2098  SetEventParameter(event, kEventParamAccessibleChild, typeCFTypeRef,
2099  sizeof(elementRef), &elementRef);
2100 
2101  return noErr;
2102 }
EventRef event
bool isValid() const
QAInterface childAt(int x, int y) const
bool isValid() const
AXUIElementRef element() const
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ getNamedAttribute()

static OSStatus getNamedAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
QAInterface interface 
)
static

Definition at line 1870 of file qaccessible_mac.mm.

Referenced by accessibilityEventHandler().

1871 {
1872  CFStringRef var;
1873  GetEventParameter(event, kEventParamAccessibleAttributeName, typeCFStringRef, 0,
1874  sizeof(var), 0, &var);
1875 
1876  if (CFStringCompare(var, CFStringRef(QAXChildrenAttribute), 0) == kCFCompareEqualTo) {
1877  return handleChildrenAttribute(next_ref, event, interface);
1878  } else if(CFStringCompare(var, CFStringRef(QAXTopLevelUIElementAttribute), 0) == kCFCompareEqualTo) {
1879  return handleTopLevelUIElementAttribute(next_ref, event, interface);
1880  } else if(CFStringCompare(var, CFStringRef(QAXWindowAttribute), 0) == kCFCompareEqualTo) {
1881  return handleWindowAttribute(next_ref, event, interface);
1882  } else if(CFStringCompare(var, CFStringRef(QAXParentAttribute), 0) == kCFCompareEqualTo) {
1883  return handleParentAttribute(next_ref, event, interface);
1884  } else if (CFStringCompare(var, CFStringRef(QAXPositionAttribute), 0) == kCFCompareEqualTo) {
1885  return handlePositionAttribute(next_ref, event, interface);
1886  } else if (CFStringCompare(var, CFStringRef(QAXSizeAttribute), 0) == kCFCompareEqualTo) {
1887  return handleSizeAttribute(next_ref, event, interface);
1888  } else if (CFStringCompare(var, CFStringRef(QAXRoleAttribute), 0) == kCFCompareEqualTo) {
1889  CFStringRef role = macRole(interface);
1890 // ###
1891 // QWidget * const widget = qobject_cast<QWidget *>(interface.object());
1892 // if (role == CFStringRef(QAXUnknownRole) && widget && widget->isWindow())
1893 // role = CFStringRef(QAXWindowRole);
1894 
1895  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef,
1896  sizeof(role), &role);
1897 
1898  } else if (CFStringCompare(var, CFStringRef(QAXEnabledAttribute), 0) == kCFCompareEqualTo) {
1899  Boolean val = !((interface.state() & QAccessible::Unavailable))
1900  && !((interface.state() & QAccessible::Invisible));
1901  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1902  sizeof(val), &val);
1903  } else if (CFStringCompare(var, CFStringRef(QAXExpandedAttribute), 0) == kCFCompareEqualTo) {
1904  Boolean val = (interface.state() & QAccessible::Expanded);
1905  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1906  sizeof(val), &val);
1907  } else if (CFStringCompare(var, CFStringRef(QAXSelectedAttribute), 0) == kCFCompareEqualTo) {
1908  Boolean val = (interface.state() & QAccessible::Selection);
1909  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1910  sizeof(val), &val);
1911  } else if (CFStringCompare(var, CFStringRef(QAXFocusedAttribute), 0) == kCFCompareEqualTo) {
1912  Boolean val = (interface.state() & QAccessible::Focus);
1913  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1914  sizeof(val), &val);
1915  } else if (CFStringCompare(var, CFStringRef(QAXSelectedChildrenAttribute), 0) == kCFCompareEqualTo) {
1916  const int cc = interface.childCount();
1917  QList<QAElement> selected;
1918  for (int i = 1; i <= cc; ++i) {
1919  const QAInterface child_iface = interface.navigate(QAccessible::Child, i);
1920  if (child_iface.isValid() && child_iface.state() & QAccessible::Selected)
1921  selected.append(accessibleHierarchyManager()->lookup(child_iface));
1922  }
1923 
1924  return setAttributeValue(event, selected);
1925 
1926  } else if (CFStringCompare(var, CFStringRef(QAXCloseButtonAttribute), 0) == kCFCompareEqualTo) {
1927  if(interface.object() && interface.object()->isWidgetType()) {
1928  Boolean val = true; //do we want to add a WState for this?
1929  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1930  sizeof(val), &val);
1931  }
1932  } else if (CFStringCompare(var, CFStringRef(QAXZoomButtonAttribute), 0) == kCFCompareEqualTo) {
1933  if(interface.object() && interface.object()->isWidgetType()) {
1934  QWidget *widget = (QWidget*)interface.object();
1935  Boolean val = (widget->windowFlags() & Qt::WindowMaximizeButtonHint);
1936  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1937  sizeof(val), &val);
1938  }
1939  } else if (CFStringCompare(var, CFStringRef(QAXMinimizeButtonAttribute), 0) == kCFCompareEqualTo) {
1940  if(interface.object() && interface.object()->isWidgetType()) {
1941  QWidget *widget = (QWidget*)interface.object();
1942  Boolean val = (widget->windowFlags() & Qt::WindowMinimizeButtonHint);
1943  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1944  sizeof(val), &val);
1945  }
1946  } else if (CFStringCompare(var, CFStringRef(QAXToolbarButtonAttribute), 0) == kCFCompareEqualTo) {
1947  if(interface.object() && interface.object()->isWidgetType()) {
1948  QWidget *widget = (QWidget*)interface.object();
1949  Boolean val = qobject_cast<QMainWindow *>(widget) != 0;
1950  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1951  sizeof(val), &val);
1952  }
1953  } else if (CFStringCompare(var, CFStringRef(QAXGrowAreaAttribute), 0) == kCFCompareEqualTo) {
1954  if(interface.object() && interface.object()->isWidgetType()) {
1955  Boolean val = true; //do we want to add a WState for this?
1956  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1957  sizeof(val), &val);
1958  }
1959  } else if (CFStringCompare(var, CFStringRef(QAXMinimizedAttribute), 0) == kCFCompareEqualTo) {
1960  if (interface.object() && interface.object()->isWidgetType()) {
1961  QWidget *widget = (QWidget*)interface.object();
1962  Boolean val = (widget->windowState() & Qt::WindowMinimized);
1963  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
1964  sizeof(val), &val);
1965  }
1966  } else if (CFStringCompare(var, CFStringRef(QAXSubroleAttribute), 0) == kCFCompareEqualTo) {
1967  return handleSubroleAttribute(next_ref, event, interface);
1968  } else if (CFStringCompare(var, CFStringRef(QAXRoleDescriptionAttribute), 0) == kCFCompareEqualTo) {
1969 #if !defined(QT_MAC_USE_COCOA)
1970  if (HICopyAccessibilityRoleDescription) {
1971  const CFStringRef roleDescription = HICopyAccessibilityRoleDescription(macRole(interface), 0);
1972  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef,
1973  sizeof(roleDescription), &roleDescription);
1974  } else
1975 #endif
1976  {
1977  // Just use Qt::Description on 10.3
1979  }
1980  } else if (CFStringCompare(var, CFStringRef(QAXTitleAttribute), 0) == kCFCompareEqualTo) {
1981  const QAccessible::Role role = interface.role();
1983  handleStringAttribute(event, text, interface);
1984  } else if (CFStringCompare(var, CFStringRef(QAXValueAttribute), 0) == kCFCompareEqualTo) {
1985  const QAccessible::Role role = interface.role();
1987  if (role == QAccessible::CheckBox || role == QAccessible::RadioButton) {
1988  int value = buttonValue(interface);
1989  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeUInt32, sizeof(value), &value);
1990  } else {
1991  handleStringAttribute(event, text, interface);
1992  }
1993  } else if (CFStringCompare(var, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo) {
1994  const QAccessible::Role role = interface.role();
1996  handleStringAttribute(event, text, interface);
1997  } else if (CFStringCompare(var, CFStringRef(QAXLinkedUIElementsAttribute), 0) == kCFCompareEqualTo) {
1998  return CallNextEventHandler(next_ref, event);
1999  } else if (CFStringCompare(var, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo) {
2000  const QAccessible::Role role = interface.role();
2002  handleStringAttribute(event, text, interface);
2003  } else if (CFStringCompare(var, kAXTitleUIElementAttribute, 0) == kCFCompareEqualTo) {
2004  return CallNextEventHandler(next_ref, event);
2005  } else if (CFStringCompare(var, CFStringRef(QAXTabsAttribute), 0) == kCFCompareEqualTo) {
2006  return handleTabsAttribute(next_ref, event, interface);
2007  } else if (CFStringCompare(var, CFStringRef(QAXMinValueAttribute), 0) == kCFCompareEqualTo) {
2008  // tabs we first go to the tab bar which is child #2.
2009  QAInterface tabBarInterface = interface.childAt(2);
2010  return handleTabsAttribute(next_ref, event, tabBarInterface);
2011  } else if (CFStringCompare(var, CFStringRef(QAXMinValueAttribute), 0) == kCFCompareEqualTo) {
2012  if (interface.role() == QAccessible::RadioButton || interface.role() == QAccessible::CheckBox) {
2013  uint value = 0;
2014  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeUInt32, sizeof(value), &value);
2015  } else {
2016  return CallNextEventHandler(next_ref, event);
2017  }
2018  } else if (CFStringCompare(var, CFStringRef(QAXMaxValueAttribute), 0) == kCFCompareEqualTo) {
2019  if (interface.role() == QAccessible::RadioButton || interface.role() == QAccessible::CheckBox) {
2020  uint value = 2;
2021  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeUInt32, sizeof(value), &value);
2022  } else {
2023  return CallNextEventHandler(next_ref, event);
2024  }
2025  } else if (CFStringCompare(var, CFStringRef(QAXOrientationAttribute), 0) == kCFCompareEqualTo) {
2026  return handleOrientationAttribute(next_ref, event, interface);
2027  } else if (CFStringCompare(var, CFStringRef(QAXPreviousContentsAttribute), 0) == kCFCompareEqualTo) {
2029  } else if (CFStringCompare(var, CFStringRef(QAXNextContentsAttribute), 0) == kCFCompareEqualTo) {
2031  } else if (CFStringCompare(var, CFStringRef(QAXSplittersAttribute), 0) == kCFCompareEqualTo) {
2032  return handleSplittersAttribute(next_ref, event, interface);
2033  } else if (CFStringCompare(var, CFStringRef(QAXHorizontalScrollBarAttribute), 0) == kCFCompareEqualTo) {
2034  return handleScrollBarAttribute(next_ref, event, interface, Qt::Horizontal);
2035  } else if (CFStringCompare(var, CFStringRef(QAXVerticalScrollBarAttribute), 0) == kCFCompareEqualTo) {
2036  return handleScrollBarAttribute(next_ref, event, interface, Qt::Vertical);
2037  } else if (CFStringCompare(var, CFStringRef(QAXContentsAttribute), 0) == kCFCompareEqualTo) {
2038  return handleContentsAttribute(next_ref, event, interface);
2039  } else if (CFStringCompare(var, CFStringRef(QAXRowsAttribute), 0) == kCFCompareEqualTo) {
2040  return handleRowsAttribute(next_ref, event, interface);
2041  } else if (CFStringCompare(var, CFStringRef(QAXVisibleRowsAttribute), 0) == kCFCompareEqualTo) {
2042  return handleVisibleRowsAttribute(next_ref, event, interface);
2043  } else if (CFStringCompare(var, CFStringRef(QAXSelectedRowsAttribute), 0) == kCFCompareEqualTo) {
2044  return handleSelectedRowsAttribute(next_ref, event, interface);
2045  } else {
2046  return CallNextEventHandler(next_ref, event);
2047  }
2048  return noErr;
2049 }
#define QAXExpandedAttribute
const struct __CFString * CFStringRef
static OSStatus handleTabsAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
static void handleStringAttribute(EventRef event, QAccessible::Text text, const QAInterface &interface)
static OSStatus handleTopLevelUIElementAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
static OSStatus handleSubroleAttribute(EventHandlerCallRef, EventRef event, const QAInterface &interface)
#define QAXSelectedAttribute
EventRef event
QPointer< QWidget > widget
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
#define QAXTitleAttribute
#define QAXRoleDescriptionAttribute
#define QAXOrientationAttribute
static OSStatus handleVisibleRowsAttribute(EventHandlerCallRef, EventRef event, QAInterface &tableView)
QAInterface navigate(RelationFlag relation, int entry) const
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define QAXSplittersAttribute
QAInterface childAt(int x, int y) const
#define QAXVerticalScrollBarAttribute
static OSStatus handleContentsAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
bool isValid() const
T * qobject_cast(QObject *object)
Definition: qobject.h:375
#define QAXContentsAttribute
#define QAXRoleAttribute
static OSStatus handleSizeAttribute(EventHandlerCallRef, EventRef event, const QAInterface &interface)
#define QAXSelectedChildrenAttribute
static OSStatus handleOrientationAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
static OSStatus handleParentAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
#define QAXTopLevelUIElementAttribute
#define QAXSelectedRowsAttribute
#define QAXCloseButtonAttribute
#define QAXSubroleAttribute
static OSStatus handleRowsAttribute(EventHandlerCallRef, EventRef event, QAInterface &tableView)
#define QAXZoomButtonAttribute
unsigned int uint
Definition: qglobal.h:996
static OSStatus setAttributeValue(EventRef event, const QList< QAElement > &elements)
#define QAXChildrenAttribute
#define QAXHorizontalScrollBarAttribute
#define QAXNextContentsAttribute
static int buttonValue(QAInterface element)
#define QAXLinkedUIElementsAttribute
State state() const
#define QAXSizeAttribute
int childCount() const
#define QAXToolbarButtonAttribute
static int textForRoleAndAttribute(QAccessible::Role role, CFStringRef attribute)
#define QAXFocusedAttribute
QObject * object() const
#define QAXMinimizedAttribute
Role role() const
#define QAXPreviousContentsAttribute
#define QAXRowsAttribute
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
Definition: qobject.h:146
#define QAXHelpAttribute
#define QAXGrowAreaAttribute
#define QAXVisibleRowsAttribute
static CFStringRef macRole(const QAInterface &interface)
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63
#define QAXWindowAttribute
static OSStatus handlePositionAttribute(EventHandlerCallRef, EventRef event, const QAInterface &interface)
#define QAXParentAttribute
static OSStatus handleChildrenAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
#define QAXPositionAttribute
static OSStatus handleSplittersAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
#define QAXValueAttribute
QList< QAElement > lookup(const QList< QAInterface > &interfaces)
#define QAXMaxValueAttribute
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
Text
This enum specifies string information that an accessible object returns.
Definition: qaccessible.h:259
#define QAXEnabledAttribute
#define QAXDescriptionAttribute
#define QAXTabsAttribute
static OSStatus handleSplitterContentsAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface, QCFString nextOrPrev)
static OSStatus handleScrollBarAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &scrollArea, Qt::Orientation orientation)
#define text
Definition: qobjectdefs.h:80
#define QAXMinimizeButtonAttribute
#define QAXMinValueAttribute
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
static OSStatus handleSelectedRowsAttribute(EventHandlerCallRef, EventRef event, QAInterface &tableView)
static OSStatus handleWindowAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)

◆ getValue()

static QString getValue ( const QAInterface interface)
static

Definition at line 1138 of file qaccessible_mac.mm.

Referenced by supportsAttribute().

1139 {
1140  const QAccessible::Role role = interface.role();
1141  if (role == QAccessible::RadioButton || role == QAccessible::CheckBox)
1142  return QString::number(buttonValue(interface));
1143  else
1144  return interface.text(QAccessible::Value);
1145 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
static int buttonValue(QAInterface element)
Role role() const
QString text(Text text) const

◆ handleChildrenAttribute()

static OSStatus handleChildrenAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
QAInterface interface 
)
static

Definition at line 1526 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1527 {
1528  // Add the children for this interface to the global QAccessibelHierachyManager.
1529  accessibleHierarchyManager()->registerChildren(interface);
1530 
1531  if (isTabWidget(interface)) {
1532  QList<QAElement> children = tabWidgetGetChildren(interface);
1533  const int childCount = children.count();
1534 
1535  CFMutableArrayRef array = 0;
1536  array = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
1537  for (int i = 0; i < childCount; ++i) {
1538  qt_mac_append_cf_uniq(array, children.at(i).element());
1539  }
1540 
1541  OSStatus err;
1542  err = SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFArrayRef, sizeof(array), &array);
1543  if (err != noErr)
1544  qWarning("Qt:Internal error (%s:%d)", __FILE__, __LINE__);
1545 
1546  return noErr;
1547  }
1548 
1549  const QList<QAElement> children = lookup(interface.children());
1550  const int childCount = children.count();
1551 
1552  OSStatus err = eventNotHandledErr;
1553  if (interface.isHIView())
1554  err = CallNextEventHandler(next_ref, event);
1555 
1556  CFMutableArrayRef array = 0;
1557  int arraySize = 0;
1558  if (err == noErr) {
1559  CFTypeRef obj = 0;
1560  err = GetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, NULL , sizeof(obj), NULL, &obj);
1561  if (err == noErr && obj != 0) {
1562  array = (CFMutableArrayRef)obj;
1563  arraySize = CFArrayGetCount(array);
1564  }
1565  }
1566 
1567  if (array) {
1568  CFArrayRemoveAllValues(array);
1569  for (int i = 0; i < childCount; ++i) {
1570  qt_mac_append_cf_uniq(array, children.at(i).element());
1571  }
1572  } else {
1573  array = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
1574  for (int i = 0; i < childCount; ++i) {
1575  qt_mac_append_cf_uniq(array, children.at(i).element());
1576  }
1577 
1578  err = SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFArrayRef, sizeof(array), &array);
1579  if (err != noErr)
1580  qWarning("Qt:Internal error (%s:%d)", __FILE__, __LINE__);
1581  }
1582 
1583  return noErr;
1584 }
static QList< QAElement > tabWidgetGetChildren(const QAInterface &interface)
EventRef event
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
bool isHIView() const
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
Q_CORE_EXPORT void qWarning(const char *,...)
signed long OSStatus
AXUIElementRef element() const
const void * CFTypeRef
QList< QAElement > lookup(const QList< QAInterface > &interfaces)
QList< QAInterface > children() const
static bool qt_mac_append_cf_uniq(CFMutableArrayRef array, CFTypeRef value)
static bool isTabWidget(const QAInterface &interface)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ handleContentsAttribute()

static OSStatus handleContentsAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
QAInterface interface 
)
static

Definition at line 1818 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1819 {
1820  const QCFString mac_role = macRole(interface);
1821 
1822  QAElement contents;
1823 
1824  if (mac_role == kAXTabGroupRole) {
1825  contents = tabWidgetGetContents(interface);
1826  } else {
1827  contents = scrollAreaGetContents(interface);
1828  if (contents.isValid() == false)
1829  return CallNextEventHandler(next_ref, event);
1830  }
1831 
1832  return setAttributeValue(event, QList<QAElement>() << contents);
1833 }
EventRef event
static QAElement tabWidgetGetContents(const QAInterface &interface)
bool isValid() const
static OSStatus setAttributeValue(EventRef event, const QList< QAElement > &elements)
static QAElement scrollAreaGetContents(const QAInterface &scrollArea)
static CFStringRef macRole(const QAInterface &interface)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ handleOrientationAttribute()

static OSStatus handleOrientationAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 1742 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1743 {
1744  QObject *const object = interface.object();
1745  Qt::Orientation orientation;
1746  if (interface.role() == QAccessible::ScrollBar) {
1747  orientation = scrollBarOrientation(interface);
1748  } else if (QSplitterHandle * const splitter = qobject_cast<QSplitterHandle * const>(object)) {
1749  // Qt reports the layout orientation, but we want the splitter handle orientation.
1750  orientation = (splitter->orientation() == Qt::Horizontal) ? Qt::Vertical : Qt::Horizontal;
1751  } else {
1752  return CallNextEventHandler(next_ref, event);
1753  }
1754  const CFStringRef orientationString = (orientation == Qt::Vertical)
1756  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef, sizeof(orientationString), &orientationString);
1757  return noErr;
1758 }
const struct __CFString * CFStringRef
EventRef event
#define QAXHorizontalOrientationValue
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
The QSplitterHandle class provides handle functionality of the splitter.
Definition: qsplitter.h:158
#define QAXVerticalOrientationValue
QObject * object() const
Role role() const
static Qt::Orientation scrollBarOrientation(const QAInterface &scrollBar)
Orientation
Definition: qnamespace.h:174

◆ handleParentAttribute()

static OSStatus handleParentAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 1589 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1590 {
1591  OSStatus err = eventNotHandledErr;
1592  if (interface.isHIView()) {
1593  err = CallNextEventHandler(next_ref, event);
1594  }
1595  if (err == noErr)
1596  return err;
1597 
1598  const QAInterface parentInterface = interface.navigate(QAccessible::Ancestor, 1);
1599  const QAElement parentElement = accessibleHierarchyManager()->lookup(parentInterface);
1600 
1601  if (parentElement.isValid() == false)
1602  return eventNotHandledErr;
1603 
1604  AXUIElementRef elementRef = parentElement.element();
1605  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, sizeof(elementRef), &elementRef);
1606  return noErr;
1607 }
EventRef event
QAInterface navigate(RelationFlag relation, int entry) const
bool isValid() const
bool isHIView() const
signed long OSStatus
AXUIElementRef element() const

◆ handlePositionAttribute()

static OSStatus handlePositionAttribute ( EventHandlerCallRef  ,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 1714 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1715 {
1716  QPoint qpoint(interface.rect().topLeft());
1717  HIPoint point;
1718  point.x = qpoint.x();
1719  point.y = qpoint.y();
1720  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeHIPoint, sizeof(point), &point);
1721  return noErr;
1722 }
EventRef event
QRect rect() const
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ handleRowsAttribute()

static OSStatus handleRowsAttribute ( EventHandlerCallRef  ,
EventRef  event,
QAInterface tableView 
)
static

Definition at line 1835 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1836 {
1837  QList<QAElement> rows = lookup(tableView.children());
1838 
1839  // kill the first row which is the horizontal header.
1840  rows.removeAt(0);
1841 
1842  return setAttributeValue(event, rows);
1843 }
EventRef event
static OSStatus setAttributeValue(EventRef event, const QList< QAElement > &elements)
QList< QAElement > lookup(const QList< QAInterface > &interfaces)
QList< QAInterface > children() const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ handleScrollBarAttribute()

static OSStatus handleScrollBarAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
QAInterface scrollArea,
Qt::Orientation  orientation 
)
static

Definition at line 1806 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1807 {
1808  QAElement scrollBar = scrollAreaGetScrollBar(scrollArea, orientation);
1809  if (scrollBar.isValid() == false)
1810  return CallNextEventHandler(next_ref, event);
1811 
1812  AXUIElementRef elementRef = scrollBar.element();
1813  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, sizeof(elementRef), &elementRef);
1814  return noErr;
1815 }
EventRef event
bool isValid() const
AXUIElementRef element() const
static QAElement scrollAreaGetScrollBar(const QAInterface &scrollArea, Qt::Orientation orientation)

◆ handleSelectedRowsAttribute()

static OSStatus handleSelectedRowsAttribute ( EventHandlerCallRef  ,
EventRef  event,
QAInterface tableView 
)
static

Definition at line 1860 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1861 {
1862  QList<QAElement> selectedRows;
1863  foreach (const QAInterface &interface, tableView.children())
1864  if ((interface.state() & QAccessible::Selected))
1865  selectedRows.append(accessibleHierarchyManager()->lookup(interface));
1866 
1867  return setAttributeValue(event, selectedRows);
1868 }
EventRef event
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
static OSStatus setAttributeValue(EventRef event, const QList< QAElement > &elements)
State state() const
QList< QAElement > lookup(const QList< QAInterface > &interfaces)
QList< QAInterface > children() const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ handleSizeAttribute()

static OSStatus handleSizeAttribute ( EventHandlerCallRef  ,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 1724 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1725 {
1726  QSize qSize(interface.rect().size());
1727  HISize size;
1728  size.width = qSize.width();
1729  size.height = qSize.height();
1730  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeHISize, sizeof(size), &size);
1731  return noErr;
1732 }
EventRef event
int width() const
Returns the width.
Definition: qsize.h:126
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
QRect rect() const
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ handleSplitterContentsAttribute()

static OSStatus handleSplitterContentsAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
const QAInterface interface,
QCFString  nextOrPrev 
)
static

Definition at line 1763 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1764 {
1765  if (interface.isValid() == false || interface.role() != QAccessible::Grip)
1766  return eventNotHandledErr;
1767 
1768  const QAInterface parent = interface.parent();
1769  if (parent.isValid() == false)
1770  return CallNextEventHandler(next_ref, event);
1771 
1772  if (parent.role() != QAccessible::Splitter)
1773  return CallNextEventHandler(next_ref, event);
1774 
1775  const QSplitter * const splitter = qobject_cast<const QSplitter * const>(parent.object());
1776  if (splitter == 0)
1777  return CallNextEventHandler(next_ref, event);
1778 
1779  QWidget * const splitterHandle = qobject_cast<QWidget * const>(interface.object());
1780  const int splitterHandleIndex = splitter->indexOf(splitterHandle);
1781  const int widgetIndex = (nextOrPrev == QCFString(CFStringRef(QAXPreviousContentsAttribute))) ? splitterHandleIndex - 1 : splitterHandleIndex;
1782  const QAElement contentsElement = accessibleHierarchyManager()->lookup(splitter->widget(widgetIndex), 0);
1783  return setAttributeValue(event, QList<QAElement>() << contentsElement);
1784 }
const struct __CFString * CFStringRef
EventRef event
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool isValid() const
T * qobject_cast(QObject *object)
Definition: qobject.h:375
QWidget * widget(int index) const
Returns the widget at the given index in the splitter&#39;s layout.
Definition: qsplitter.cpp:1276
QAInterface parent() const
static OSStatus setAttributeValue(EventRef event, const QList< QAElement > &elements)
QObject * object() const
Role role() const
#define QAXPreviousContentsAttribute
int indexOf(QWidget *w) const
Returns the index in the splitter&#39;s layout of the specified widget.
Definition: qsplitter.cpp:1228
The QSplitter class implements a splitter widget.
Definition: qsplitter.h:62
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ handleSplittersAttribute()

static OSStatus handleSplittersAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
QAInterface interface 
)
static

Definition at line 1789 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1790 {
1791  const QSplitter * const splitter = qobject_cast<const QSplitter * const>(interface.object());
1792  if (splitter == 0)
1793  return CallNextEventHandler(next_ref, event);
1794 
1795  accessibleHierarchyManager()->registerChildren(interface);
1796 
1797  QList<QAElement> handles;
1798  const int visibleSplitterCount = splitter->count() -1; // skip first handle, it's always invisible.
1799  for (int i = 0; i < visibleSplitterCount; ++i)
1800  handles.append(accessibleHierarchyManager()->lookup(splitter->handle(i + 1), 0));
1801 
1802  return setAttributeValue(event, handles);
1803 }
QSplitterHandle * handle(int index) const
Returns the handle to the left (or above) for the item in the splitter&#39;s layout at the given index...
Definition: qsplitter.cpp:1263
EventRef event
T * qobject_cast(QObject *object)
Definition: qobject.h:375
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
int count() const
Returns the number of widgets contained in the splitter&#39;s layout.
Definition: qsplitter.cpp:1289
static OSStatus setAttributeValue(EventRef event, const QList< QAElement > &elements)
QObject * object() const
QList< QAElement > lookup(const QList< QAInterface > &interfaces)
The QSplitter class implements a splitter widget.
Definition: qsplitter.h:62
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ handleStringAttribute()

static void handleStringAttribute ( EventRef  event,
QAccessible::Text  text,
const QAInterface interface 
)
static

Definition at line 1504 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1505 {
1506  QString str = interface.text(text);
1507  if (str.isEmpty())
1508  return;
1509 
1510  // Remove any html markup from the text string, or VoiceOver will read the html tags.
1511  static QTextDocument document;
1512  document.setHtml(str);
1513  str = document.toPlainText();
1514 
1516  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef, sizeof(cfstr), &cfstr);
1517 }
const struct __CFString * CFStringRef
EventRef event
static CFStringRef toCFStringRef(const QString &str)
Definition: qcore_mac.cpp:69
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString toPlainText() const
Returns the plain text contained in the document.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void setHtml(const QString &html)
Replaces the entire contents of the document with the given HTML-formatted text in the html string...
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
QString text(Text text) const
#define text
Definition: qobjectdefs.h:80

◆ handleSubroleAttribute()

static OSStatus handleSubroleAttribute ( EventHandlerCallRef  ,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 1734 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1735 {
1736  const QCFString role = subrole(interface);
1737  CFStringRef rolestr = (CFStringRef)role;
1738  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, sizeof(rolestr), &rolestr);
1739  return noErr;
1740 }
const struct __CFString * CFStringRef
EventRef event
static QCFString subrole(const QAInterface &interface)

◆ handleTabsAttribute()

static OSStatus handleTabsAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
QAInterface interface 
)
static

Definition at line 1705 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1706 {
1707  Q_UNUSED(next_ref);
1708  if (isTabWidget(interface))
1709  return setAttributeValue(event, tabWidgetGetTabs(interface));
1710  else
1711  return setAttributeValue(event, tabBarGetTabs(interface));
1712 }
EventRef event
static QList< QAElement > tabBarGetTabs(const QAInterface &interface)
static OSStatus setAttributeValue(EventRef event, const QList< QAElement > &elements)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
static bool isTabWidget(const QAInterface &interface)
static QList< QAElement > tabWidgetGetTabs(const QAInterface &interface)

◆ handleTopLevelUIElementAttribute()

static OSStatus handleTopLevelUIElementAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 1697 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1698 {
1699  return navigateAncestors<IsWindowTest>(next_ref, event, interface, CFStringRef(QAXTopLevelUIElementAttribute));
1700 }
const struct __CFString * CFStringRef
EventRef event
#define QAXTopLevelUIElementAttribute

◆ handleVisibleRowsAttribute()

static OSStatus handleVisibleRowsAttribute ( EventHandlerCallRef  ,
EventRef  event,
QAInterface tableView 
)
static

Definition at line 1845 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1846 {
1847  QList<QAElement> visibleRows;
1848 
1849  QList<QAInterface> rows = tableView.children();
1850  // kill the first row which is the horizontal header.
1851  rows.removeAt(0);
1852 
1853  foreach (const QAInterface &interface, rows)
1854  if ((interface.state() & QAccessible::Invisible) == false)
1855  visibleRows.append(accessibleHierarchyManager()->lookup(interface));
1856 
1857  return setAttributeValue(event, visibleRows);
1858 }
EventRef event
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
static OSStatus setAttributeValue(EventRef event, const QList< QAElement > &elements)
State state() const
QList< QAElement > lookup(const QList< QAInterface > &interfaces)
QList< QAInterface > children() const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ handleWindowAttribute()

static OSStatus handleWindowAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 1688 of file qaccessible_mac.mm.

Referenced by getNamedAttribute().

1689 {
1690  return navigateAncestors<IsWindowAndNotDrawerOrSheetTest>(next_ref, event, interface, CFStringRef(QAXWindowAttribute));
1691 }
const struct __CFString * CFStringRef
EventRef event
#define QAXWindowAttribute

◆ isEmbeddedTabBar()

static bool isEmbeddedTabBar ( const QAInterface interface)
static

Definition at line 619 of file qaccessible_mac.mm.

Referenced by isItInteresting().

620 {
621  QObject *object = interface.object();
622  if (interface.role() == QAccessible::PageTabList && object)
623  return (qobject_cast<QTabWidget *>(object->parent()));
624 
625  return false;
626 }
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QObject * object() const
Role role() const
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273

◆ isItemView()

static bool isItemView ( const QAInterface interface)
static

Definition at line 593 of file qaccessible_mac.mm.

Referenced by createFactory(), and QAccessible::updateAccessibility().

594 {
595  QObject *object = interface.object();
596  return (interface.role() == QAccessible::List || interface.role() == QAccessible::Table
597  || (object && qobject_cast<QAbstractItemView *>(interface.object()))
598  || (object && object->objectName() == QLatin1String("qt_scrollarea_viewport")
599  && qobject_cast<QAbstractItemView *>(object->parent())));
600 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
T * qobject_cast(QObject *object)
Definition: qobject.h:375
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QObject * object() const
Role role() const
The QAbstractItemView class provides the basic functionality for item view classes.

◆ isItInteresting()

bool isItInteresting ( const QAInterface interface)

Definition at line 631 of file qaccessible_mac.mm.

Referenced by QMultipleHIObjectFactory::registerChildren(), QAccessibleHierarchyManager::registerInterface(), and QAccessible::updateAccessibility().

632 {
633  // Mac accessibility does not have an attribute that corresponds to the Invisible/Offscreen
634  // state, so we disable the interface here.
635  const QAccessible::State state = interface.state();
636  if (state & QAccessible::Invisible ||
637  state & QAccessible::Offscreen )
638  return false;
639 
640  const QAccessible::Role role = interface.role();
641 
642  if (QObject * const object = interface.object()) {
643  const QString className = QLatin1String(object->metaObject()->className());
644 
645  // VoiceOver focusing on tool tips can be confusing. The contents of the
646  // tool tip is avalible through the description attribute anyway, so
647  // we disable accessibility for tool tips.
648  if (className == QLatin1String("QTipLabel"))
649  return false;
650 
651  // Hide TabBars that has a QTabWidget parent (the tab widget handles the accessibility)
652  if (isEmbeddedTabBar(interface))
653  return false;
654 
655  // Hide docked dockwidgets. ### causes infinitie loop in the apple accessibility code.
656  /* if (QDockWidget *dockWidget = qobject_cast<QDockWidget *>(object)) {
657  if (dockWidget->isFloating() == false)
658  return false;
659  }
660  */
661  }
662 
663  // Client is a generic role returned by plain QWidgets or other
664  // widgets that does not have separate QAccessible interface, such
665  // as the TabWidget. Return false unless macRole gives the interface
666  // a special role.
667  if (role == QAccessible::Client && macRole(interface) == CFStringRef(QAXUnknownRole))
668  return false;
669 
670  // Some roles are not interesting:
671  if (role == QAccessible::Border || // QFrame
672  role == QAccessible::Application || // We use the system-provided application element.
673  role == QAccessible::MenuItem) // The system also provides the menu items.
674  return false;
675 
676  // It is probably better to access the toolbar buttons directly than having
677  // to navigate through the toolbar.
678  if (role == QAccessible::ToolBar)
679  return false;
680 
681  return true;
682 }
const struct __CFString * CFStringRef
static bool isEmbeddedTabBar(const QAInterface &interface)
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
const char * className
Definition: qwizard.cpp:137
#define QAXUnknownRole
State state() const
QObject * object() const
Role role() const
State
Definition: qaudio.h:59
static CFStringRef macRole(const QAInterface &interface)

◆ isNamedAttributeSettable()

static OSStatus isNamedAttributeSettable ( EventRef  event,
const QAInterface interface 
)
static

Definition at line 2051 of file qaccessible_mac.mm.

Referenced by accessibilityEventHandler().

2052 {
2053  CFStringRef var;
2054  GetEventParameter(event, kEventParamAccessibleAttributeName, typeCFStringRef, 0,
2055  sizeof(var), 0, &var);
2056  Boolean settable = false;
2057  if (CFStringCompare(var, CFStringRef(QAXFocusedAttribute), 0) == kCFCompareEqualTo) {
2058  settable = true;
2059  } else {
2060  for (int r = 0; text_bindings[r][0].qt != -1; r++) {
2061  if(interface.role() == (QAccessible::Role)text_bindings[r][0].qt) {
2062  for (int a = 1; text_bindings[r][a].qt != -1; a++) {
2063  if (CFStringCompare(var, CFStringRef(text_bindings[r][a].mac), 0) == kCFCompareEqualTo) {
2064  settable = text_bindings[r][a].settable;
2065  break;
2066  }
2067  }
2068  }
2069  }
2070  }
2071  SetEventParameter(event, kEventParamAccessibleAttributeSettable, typeBoolean,
2072  sizeof(settable), &settable);
2073  return noErr;
2074 }
const struct __CFString * CFStringRef
EventRef event
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
long ASN1_INTEGER_get ASN1_INTEGER * a
#define QAXFocusedAttribute
Role role() const
struct QAccessibleTextBinding text_bindings[][10]

◆ isStandaloneTabBar()

static bool isStandaloneTabBar ( const QAInterface interface)
static

Definition at line 610 of file qaccessible_mac.mm.

Referenced by macRole().

611 {
612  QObject *object = interface.object();
613  if (interface.role() == QAccessible::PageTabList && object)
614  return (qobject_cast<QTabWidget *>(object->parent()) == 0);
615 
616  return false;
617 }
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QObject * object() const
Role role() const
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273

◆ isTabWidget()

static bool isTabWidget ( const QAInterface interface)
static

Definition at line 603 of file qaccessible_mac.mm.

Referenced by QWindowsMobileStyle::drawComplexControl(), getAllAttributeNames(), handleChildrenAttribute(), handleTabsAttribute(), and macRole().

604 {
605  if (QObject *object = interface.object())
606  return (object->inherits("QTabWidget") && interface.id() == 0);
607  return false;
608 }
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QObject * object() const
int id() const

◆ lookup()

QList<QAElement> lookup ( const QList< QAInterface > &  interfaces)

Definition at line 1034 of file qaccessible_mac.mm.

Referenced by getNamedAttribute(), handleChildrenAttribute(), handleRowsAttribute(), handleSelectedRowsAttribute(), handleSplittersAttribute(), handleVisibleRowsAttribute(), QAccessibleHierarchyManager::lookup(), QCss::Parser::lookupElementName(), QCss::Parser::parseCombinator(), QCss::Parser::parseElementName(), QCss::Parser::parseTerm(), QGLGlyphCache::QGLGlyphCache(), tabBarGetTabs(), QCss::Parser::unquotedLexem(), QAccessible::updateAccessibility(), QPatternist::VariableDeclaration::usedByMany(), and QAccessibleHierarchyManager::~QAccessibleHierarchyManager().

1035 {
1037  foreach (const QAInterface &interface, interfaces)
1038  if (interface.isValid()) {
1039  const QAElement element = accessibleHierarchyManager()->lookup(interface);
1040  if (element.isValid())
1041  elements.append(element);
1042  }
1043  return elements;
1044 }
bool isValid() const
bool isValid() const
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
static const QTextHtmlElement elements[Html_NumElements]
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ macRole()

static CFStringRef macRole ( const QAInterface interface)
static

Definition at line 1151 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames(), getNamedAttribute(), handleContentsAttribute(), isItInteresting(), and scrollAreaGetScrollBarInterface().

1152 {
1153  const QAccessible::Role qtRole = interface.role();
1154 
1155 // qDebug() << "role for" << interface.object() << "interface role" << hex << qtRole;
1156 
1157  // Qt accessibility: QAccessible::Splitter contains QAccessible::Grip.
1158  // Mac accessibility: AXSplitGroup contains AXSplitter.
1159  if (qtRole == QAccessible::Grip) {
1160  const QAInterface parent = interface.parent();
1161  if (parent.isValid() && parent.role() == QAccessible::Splitter)
1162  return CFStringRef(QAXSplitterRole);
1163  }
1164 
1165  // Tab widgets and standalone tab bars get the kAXTabGroupRole. Accessibility
1166  // for tab bars emebedded in a tab widget is handled by the tab widget.
1167  if (isTabWidget(interface) || isStandaloneTabBar(interface))
1168  return kAXTabGroupRole;
1169 
1170  if (QObject *object = interface.object()) {
1171  // ### The interface for an abstract scroll area returns the generic "Client"
1172  // role, so we have to to an extra detect on the QObject here.
1173  if (object->inherits("QAbstractScrollArea") && interface.id() == 0)
1175 
1176  if (object->inherits("QDockWidget"))
1177  return CFStringRef(QAXUnknownRole);
1178  }
1179 
1180  int i = 0;
1181  int testRole = text_bindings[i][0].qt;
1182  while (testRole != -1) {
1183  if (testRole == qtRole)
1184  return CFStringRef(text_bindings[i][0].mac);
1185  ++i;
1186  testRole = text_bindings[i][0].qt;
1187  }
1188 
1189 // qDebug() << "got unknown role!" << interface << interface.parent();
1190 
1191  return CFStringRef(QAXUnknownRole);
1192 }
const struct __CFString * CFStringRef
#define QAXSplitterRole
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
bool isValid() const
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
static bool isStandaloneTabBar(const QAInterface &interface)
QAInterface parent() const
#define QAXUnknownRole
QObject * object() const
Role role() const
int id() const
#define QAXScrollAreaRole
struct QAccessibleTextBinding text_bindings[][10]
static bool isTabWidget(const QAInterface &interface)

◆ managesChildren()

static bool managesChildren ( const QAInterface interface)
static

Definition at line 1017 of file qaccessible_mac.mm.

Referenced by createFactory(), and QAccessible::updateAccessibility().

1018 {
1019  return (interface.childCount() > 0 && interface.childAt(1).id() > 0);
1020 }
QAInterface childAt(int x, int y) const
int childCount() const
int id() const

◆ navigateAncestors()

template<typename TestType >
OSStatus navigateAncestors ( EventHandlerCallRef  next_ref,
EventRef  event,
const QAInterface interface,
CFStringRef  attribute 
)

Definition at line 1636 of file qaccessible_mac.mm.

1637 {
1638  if (interface.isHIView())
1639  return CallNextEventHandler(next_ref, event);
1640 
1641  QAInterface current = interface;
1642  QAElement element;
1643  while (current.isValid()) {
1644  if (TestType::test(interface)) {
1645  element = accessibleHierarchyManager()->lookup(current);
1646  break;
1647  }
1648 
1649  // If we reach an InterfaceItem that is a HiView we can hand of the search to
1650  // the system event handler. This is the common case.
1651  if (current.isHIView()) {
1652  CFTypeRef value = 0;
1653  const QAElement currentElement = accessibleHierarchyManager()->lookup(current);
1654  AXError err = AXUIElementCopyAttributeValue(currentElement.element(), attribute, &value);
1655  AXUIElementRef newElement = (AXUIElementRef)value;
1656 
1657  if (err == noErr)
1658  element = QAElement(newElement);
1659 
1660  if (newElement != 0)
1661  CFRelease(newElement);
1662  break;
1663  }
1664 
1665  QAInterface next = current.parent();
1666  if (next.isValid() == false)
1667  break;
1668  if (next == current)
1669  break;
1670  current = next;
1671  }
1672 
1673  if (element.isValid() == false)
1674  return eventNotHandledErr;
1675 
1676 
1677  AXUIElementRef elementRef = element.element();
1678  SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef,
1679  sizeof(elementRef), &elementRef);
1680  return noErr;
1681 }
EventRef event
bool isValid() const
bool isValid() const
bool isHIView() const
QAInterface parent() const
AXUIElementRef element() const
const void * CFTypeRef

◆ operator<<()

QDebug operator<< ( QDebug  debug,
const QAInterface interface 
)

Definition at line 397 of file qaccessible_mac.mm.

398 {
399  if (interface.isValid() == false)
400  debug << "invalid interface";
401  else
402  debug << interface.object() << "id" << interface.id() << "role" << hex << interface.role();
403  return debug;
404 }
bool isValid() const
QObject * object() const
Role role() const
int id() const
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.

◆ performNamedAction()

static OSStatus performNamedAction ( EventHandlerCallRef  next_ref,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 2212 of file qaccessible_mac.mm.

Referenced by accessibilityEventHandler().

2213 {
2214  Q_UNUSED(next_ref);
2215 
2216  CFStringRef act;
2217  GetEventParameter(event, kEventParamAccessibleActionName, typeCFStringRef, 0,
2218  sizeof(act), 0, &act);
2219 
2220  const QAccessible::Action action = translateAction(act);
2221 
2222  // Perform built-in action
2223  if (action != QAccessible::DefaultAction) {
2224  interface.doAction(action, QVariantList());
2225  return noErr;
2226  }
2227 
2228  // Search for user-defined actions and perform it if found.
2229  const int actCount = interface.userActionCount();
2230  const QString qAct = QCFString::toQString(act);
2231  for(int i = 0; i < actCount; i++) {
2232  if(interface.actionText(i, QAccessible::Name) == qAct) {
2233  interface.doAction(i, QVariantList());
2234  break;
2235  }
2236  }
2237  return noErr;
2238 }
static QCFString translateAction(const QAccessible::Action action)
const struct __CFString * CFStringRef
void doAction(int action, const QVariantList &params=QVariantList()) const
EventRef event
static QString toQString(CFStringRef cfstr)
Definition: qcore_mac.cpp:47
The QString class provides a Unicode character string.
Definition: qstring.h:83
QVariantList
Synonym for QList<QVariant>.
QString actionText(int action, Text text) const
Action
This enum describes the possible types of action that can occur.
Definition: qaccessible.h:294
int userActionCount() const
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ Q_GLOBAL_STATIC()

Q_GLOBAL_STATIC ( QAccessibleHierarchyManager  ,
accessibleHierarchyManager   
)

Referenced by qHash().

◆ qHash() [1/2]

uint qHash ( const QAInterface item)

Definition at line 441 of file qaccessible_mac.mm.

Referenced by qHash().

442 {
443  if (item.isValid())
444  return qHash(item.object()) + qHash(item.id());
445  else
446  return qHash(item.cachedObject()) + qHash(item.id());
447 }
bool isValid() const
QObject * cachedObject() const
QObject * object() const
uint qHash(const QUrl &url)
Definition: qurl.h:285
int id() const

◆ qHash() [2/2]

uint qHash ( QAElement  element)

Definition at line 555 of file qaccessible_mac.mm.

556 {
557  return qHash(element.object()) + qHash(element.id());
558 }
HIObjectRef object() const
int id() const
uint qHash(const QUrl &url)
Definition: qurl.h:285

◆ qt_mac_append_cf_uniq()

static bool qt_mac_append_cf_uniq ( CFMutableArrayRef  array,
CFTypeRef  value 
)
static

Definition at line 1064 of file qaccessible_mac.mm.

Referenced by appendIfSupported(), getAllActionNames(), getAllAttributeNames(), and handleChildrenAttribute().

1065 {
1066  if (value == 0)
1067  return false;
1068 
1069  CFRange range;
1070  range.location = 0;
1071  range.length = CFArrayGetCount(array);
1072  if(!CFArrayContainsValue(array, range, value)) {
1073  CFArrayAppendValue(array, value);
1074  return true;
1075  }
1076  return false;
1077 }

◆ qt_mac_is_macdrawer()

bool qt_mac_is_macdrawer ( const QWidget w)

Definition at line 306 of file qwidget_mac.mm.

Referenced by QMainWindow::addDockWidget(), QWidget::previousInFocusChain(), QDockAreaLayoutInfo::restoreState(), and IsWindowAndNotDrawerOrSheetTest::test().

307 {
308  return (w && w->parentWidget() && w->windowType() == Qt::Drawer);
309 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937

◆ qt_mac_is_macsheet()

bool qt_mac_is_macsheet ( const QWidget w)

Definition at line 295 of file qwidget_mac.mm.

Referenced by IsWindowAndNotDrawerOrSheetTest::test().

296 {
297  if (!w)
298  return false;
299 
300  Qt::WindowModality modality = w->windowModality();
301  if (modality == Qt::ApplicationModal)
302  return false;
303  return w->parentWidget() && (modality == Qt::WindowModal || w->windowType() == Qt::Sheet);
304 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Qt::WindowModality windowModality
which windows are blocked by the modal widget
Definition: qwidget.h:156
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
WindowModality
Definition: qnamespace.h:1683

◆ scrollAreaGetContents()

static QAElement scrollAreaGetContents ( const QAInterface scrollArea)
static

Definition at line 1301 of file qaccessible_mac.mm.

Referenced by handleContentsAttribute().

1302 {
1303  // Child 1 is the contents widget,
1304  return accessibleHierarchyManager()->lookup(scrollArea.navigate(QAccessible::Child, 1));
1305 }
QAInterface navigate(RelationFlag relation, int entry) const

◆ scrollAreaGetScrollBar()

static QAElement scrollAreaGetScrollBar ( const QAInterface scrollArea,
Qt::Orientation  orientation 
)
static

Definition at line 1296 of file qaccessible_mac.mm.

Referenced by handleScrollBarAttribute().

1297 {
1298  return accessibleHierarchyManager()->lookup(scrollAreaGetScrollBarInterface(scrollArea, orientation));
1299 }
static QAInterface scrollAreaGetScrollBarInterface(const QAInterface &scrollArea, Qt::Orientation orientation)

◆ scrollAreaGetScrollBarInterface()

static QAInterface scrollAreaGetScrollBarInterface ( const QAInterface scrollArea,
Qt::Orientation  orientation 
)
static

Definition at line 1271 of file qaccessible_mac.mm.

Referenced by scrollAreaGetScrollBar(), and scrollAreaHasScrollBar().

1272 {
1273  if (macRole(scrollArea) != CFStringRef(CFStringRef(QAXScrollAreaRole)))
1274  return QAInterface();
1275 
1276  // Child 1 is the contents widget, 2 and 3 are the scroll bar containers wich contains possible scroll bars.
1277  for (int i = 2; i <= 3; ++i) {
1278  QAInterface scrollBarContainer = scrollArea.childAt(i);
1279  for (int i = 1; i <= scrollBarContainer.childCount(); ++i) {
1280  QAInterface scrollBar = scrollBarContainer.childAt(i);
1281  if (scrollBar.isValid() &&
1282  scrollBar.role() == QAccessible::ScrollBar &&
1283  scrollBarOrientation(scrollBar) == orientation)
1284  return scrollBar;
1285  }
1286  }
1287 
1288  return QAInterface();
1289 }
const struct __CFString * CFStringRef
QAInterface childAt(int x, int y) const
bool isValid() const
int childCount() const
Role role() const
static CFStringRef macRole(const QAInterface &interface)
#define QAXScrollAreaRole
static Qt::Orientation scrollBarOrientation(const QAInterface &scrollBar)

◆ scrollAreaHasScrollBar()

static bool scrollAreaHasScrollBar ( const QAInterface scrollArea,
Qt::Orientation  orientation 
)
static

Definition at line 1291 of file qaccessible_mac.mm.

Referenced by getAllAttributeNames().

1292 {
1293  return scrollAreaGetScrollBarInterface(scrollArea, orientation).isValid();
1294 }
bool isValid() const
static QAInterface scrollAreaGetScrollBarInterface(const QAInterface &scrollArea, Qt::Orientation orientation)

◆ scrollBarOrientation()

static Qt::Orientation scrollBarOrientation ( const QAInterface scrollBar)
static

Definition at line 1262 of file qaccessible_mac.mm.

Referenced by QAbstractScrollArea::addScrollBarWidget(), handleOrientationAttribute(), and scrollAreaGetScrollBarInterface().

1263 {
1264  QObject *const object = scrollBar.object();
1265  if (QAbstractSlider * const sliderObject = qobject_cast<QAbstractSlider * const>(object))
1266  return sliderObject->orientation();
1267 
1268  return Qt::Vertical; // D'oh! The interface wasn't a scroll bar.
1269 }
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QObject * object() const
The QAbstractSlider class provides an integer value within a range.

◆ setAttributeValue()

static OSStatus setAttributeValue ( EventRef  event,
const QList< QAElement > &  elements 
)
static

Definition at line 1079 of file qaccessible_mac.mm.

Referenced by getNamedAttribute(), handleContentsAttribute(), handleRowsAttribute(), handleSelectedRowsAttribute(), handleSplitterContentsAttribute(), handleSplittersAttribute(), handleTabsAttribute(), and handleVisibleRowsAttribute().

1080 {
1081  CFMutableArrayRef array = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
1082  foreach (const QAElement &element, elements) {
1083  if (element.isValid())
1084  CFArrayAppendValue(array, element.element());
1085  }
1086 
1087  const OSStatus err = SetEventParameter(event, kEventParamAccessibleAttributeValue,
1088  typeCFTypeRef, sizeof(array), &array);
1089  CFRelease(array);
1090  return err;
1091 }
EventRef event
bool isValid() const
signed long OSStatus
AXUIElementRef element() const

◆ setNamedAttribute()

static OSStatus setNamedAttribute ( EventHandlerCallRef  next_ref,
EventRef  event,
const QAInterface interface 
)
static

Definition at line 2240 of file qaccessible_mac.mm.

Referenced by accessibilityEventHandler().

2241 {
2242  Q_UNUSED(next_ref);
2243  Q_UNUSED(event);
2244 
2245  CFStringRef var;
2246  GetEventParameter(event, kEventParamAccessibleAttributeName, typeCFStringRef, 0,
2247  sizeof(var), 0, &var);
2248  if(CFStringCompare(var, CFStringRef(QAXFocusedAttribute), 0) == kCFCompareEqualTo) {
2249  CFTypeRef val;
2250  if(GetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, 0,
2251  sizeof(val), 0, &val) == noErr) {
2252  if(CFGetTypeID(val) == CFBooleanGetTypeID() &&
2253  CFEqual(static_cast<CFBooleanRef>(val), kCFBooleanTrue)) {
2254  interface.doAction(QAccessible::SetFocus);
2255  }
2256  }
2257  } else {
2258  bool found = false;
2259  for(int r = 0; text_bindings[r][0].qt != -1; r++) {
2260  if(interface.role() == (QAccessible::Role)text_bindings[r][0].qt) {
2261  for(int a = 1; text_bindings[r][a].qt != -1; a++) {
2262  if(CFStringCompare(var, CFStringRef(text_bindings[r][a].mac), 0) == kCFCompareEqualTo) {
2263  if(!text_bindings[r][a].settable) {
2264  } else {
2265  CFTypeRef val;
2266  if(GetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, 0,
2267  sizeof(val), 0, &val) == noErr) {
2268  if(CFGetTypeID(val) == CFStringGetTypeID())
2269  interface.setText((QAccessible::Text)text_bindings[r][a].qt,
2270  QCFString::toQString(static_cast<CFStringRef>(val)));
2271 
2272  }
2273  }
2274  found = true;
2275  break;
2276  }
2277  }
2278  break;
2279  }
2280  }
2281  }
2282  return noErr;
2283 }
const struct __CFString * CFStringRef
void doAction(int action, const QVariantList &params=QVariantList()) const
EventRef event
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
static QString toQString(CFStringRef cfstr)
Definition: qcore_mac.cpp:47
long ASN1_INTEGER_get ASN1_INTEGER * a
void setText(Text t, const QString &text) const
const void * CFTypeRef
#define QAXFocusedAttribute
Role role() const
Text
This enum specifies string information that an accessible object returns.
Definition: qaccessible.h:259
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
struct QAccessibleTextBinding text_bindings[][10]

◆ subrole()

static QCFString subrole ( const QAInterface interface)
static

Definition at line 1240 of file qaccessible_mac.mm.

Referenced by handleSubroleAttribute(), and supportsAttribute().

1241 {
1242  const QAInterface parent = interface.parent();
1243  if (parent.isValid() == false)
1244  return QCFString();
1245 
1246  if (parent.role() == QAccessible::ScrollBar) {
1248  switch(interface.id()) {
1249  case 1: subrole = CFStringRef(QAXDecrementArrowSubrole); break;
1250  case 2: subrole = CFStringRef(QAXDecrementPageSubrole); break;
1251  case 4: subrole = CFStringRef(QAXIncrementPageSubrole); break;
1252  case 5: subrole = CFStringRef(QAXIncrementArrowSubrole); break;
1253  default:
1254  break;
1255  }
1256  return subrole;
1257  }
1258  return QCFString();
1259 }
const struct __CFString * CFStringRef
bool isValid() const
#define QAXIncrementPageSubrole
QAInterface parent() const
#define QAXDecrementPageSubrole
Role role() const
#define QAXDecrementArrowSubrole
static QCFString subrole(const QAInterface &interface)
#define QAXIncrementArrowSubrole
int id() const

◆ supportedPredefinedActions()

static QList<QAccessible::Action> supportedPredefinedActions ( const QAInterface interface)
static

Definition at line 2108 of file qaccessible_mac.mm.

Referenced by getAllActionNames().

2109 {
2111  switch (interface.role()) {
2112  default:
2113  // Most things can be pressed.
2114  actions.append(QAccessible::Press);
2115  break;
2116  }
2117 
2118  return actions;
2119 }
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
Role role() const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ supportsAttribute()

static bool supportsAttribute ( CFStringRef  attribute,
const QAInterface interface 
)
static

Definition at line 1382 of file qaccessible_mac.mm.

Referenced by appendIfSupported().

1383 {
1384  const int text = textForRoleAndAttribute(interface.role(), attribute);
1385 
1386  // Special case: Static texts don't have a title.
1387  if (interface.role() == QAccessible::StaticText && attribute == CFStringRef(QAXTitleAttribute))
1388  return false;
1389 
1390  // Return true if we the attribute matched a QAccessible::Role and we get text for that role from the interface.
1391  if (text != -1) {
1392  if (text == QAccessible::Value) // Special case for Value, see getValue()
1393  return !getValue(interface).isEmpty();
1394  else
1395  return !interface.text((QAccessible::Text)text).isEmpty();
1396  }
1397 
1398  if (CFStringCompare(attribute, CFStringRef(QAXChildrenAttribute), 0) == kCFCompareEqualTo) {
1399  if (interface.childCount() > 0)
1400  return true;
1401  }
1402 
1403  if (CFStringCompare(attribute, CFStringRef(QAXSubroleAttribute), 0) == kCFCompareEqualTo) {
1404  return (subrole(interface) != QCFString());
1405  }
1406 
1407  return false;
1408 }
const struct __CFString * CFStringRef
#define QAXTitleAttribute
static QString getValue(const QAInterface &interface)
#define QAXSubroleAttribute
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define QAXChildrenAttribute
int childCount() const
static int textForRoleAndAttribute(QAccessible::Role role, CFStringRef attribute)
Role role() const
static QCFString subrole(const QAInterface &interface)
Text
This enum specifies string information that an accessible object returns.
Definition: qaccessible.h:259
QString text(Text text) const
#define text
Definition: qobjectdefs.h:80

◆ tabBarGetTabs()

static QList<QAElement> tabBarGetTabs ( const QAInterface interface)
static

Definition at line 1319 of file qaccessible_mac.mm.

Referenced by handleTabsAttribute(), and tabWidgetGetTabs().

1320 {
1321  // Get the tabs by searching for children with the "PageTab" role.
1322  // This filters out the left/right navigation buttons.
1323  accessibleHierarchyManager()->registerChildren(interface);
1324  QList<QAElement> tabs;
1325  const int numChildren = interface.childCount();
1326  for (int i = 1; i < numChildren + 1; ++i) {
1327  QAInterface child = interface.navigate(QAccessible::Child, i);
1328  if (child.isValid() && child.role() == QAccessible::PageTab) {
1329  tabs.append(accessibleHierarchyManager()->lookup(child));
1330  }
1331  }
1332  return tabs;
1333 }
QAInterface navigate(RelationFlag relation, int entry) const
bool isValid() const
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
int childCount() const
Role role() const
QList< QAElement > lookup(const QList< QAInterface > &interfaces)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ tabWidgetGetChildren()

static QList<QAElement> tabWidgetGetChildren ( const QAInterface interface)
static

Definition at line 1342 of file qaccessible_mac.mm.

Referenced by handleChildrenAttribute().

1343 {
1344  // The children for a kAXTabGroup should consist of the tabs and the
1345  // contents of the current open tab page.
1346  QList<QAElement> children = tabWidgetGetTabs(interface);
1347  children += tabWidgetGetContents(interface);
1348  return children;
1349 }
static QAElement tabWidgetGetContents(const QAInterface &interface)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
static QList< QAElement > tabWidgetGetTabs(const QAInterface &interface)

◆ tabWidgetGetContents()

static QAElement tabWidgetGetContents ( const QAInterface interface)
static

Definition at line 1307 of file qaccessible_mac.mm.

Referenced by handleContentsAttribute(), and tabWidgetGetChildren().

1308 {
1309  // A kAXTabGroup has a kAXContents attribute, which consists of the
1310  // ui elements for the current tab page. Get the current tab page
1311  // from the QStackedWidget, where the current visible page can
1312  // be found at index 1.
1313  QAInterface stackedWidget = interface.childAt(1);
1314  accessibleHierarchyManager()->registerChildren(stackedWidget);
1315  QAInterface tabPageInterface = stackedWidget.childAt(1);
1316  return accessibleHierarchyManager()->lookup(tabPageInterface);
1317 }
QAInterface childAt(int x, int y) const

◆ tabWidgetGetTabs()

static QList<QAElement> tabWidgetGetTabs ( const QAInterface interface)
static

Definition at line 1335 of file qaccessible_mac.mm.

Referenced by handleTabsAttribute(), and tabWidgetGetChildren().

1336 {
1337  // Each QTabWidget has two children, a QStackedWidget and a QTabBar.
1338  // Get the tabs from the QTabBar.
1339  return tabBarGetTabs(interface.childAt(2));
1340 }
QAInterface childAt(int x, int y) const
static QList< QAElement > tabBarGetTabs(const QAInterface &interface)

◆ textForRoleAndAttribute()

static int textForRoleAndAttribute ( QAccessible::Role  role,
CFStringRef  attribute 
)
static

custom compare

custom compare

Definition at line 1199 of file qaccessible_mac.mm.

Referenced by getNamedAttribute(), and supportsAttribute().

1200 {
1201  // Search for exception, return it if found.
1202  int testRole = text_bindings[0][0].qt;
1203  int i = 0;
1204  while (testRole != -1) {
1205  if (testRole == role) {
1206  int j = 1;
1207  int qtRole = text_bindings[i][j].qt;
1208  CFStringRef testAttribute = CFStringRef(text_bindings[i][j].mac);
1209  while (qtRole != -1) {
1210  if (CFStringCompare(attribute, testAttribute, 0) == kCFCompareEqualTo) {
1211  return (QAccessible::Text)qtRole;
1212  }
1213  ++j;
1214  testAttribute = CFStringRef(text_bindings[i][j].mac);
1215  qtRole = text_bindings[i][j].qt;
1216  }
1217  break;
1218  }
1219  ++i;
1220  testRole = text_bindings[i][0].qt;
1221  }
1222 
1223  // Return default mappping
1224  if (CFStringCompare(attribute, CFStringRef(QAXTitleAttribute), 0) == kCFCompareEqualTo)
1225  return QAccessible::Name;
1226  else if (CFStringCompare(attribute, CFStringRef(QAXValueAttribute), 0) == kCFCompareEqualTo)
1227  return QAccessible::Value;
1228  else if (CFStringCompare(attribute, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo)
1229  return QAccessible::Help;
1230  else if (CFStringCompare(attribute, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo)
1231  return QAccessible::Description;
1232  else
1233  return -1;
1234 }
const struct __CFString * CFStringRef
#define QAXTitleAttribute
#define QAXHelpAttribute
#define QAXValueAttribute
Text
This enum specifies string information that an accessible object returns.
Definition: qaccessible.h:259
#define QAXDescriptionAttribute
struct QAccessibleTextBinding text_bindings[][10]

◆ translateAction() [1/2]

static QCFString translateAction ( const QAccessible::Action  action)
static

Definition at line 2125 of file qaccessible_mac.mm.

Referenced by getAllActionNames(), and performNamedAction().

2126 {
2127  switch (action) {
2128  case QAccessible::Press:
2129  return CFStringRef(QAXPressAction);
2130  break;
2131  case QAccessible::Increase:
2133  break;
2134  case QAccessible::Decrease:
2136  break;
2137  case QAccessible::Accept:
2138  return CFStringRef(QAXConfirmAction);
2139  break;
2140  case QAccessible::Select:
2141  return CFStringRef(QAXPickAction);
2142  break;
2143  case QAccessible::Cancel:
2144  return CFStringRef(QAXCancelAction);
2145  break;
2146  default:
2147  return QCFString();
2148  break;
2149  }
2150 }
const struct __CFString * CFStringRef
#define QAXConfirmAction
#define QAXDecrementAction
#define QAXPickAction
#define QAXIncrementAction
#define QAXPressAction
#define QAXCancelAction

◆ translateAction() [2/2]

static QAccessible::Action translateAction ( const CFStringRef  actionName)
static

Definition at line 2156 of file qaccessible_mac.mm.

2157 {
2158  if(CFStringCompare(actionName, CFStringRef(QAXPressAction), 0) == kCFCompareEqualTo) {
2159  return QAccessible::Press;
2160  } else if(CFStringCompare(actionName, CFStringRef(QAXIncrementAction), 0) == kCFCompareEqualTo) {
2161  return QAccessible::Increase;
2162  } else if(CFStringCompare(actionName, CFStringRef(QAXDecrementAction), 0) == kCFCompareEqualTo) {
2163  return QAccessible::Decrease;
2164  } else if(CFStringCompare(actionName, CFStringRef(QAXConfirmAction), 0) == kCFCompareEqualTo) {
2165  return QAccessible::Accept;
2166  } else if(CFStringCompare(actionName, CFStringRef(QAXPickAction), 0) == kCFCompareEqualTo) {
2167  return QAccessible::Select;
2168  } else if(CFStringCompare(actionName, CFStringRef(QAXCancelAction), 0) == kCFCompareEqualTo) {
2169  return QAccessible::Cancel;
2170  } else {
2172  }
2173 }
const struct __CFString * CFStringRef
#define QAXConfirmAction
#define QAXDecrementAction
#define QAXPickAction
#define QAXIncrementAction
#define QAXPressAction
#define QAXCancelAction

Variable Documentation

◆ rootObject

QObject* rootObject = 0
static

Definition at line 407 of file qaccessible_mac.mm.

◆ text_bindings

struct QAccessibleTextBinding text_bindings[][10]