VirtualBox

Ignore:
Timestamp:
Jan 10, 2017 12:41:21 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 160): Very basic accessibility interface for UICocoaSearchField.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm

    r63962 r65223  
    638638}
    639639
     640
     641/** QAccessibleWidget extension used as an accessibility interface for search-field. */
     642class UIAccessibilityInterfaceForUICocoaSearchField : public QAccessibleWidget
     643{
     644public:
     645
     646    /** Returns an accessibility interface for passed @a strClassname and @a pObject. */
     647    static QAccessibleInterface *pFactory(const QString &strClassname, QObject *pObject)
     648    {
     649        /* Creating segmented-button accessibility interface: */
     650        if (pObject && strClassname == QLatin1String("UICocoaSearchField"))
     651            return new UIAccessibilityInterfaceForUICocoaSearchField(qobject_cast<QWidget*>(pObject));
     652
     653        /* Null by default: */
     654        return 0;
     655    }
     656
     657    /** Constructs an accessibility interface passing @a pWidget to the base-class. */
     658    UIAccessibilityInterfaceForUICocoaSearchField(QWidget *pWidget)
     659        : QAccessibleWidget(pWidget, QAccessible::EditableText)
     660    {
     661        // For now this class doesn't implement interface casting.
     662        // Which means there will be no editable text accessible
     663        // in basic accessibility layer, only in advanced one.
     664    }
     665
     666private:
     667
     668    /** Returns corresponding search-field. */
     669    UICocoaSearchField *field() const { return qobject_cast<UICocoaSearchField*>(widget()); }
     670};
     671
     672
    640673UICocoaSearchField::UICocoaSearchField(QWidget *pParent)
    641674    : QMacCocoaViewContainer(0, pParent)
    642675{
     676    /* Install segmented-button accessibility interface factory: */
     677    QAccessible::installFactory(UIAccessibilityInterfaceForUICocoaSearchField::pFactory);
     678
    643679    /* Prepare auto-release pool: */
    644680    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette