2010-08-19 11:14:50 +09:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
2007-06-01 20:01:38 -07:00
|
|
|
*/
|
2012-05-21 12:12:37 +01:00
|
|
|
/* 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/. */
|
2007-06-01 20:01:38 -07:00
|
|
|
|
2012-05-12 16:09:07 -04:00
|
|
|
#ifndef mozilla_a11y_ApplicationAccessible_h__
|
|
|
|
#define mozilla_a11y_ApplicationAccessible_h__
|
2007-06-01 20:01:38 -07:00
|
|
|
|
2012-05-28 21:18:45 -04:00
|
|
|
#include "AccessibleWrap.h"
|
2010-03-19 02:49:39 +08:00
|
|
|
|
|
|
|
#include "nsIXULAppInfo.h"
|
2007-06-01 20:01:38 -07:00
|
|
|
|
2012-05-12 16:09:07 -04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
2012-05-29 20:51:00 -04:00
|
|
|
|
2007-06-01 20:01:38 -07:00
|
|
|
/**
|
2012-04-25 20:29:40 +09:00
|
|
|
* ApplicationAccessible is for the whole application of Mozilla.
|
|
|
|
* Only one instance of ApplicationAccessible exists for one Mozilla instance.
|
2007-06-01 20:01:38 -07:00
|
|
|
* And this one should be created when Mozilla Startup (if accessibility
|
|
|
|
* feature has been enabled) and destroyed when Mozilla Shutdown.
|
|
|
|
*
|
|
|
|
* All the accessibility objects for toplevel windows are direct children of
|
2012-04-25 20:29:40 +09:00
|
|
|
* the ApplicationAccessible instance.
|
2007-06-01 20:01:38 -07:00
|
|
|
*/
|
|
|
|
|
2014-10-21 20:49:28 -04:00
|
|
|
class ApplicationAccessible : public AccessibleWrap {
|
2007-06-01 20:01:38 -07:00
|
|
|
public:
|
2012-04-25 20:29:40 +09:00
|
|
|
ApplicationAccessible();
|
2007-06-01 20:01:38 -07:00
|
|
|
|
2018-02-12 15:44:40 -05:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(ApplicationAccessible, AccessibleWrap)
|
2007-06-01 20:01:38 -07:00
|
|
|
|
2021-02-19 23:14:32 +00:00
|
|
|
// LocalAccessible
|
2015-03-21 12:28:04 -04:00
|
|
|
virtual void Shutdown() override;
|
2022-01-18 23:31:21 +00:00
|
|
|
virtual LayoutDeviceIntRect Bounds() const override;
|
2018-04-24 15:07:03 -04:00
|
|
|
virtual nsRect BoundsInAppUnits() const override;
|
2021-06-10 23:07:05 +00:00
|
|
|
virtual already_AddRefed<AccAttributes> NativeAttributes() override;
|
2015-03-21 12:28:04 -04:00
|
|
|
virtual GroupPos GroupPosition() override;
|
2018-05-16 01:13:02 +09:00
|
|
|
virtual ENameValueFlag Name(nsString& aName) const override;
|
2015-03-21 12:28:04 -04:00
|
|
|
virtual void ApplyARIAState(uint64_t* aState) const override;
|
2021-09-02 18:06:51 +00:00
|
|
|
virtual void Description(nsString& aDescription) const override;
|
2018-05-16 01:55:28 +09:00
|
|
|
virtual void Value(nsString& aValue) const override;
|
2018-05-08 04:05:50 +09:00
|
|
|
virtual mozilla::a11y::role NativeRole() const override;
|
2015-03-21 12:28:04 -04:00
|
|
|
virtual uint64_t State() override;
|
2018-05-16 03:04:50 +09:00
|
|
|
virtual uint64_t NativeState() const override;
|
2018-05-15 22:47:10 +09:00
|
|
|
virtual Relation RelationByType(RelationType aType) const override;
|
2011-08-09 18:31:31 +09:00
|
|
|
|
2021-03-03 06:10:01 +00:00
|
|
|
virtual LocalAccessible* LocalChildAtPoint(
|
2021-02-19 23:14:32 +00:00
|
|
|
int32_t aX, int32_t aY, EWhichChildAtPoint aWhichChild) override;
|
2022-08-19 02:42:30 +00:00
|
|
|
virtual Accessible* FocusedChild() override;
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2011-07-19 22:12:40 +09:00
|
|
|
// ActionAccessible
|
2015-03-21 12:28:04 -04:00
|
|
|
virtual KeyBinding AccessKey() const override;
|
2011-07-19 22:12:40 +09:00
|
|
|
|
2014-09-23 08:23:02 -04:00
|
|
|
// ApplicationAccessible
|
2016-04-01 10:57:06 -04:00
|
|
|
void Init();
|
|
|
|
|
2014-09-23 08:23:02 -04:00
|
|
|
void AppName(nsAString& aName) const {
|
2016-05-17 14:11:42 -04:00
|
|
|
MOZ_ASSERT(mAppInfo, "no application info");
|
|
|
|
|
2016-05-16 12:36:25 +10:00
|
|
|
if (mAppInfo) {
|
|
|
|
nsAutoCString cname;
|
|
|
|
mAppInfo->GetName(cname);
|
|
|
|
AppendUTF8toUTF16(cname, aName);
|
|
|
|
}
|
2014-09-23 08:23:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void AppVersion(nsAString& aVersion) const {
|
2016-05-17 14:11:42 -04:00
|
|
|
MOZ_ASSERT(mAppInfo, "no application info");
|
|
|
|
|
2016-05-16 12:36:25 +10:00
|
|
|
if (mAppInfo) {
|
|
|
|
nsAutoCString cversion;
|
|
|
|
mAppInfo->GetVersion(cversion);
|
|
|
|
AppendUTF8toUTF16(cversion, aVersion);
|
|
|
|
}
|
2014-09-23 08:23:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void PlatformName(nsAString& aName) const { aName.AssignLiteral("Gecko"); }
|
|
|
|
|
|
|
|
void PlatformVersion(nsAString& aVersion) const {
|
2016-05-17 14:11:42 -04:00
|
|
|
MOZ_ASSERT(mAppInfo, "no application info");
|
|
|
|
|
2016-05-16 12:36:25 +10:00
|
|
|
if (mAppInfo) {
|
|
|
|
nsAutoCString cversion;
|
|
|
|
mAppInfo->GetPlatformVersion(cversion);
|
|
|
|
AppendUTF8toUTF16(cversion, aVersion);
|
|
|
|
}
|
2014-09-23 08:23:02 -04:00
|
|
|
}
|
|
|
|
|
2007-06-01 20:01:38 -07:00
|
|
|
protected:
|
2014-07-08 17:23:18 -04:00
|
|
|
virtual ~ApplicationAccessible() {}
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2021-02-19 23:14:32 +00:00
|
|
|
// LocalAccessible
|
|
|
|
virtual LocalAccessible* GetSiblingAtOffset(
|
2015-03-21 12:28:04 -04:00
|
|
|
int32_t aOffset, nsresult* aError = nullptr) const override;
|
2010-03-19 02:49:39 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIXULAppInfo> mAppInfo;
|
2007-06-01 20:01:38 -07:00
|
|
|
};
|
|
|
|
|
2021-02-19 23:14:32 +00:00
|
|
|
inline ApplicationAccessible* LocalAccessible::AsApplication() {
|
2014-10-21 20:49:28 -04:00
|
|
|
return IsApplication() ? static_cast<ApplicationAccessible*>(this) : nullptr;
|
|
|
|
}
|
|
|
|
|
2012-05-12 16:09:07 -04:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2007-06-01 20:01:38 -07:00
|
|
|
#endif
|