LCOV - code coverage report
Current view: top level - accessible/atk - nsMai.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 5 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef __NS_MAI_H__
       8             : #define __NS_MAI_H__
       9             : 
      10             : #include <atk/atk.h>
      11             : #include <glib.h>
      12             : #include <glib-object.h>
      13             : 
      14             : #include "AccessibleOrProxy.h"
      15             : #include "AccessibleWrap.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace a11y {
      19             : class ProxyAccessible;
      20             : }
      21             : }
      22             : 
      23             : #define MAI_TYPE_ATK_OBJECT             (mai_atk_object_get_type ())
      24             : #define MAI_ATK_OBJECT(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
      25             :                                          MAI_TYPE_ATK_OBJECT, MaiAtkObject))
      26             : #define MAI_ATK_OBJECT_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), \
      27             :                                          MAI_TYPE_ATK_OBJECT, \
      28             :                                          MaiAtkObjectClass))
      29             : #define IS_MAI_OBJECT(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
      30             :                                          MAI_TYPE_ATK_OBJECT))
      31             : #define IS_MAI_OBJECT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), \
      32             :                                          MAI_TYPE_ATK_OBJECT))
      33             : #define MAI_ATK_OBJECT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), \
      34             :                                          MAI_TYPE_ATK_OBJECT, \
      35             :                                          MaiAtkObjectClass))
      36             : GType mai_atk_object_get_type(void);
      37             : GType mai_util_get_type();
      38             : extern "C" GType mai_atk_socket_get_type(void);
      39             : 
      40             : /* MaiAtkSocket */
      41             : 
      42             : #define MAI_TYPE_ATK_SOCKET              (mai_atk_socket_get_type ())
      43             : #define MAI_ATK_SOCKET(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
      44             :                                           MAI_TYPE_ATK_SOCKET, MaiAtkSocket))
      45             : #define MAI_IS_ATK_SOCKET(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
      46             :                                           MAI_TYPE_ATK_SOCKET))
      47             : #define MAI_ATK_SOCKET_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass),\
      48             :                                           MAI_TYPE_ATK_SOCKET,\
      49             :                                           MaiAtkSocketClass))
      50             : #define MAI_IS_ATK_SOCKET_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass),\
      51             :                                           MAI_TYPE_ATK_SOCKET))
      52             : #define MAI_ATK_SOCKET_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj),\
      53             :                                           MAI_TYPE_ATK_SOCKET,\
      54             :                                           MaiAtkSocketClass))
      55             : 
      56             : typedef struct _MaiAtkSocket
      57             : {
      58             :   AtkSocket parent;
      59             : 
      60             :   mozilla::a11y::AccessibleWrap* accWrap;
      61             : } MaiAtkSocket;
      62             : 
      63             : typedef struct _MaiAtkSocketClass
      64             : {
      65             :   AtkSocketClass parent_class;
      66             : } MaiAtkSocketClass;
      67             : 
      68             : // This is a pointer to the atk_table_cell_get_type function if we are using
      69             : // a version of atk that defines that.
      70             : extern "C" GType (*gAtkTableCellGetTypeFunc)();
      71             : 
      72             : mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
      73             : mozilla::a11y::ProxyAccessible* GetProxy(AtkObject* aAtkObj);
      74             : mozilla::a11y::AccessibleOrProxy GetInternalObj(AtkObject* aObj);
      75             : AtkObject* GetWrapperFor(mozilla::a11y::ProxyAccessible* aProxy);
      76             : AtkObject* GetWrapperFor(mozilla::a11y::AccessibleOrProxy aObj);
      77             : 
      78             : extern int atkMajorVersion, atkMinorVersion, atkMicroVersion;
      79             : 
      80             : /**
      81             :  * Return true if the loaded version of libatk-1.0.so is at least
      82             :  * aMajor.aMinor.aMicro.
      83             :  */
      84             : static inline bool
      85           0 : IsAtkVersionAtLeast(int aMajor, int aMinor, int aMicro=0)
      86             : {
      87           0 :   return aMajor < atkMajorVersion ||
      88           0 :          (aMajor == atkMajorVersion &&
      89           0 :           (aMinor < atkMinorVersion ||
      90           0 :            (aMinor == atkMinorVersion && aMicro <= atkMicroVersion)));
      91             : }
      92             : 
      93             : // This is or'd with the pointer in MaiAtkObject::accWrap if the wrap-ee is a
      94             : // proxy.
      95             : static const uintptr_t IS_PROXY = 1;
      96             : 
      97             : /**
      98             :  * This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
      99             :  */
     100             : struct MaiAtkObject
     101             : {
     102             :   AtkObject parent;
     103             :   /*
     104             :    * The AccessibleWrap whose properties and features are exported
     105             :    * via this object instance.
     106             :    */
     107             :   mozilla::a11y::AccessibleOrProxy accWrap;
     108             : 
     109             :   /*
     110             :    * Get the AtkHyperlink for this atk object.
     111             :    */
     112             :   AtkHyperlink* GetAtkHyperlink();
     113             : 
     114             :   /*
     115             :    * Shutdown this AtkObject.
     116             :    */
     117             :   void Shutdown();
     118             : 
     119             :   /*
     120             :    * Notify atk of a state change on this AtkObject.
     121             :    */
     122             :   void FireStateChangeEvent(uint64_t aState, bool aEnabled);
     123             : 
     124             :   /*
     125             :    * Notify ATK of a text change within this ATK object.
     126             :    */
     127             :   void FireTextChangeEvent(const nsString& aStr, int32_t aStart, uint32_t aLen,
     128             :                            bool aIsInsert, bool aIsFromUser);
     129             : 
     130             :   /**
     131             :    * Notify ATK of a shown or hidden subtree rooted at aObject whose parent is
     132             :    * aParent
     133             :    */
     134             :   void FireAtkShowHideEvent(AtkObject* aParent, bool aIsAdded, bool aFromUser);
     135             : 
     136             : private:
     137             :   /*
     138             :    * do we have text-remove and text-insert signals if not we need to use
     139             :    * text-changed see AccessibleWrap::FireAtkTextChangedEvent() and
     140             :    * bug 619002
     141             :    */
     142             :   enum EAvailableAtkSignals {
     143             :     eUnknown,
     144             :     eHaveNewAtkTextSignals,
     145             :     eNoNewAtkSignals
     146             :   };
     147             : 
     148             :   static EAvailableAtkSignals gAvailableAtkSignals;
     149             : };
     150             : 
     151             : #endif /* __NS_MAI_H__ */

Generated by: LCOV version 1.13