src/plugins/accessible/widgets/qaccessiblemenu.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the plugins of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QACCESSIBLEMENU_H
       
    43 #define QACCESSIBLEMENU_H
       
    44 
       
    45 #include <QtGui/qaccessiblewidget.h>
       
    46 
       
    47 QT_BEGIN_NAMESPACE
       
    48 
       
    49 #ifndef QT_NO_ACCESSIBILITY
       
    50 
       
    51 #ifndef QT_NO_MENU
       
    52 class QMenu;
       
    53 class QMenuBar;
       
    54 class QAction;
       
    55 
       
    56 class QAccessibleMenu : public QAccessibleWidgetEx
       
    57 {
       
    58 public:
       
    59     explicit QAccessibleMenu(QWidget *w);
       
    60 
       
    61     int childCount() const;
       
    62     int childAt(int x, int y) const;
       
    63 
       
    64     QRect rect(int child) const;
       
    65     QString text(Text t, int child) const;
       
    66     Role role(int child) const;
       
    67     State state(int child) const;
       
    68     int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
       
    69     int indexOfChild( const QAccessibleInterface *child ) const;
       
    70 
       
    71     QString actionText(int action, QAccessible::Text text, int child) const;
       
    72     bool doAction(int action, int child, const QVariantList &params);
       
    73 
       
    74 protected:
       
    75     QMenu *menu() const;
       
    76 };
       
    77 
       
    78 #ifndef QT_NO_MENUBAR
       
    79 class QAccessibleMenuBar : public QAccessibleWidgetEx
       
    80 {
       
    81 public:
       
    82     explicit QAccessibleMenuBar(QWidget *w);
       
    83 
       
    84     int childCount() const;
       
    85     int childAt(int x, int y) const;
       
    86 
       
    87     QRect rect(int child) const;
       
    88     QString text(Text t, int child) const;
       
    89     Role role(int child) const;
       
    90     State state(int child) const;
       
    91     int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
       
    92     int indexOfChild( const QAccessibleInterface *child ) const;
       
    93 
       
    94     QString actionText(int action, QAccessible::Text text, int child) const;
       
    95     bool doAction(int action, int child, const QVariantList &params);
       
    96 
       
    97 protected:
       
    98     QMenuBar *menuBar() const;
       
    99 };
       
   100 #endif // QT_NO_MENUBAR
       
   101 
       
   102 
       
   103 
       
   104 class QAccessibleMenuItem : public QAccessibleInterface
       
   105 {
       
   106 public:
       
   107     explicit QAccessibleMenuItem(QWidget *owner, QAction *w);
       
   108 
       
   109     virtual ~QAccessibleMenuItem();
       
   110     virtual QString actionText ( int action, Text t, int child ) const;
       
   111     virtual int childAt ( int x, int y ) const;
       
   112     virtual int childCount () const;
       
   113     virtual bool doAction ( int action, int child, const QVariantList & params = QVariantList() );
       
   114     virtual int indexOfChild ( const QAccessibleInterface * child ) const;
       
   115     virtual bool isValid () const;
       
   116     virtual int navigate ( RelationFlag relation, int entry, QAccessibleInterface ** target ) const;
       
   117     virtual QObject * object () const;
       
   118     virtual QRect rect ( int child ) const;
       
   119     virtual Relation relationTo ( int child, const QAccessibleInterface * other, int otherChild ) const;
       
   120     virtual Role role ( int child ) const;
       
   121     virtual void setText ( Text t, int child, const QString & text );
       
   122     virtual State state ( int child ) const;
       
   123     virtual QString text ( Text t, int child ) const;
       
   124     virtual int userActionCount ( int child ) const;
       
   125 
       
   126     QWidget *owner() const;
       
   127 
       
   128 
       
   129 protected:
       
   130     QAction *action() const;
       
   131 private:
       
   132     QAction *m_action;
       
   133     QWidget *m_owner; // can hold either QMenu or the QMenuBar that contains the action
       
   134 };
       
   135 
       
   136 #endif // QT_NO_MENU
       
   137 
       
   138 QT_END_NAMESPACE
       
   139 #endif // QT_NO_ACCESSIBILITY
       
   140 #endif // QACCESSIBLEMENU_H