tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsMai.h (3379B)


      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 "AccessibleWrap.h"
     15 
     16 namespace mozilla {
     17 namespace a11y {
     18 class RemoteAccessible;
     19 class Accessible;
     20 }  // namespace a11y
     21 }  // namespace mozilla
     22 
     23 #define MAI_TYPE_ATK_OBJECT (mai_atk_object_get_type())
     24 #define MAI_ATK_OBJECT(obj) \
     25  (G_TYPE_CHECK_INSTANCE_CAST((obj), MAI_TYPE_ATK_OBJECT, MaiAtkObject))
     26 #define MAI_ATK_OBJECT_CLASS(klass) \
     27  (G_TYPE_CHECK_CLASS_CAST((klass), MAI_TYPE_ATK_OBJECT, MaiAtkObjectClass))
     28 #define IS_MAI_OBJECT(obj) \
     29  (G_TYPE_CHECK_INSTANCE_TYPE((obj), MAI_TYPE_ATK_OBJECT))
     30 #define IS_MAI_OBJECT_CLASS(klass) \
     31  (G_TYPE_CHECK_CLASS_TYPE((klass), MAI_TYPE_ATK_OBJECT))
     32 #define MAI_ATK_OBJECT_GET_CLASS(obj) \
     33  (G_TYPE_INSTANCE_GET_CLASS((obj), MAI_TYPE_ATK_OBJECT, MaiAtkObjectClass))
     34 GType mai_atk_object_get_type(void);
     35 GType mai_util_get_type();
     36 
     37 // This is a pointer to the atk_table_cell_get_type function if we are using
     38 // a version of atk that defines that.
     39 extern "C" GType (*gAtkTableCellGetTypeFunc)();
     40 
     41 mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
     42 mozilla::a11y::RemoteAccessible* GetProxy(AtkObject* aAtkObj);
     43 mozilla::a11y::Accessible* GetInternalObj(AtkObject* aObj);
     44 AtkObject* GetWrapperFor(mozilla::a11y::Accessible* acc);
     45 
     46 extern int atkMajorVersion, atkMinorVersion, atkMicroVersion;
     47 
     48 /**
     49 * Return true if the loaded version of libatk-1.0.so is at least
     50 * aMajor.aMinor.aMicro.
     51 */
     52 static inline bool IsAtkVersionAtLeast(int aMajor, int aMinor, int aMicro = 0) {
     53  return aMajor < atkMajorVersion ||
     54         (aMajor == atkMajorVersion &&
     55          (aMinor < atkMinorVersion ||
     56           (aMinor == atkMinorVersion && aMicro <= atkMicroVersion)));
     57 }
     58 
     59 /**
     60 * This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
     61 */
     62 struct MaiAtkObject {
     63  AtkObject parent;
     64  /*
     65   * The AccessibleWrap whose properties and features are exported
     66   * via this object instance.
     67   */
     68  mozilla::a11y::Accessible* acc;
     69 
     70  /*
     71   * Get the AtkHyperlink for this atk object.
     72   */
     73  AtkHyperlink* GetAtkHyperlink();
     74 
     75  /*
     76   * Shutdown this AtkObject.
     77   */
     78  void Shutdown();
     79 
     80  /*
     81   * Notify atk of a state change on this AtkObject.
     82   */
     83  void FireStateChangeEvent(uint64_t aState, bool aEnabled);
     84 
     85  /*
     86   * Notify ATK of a text change within this ATK object.
     87   */
     88  void FireTextChangeEvent(const nsAString& aStr, int32_t aStart, uint32_t aLen,
     89                           bool aIsInsert, bool aIsFromUser);
     90 
     91  /**
     92   * Notify ATK of a shown or hidden subtree rooted at aObject whose parent is
     93   * aParent
     94   */
     95  void FireAtkShowHideEvent(AtkObject* aParent, bool aIsAdded, bool aFromUser);
     96 
     97 private:
     98  /*
     99   * do we have text-remove and text-insert signals if not we need to use
    100   * text-changed see AccessibleWrap::FireAtkTextChangedEvent() and
    101   * bug 619002
    102   */
    103  enum EAvailableAtkSignals {
    104    eUnknown,
    105    eHaveNewAtkTextSignals,
    106    eNoNewAtkSignals
    107  };
    108 
    109  static EAvailableAtkSignals gAvailableAtkSignals;
    110 };
    111 
    112 #endif /* __NS_MAI_H__ */