2012-12-02 00:58:25 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2016-08-18 15:49:13 +00:00
|
|
|
#ifndef mozilla_a11y_Platform_h
|
|
|
|
#define mozilla_a11y_Platform_h
|
|
|
|
|
2014-09-30 14:00:26 +00:00
|
|
|
#include <stdint.h>
|
2017-08-16 23:48:52 +00:00
|
|
|
#include "nsStringFwd.h"
|
2023-07-05 04:15:27 +00:00
|
|
|
#include "Units.h"
|
2015-06-05 19:43:30 +00:00
|
|
|
|
2018-11-06 04:22:08 +00:00
|
|
|
#if defined(ANDROID)
|
|
|
|
# include "nsTArray.h"
|
|
|
|
# include "nsRect.h"
|
|
|
|
#endif
|
|
|
|
|
2020-10-14 00:04:49 +00:00
|
|
|
#ifdef MOZ_WIDGET_COCOA
|
|
|
|
# include "mozilla/a11y/Role.h"
|
2023-04-18 13:43:19 +00:00
|
|
|
# include "nsTArray.h"
|
2020-10-14 00:04:49 +00:00
|
|
|
#endif
|
|
|
|
|
2012-12-02 00:58:25 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2023-07-19 02:56:53 +00:00
|
|
|
class Accessible;
|
2021-02-19 23:14:33 +00:00
|
|
|
class RemoteAccessible;
|
2014-03-07 21:35:19 +00:00
|
|
|
|
2012-12-02 00:58:25 +00:00
|
|
|
enum EPlatformDisabledState {
|
|
|
|
ePlatformIsForceEnabled = -1,
|
|
|
|
ePlatformIsEnabled = 0,
|
|
|
|
ePlatformIsDisabled = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the platform disabled state.
|
|
|
|
*/
|
|
|
|
EPlatformDisabledState PlatformDisabledState();
|
|
|
|
|
|
|
|
#ifdef MOZ_ACCESSIBILITY_ATK
|
|
|
|
/**
|
|
|
|
* Perform initialization that should be done as soon as possible, in order
|
|
|
|
* to minimize startup time.
|
|
|
|
* XXX: this function and the next defined in ApplicationAccessibleWrap.cpp
|
|
|
|
*/
|
|
|
|
void PreInit();
|
|
|
|
#endif
|
|
|
|
|
2024-03-04 21:11:49 +00:00
|
|
|
#if defined(MOZ_ACCESSIBILITY_ATK) || defined(XP_DARWIN)
|
2012-12-02 00:58:25 +00:00
|
|
|
/**
|
|
|
|
* Is platform accessibility enabled.
|
2024-03-04 21:11:49 +00:00
|
|
|
* Only used on Linux, MacOS and iOS for now.
|
2012-12-02 00:58:25 +00:00
|
|
|
*/
|
|
|
|
bool ShouldA11yBeEnabled();
|
|
|
|
#endif
|
|
|
|
|
2017-06-15 16:05:26 +00:00
|
|
|
#if defined(XP_WIN)
|
2017-08-10 20:30:23 +00:00
|
|
|
/*
|
|
|
|
* Name of platform service that instantiated accessibility
|
|
|
|
*/
|
2017-12-05 00:56:31 +00:00
|
|
|
void SetInstantiator(const uint32_t aInstantiatorPid);
|
|
|
|
bool GetInstantiator(nsIFile** aOutInstantiator);
|
2017-06-15 16:05:26 +00:00
|
|
|
#endif
|
|
|
|
|
2012-12-02 00:58:25 +00:00
|
|
|
/**
|
|
|
|
* Called to initialize platform specific accessibility support.
|
|
|
|
* Note this is called after internal accessibility support is initialized.
|
|
|
|
*/
|
|
|
|
void PlatformInit();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shutdown platform accessibility.
|
|
|
|
* Note this is called before internal accessibility support is shutdown.
|
|
|
|
*/
|
|
|
|
void PlatformShutdown();
|
|
|
|
|
2014-03-07 21:35:19 +00:00
|
|
|
/**
|
2021-02-19 23:14:33 +00:00
|
|
|
* called when a new RemoteAccessible is created, so the platform may setup a
|
2014-03-07 21:35:19 +00:00
|
|
|
* wrapper for it, or take other action.
|
|
|
|
*/
|
2021-03-02 16:32:24 +00:00
|
|
|
void ProxyCreated(RemoteAccessible* aProxy);
|
2014-03-07 21:35:19 +00:00
|
|
|
|
|
|
|
/**
|
2021-02-19 23:14:33 +00:00
|
|
|
* Called just before a RemoteAccessible is destroyed so its wrapper can be
|
2014-03-07 21:35:19 +00:00
|
|
|
* disposed of and other action taken.
|
|
|
|
*/
|
2021-02-19 23:14:33 +00:00
|
|
|
void ProxyDestroyed(RemoteAccessible*);
|
2014-09-30 14:00:26 +00:00
|
|
|
|
|
|
|
/**
|
2023-07-19 02:56:53 +00:00
|
|
|
* Called when an event is fired on an Accessible so that platforms may fire
|
|
|
|
* events if appropriate.
|
2014-09-30 14:00:26 +00:00
|
|
|
*/
|
2023-07-19 02:56:53 +00:00
|
|
|
void PlatformEvent(Accessible* aTarget, uint32_t aEventType);
|
|
|
|
void PlatformStateChangeEvent(Accessible* aTarget, uint64_t aState,
|
2023-07-19 02:56:53 +00:00
|
|
|
bool aEnabled);
|
|
|
|
|
2023-07-19 02:56:53 +00:00
|
|
|
void PlatformFocusEvent(Accessible* aTarget,
|
2023-07-19 02:56:53 +00:00
|
|
|
const LayoutDeviceIntRect& aCaretRect);
|
2023-07-19 02:56:53 +00:00
|
|
|
void PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset,
|
2023-07-19 02:56:53 +00:00
|
|
|
bool aIsSelectionCollapsed, int32_t aGranularity,
|
2023-11-29 03:53:19 +00:00
|
|
|
const LayoutDeviceIntRect& aCaretRect,
|
|
|
|
bool aFromUser);
|
2023-07-19 02:56:53 +00:00
|
|
|
void PlatformTextChangeEvent(Accessible* aTarget, const nsAString& aStr,
|
2023-07-19 02:56:53 +00:00
|
|
|
int32_t aStart, uint32_t aLen, bool aIsInsert,
|
|
|
|
bool aFromUser);
|
2023-07-19 02:56:53 +00:00
|
|
|
void PlatformShowHideEvent(Accessible* aTarget, Accessible* aParent,
|
2023-07-19 02:56:53 +00:00
|
|
|
bool aInsert, bool aFromUser);
|
2023-07-19 02:56:53 +00:00
|
|
|
void PlatformSelectionEvent(Accessible* aTarget, Accessible* aWidget,
|
|
|
|
uint32_t aType);
|
2018-06-21 11:47:00 +00:00
|
|
|
|
|
|
|
#if defined(ANDROID)
|
2023-07-19 02:56:53 +00:00
|
|
|
void PlatformScrollingEvent(Accessible* aTarget, uint32_t aEventType,
|
2023-07-19 02:56:53 +00:00
|
|
|
uint32_t aScrollX, uint32_t aScrollY,
|
|
|
|
uint32_t aMaxScrollX, uint32_t aMaxScrollY);
|
2018-11-06 04:22:08 +00:00
|
|
|
|
2023-07-19 02:56:53 +00:00
|
|
|
void PlatformAnnouncementEvent(Accessible* aTarget,
|
2023-07-19 02:56:53 +00:00
|
|
|
const nsAString& aAnnouncement,
|
|
|
|
uint16_t aPriority);
|
2019-03-05 19:36:05 +00:00
|
|
|
|
2022-05-13 05:00:55 +00:00
|
|
|
bool LocalizeString(const nsAString& aToken, nsAString& aLocalized);
|
2018-06-21 11:47:00 +00:00
|
|
|
#endif
|
2018-11-06 04:22:08 +00:00
|
|
|
|
2020-07-06 17:32:45 +00:00
|
|
|
#ifdef MOZ_WIDGET_COCOA
|
2023-07-19 02:56:54 +00:00
|
|
|
class TextRange;
|
|
|
|
void PlatformTextSelectionChangeEvent(Accessible* aTarget,
|
|
|
|
const nsTArray<TextRange>& aSelection);
|
2020-10-14 00:04:49 +00:00
|
|
|
|
2023-07-19 02:56:53 +00:00
|
|
|
void PlatformRoleChangedEvent(Accessible* aTarget, const a11y::role& aRole,
|
2023-07-19 02:56:53 +00:00
|
|
|
uint8_t aRoleMapEntryIndex);
|
2020-07-06 17:32:45 +00:00
|
|
|
#endif
|
|
|
|
|
2012-12-02 00:58:25 +00:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-08-18 15:49:13 +00:00
|
|
|
#endif // mozilla_a11y_Platform_h
|