2010-08-18 19:14:50 -07: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 04:12:37 -07: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 13:09:07 -07:00
|
|
|
#ifndef mozilla_a11y_ApplicationAccessible_h__
|
|
|
|
#define mozilla_a11y_ApplicationAccessible_h__
|
2007-06-01 20:01:38 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
#include "AccessibleWrap.h"
|
2010-03-18 11:49:39 -07:00
|
|
|
|
2007-06-01 20:01:38 -07:00
|
|
|
#include "nsIMutableArray.h"
|
2010-03-18 11:49:39 -07:00
|
|
|
#include "nsIXULAppInfo.h"
|
2007-06-01 20:01:38 -07:00
|
|
|
|
2012-05-12 13:09:07 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
2012-05-29 17:51:00 -07:00
|
|
|
|
2007-06-01 20:01:38 -07:00
|
|
|
/**
|
2012-04-25 04:29:40 -07: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 04:29:40 -07:00
|
|
|
* the ApplicationAccessible instance.
|
2007-06-01 20:01:38 -07:00
|
|
|
*/
|
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
class ApplicationAccessible : public AccessibleWrap
|
2007-06-01 20:01:38 -07:00
|
|
|
{
|
|
|
|
public:
|
2010-08-18 19:14:50 -07:00
|
|
|
|
2012-04-25 04:29:40 -07:00
|
|
|
ApplicationAccessible();
|
2007-06-01 20:01:38 -07:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void Shutdown() override;
|
|
|
|
virtual nsIntRect Bounds() const override;
|
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
|
|
|
|
virtual GroupPos GroupPosition() override;
|
|
|
|
virtual ENameValueFlag Name(nsString& aName) override;
|
|
|
|
virtual void ApplyARIAState(uint64_t* aState) const override;
|
|
|
|
virtual void Description(nsString& aDescription) override;
|
|
|
|
virtual void Value(nsString& aValue) override;
|
|
|
|
virtual mozilla::a11y::role NativeRole() override;
|
|
|
|
virtual uint64_t State() override;
|
|
|
|
virtual uint64_t NativeState() override;
|
|
|
|
virtual Relation RelationByType(RelationType aType) override;
|
2011-08-09 02:31:31 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
|
2015-03-21 09:28:04 -07:00
|
|
|
EWhichChildAtPoint aWhichChild) override;
|
|
|
|
virtual Accessible* FocusedChild() override;
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void InvalidateChildren() override;
|
2007-06-01 20:01:38 -07:00
|
|
|
|
2011-07-19 06:12:40 -07:00
|
|
|
// ActionAccessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual KeyBinding AccessKey() const override;
|
2011-07-19 06:12:40 -07:00
|
|
|
|
2014-09-23 05:23:02 -07:00
|
|
|
// ApplicationAccessible
|
|
|
|
void AppName(nsAString& aName) const
|
|
|
|
{
|
|
|
|
nsAutoCString cname;
|
|
|
|
mAppInfo->GetName(cname);
|
|
|
|
AppendUTF8toUTF16(cname, aName);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AppVersion(nsAString& aVersion) const
|
|
|
|
{
|
|
|
|
nsAutoCString cversion;
|
|
|
|
mAppInfo->GetVersion(cversion);
|
|
|
|
AppendUTF8toUTF16(cversion, aVersion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PlatformName(nsAString& aName) const
|
|
|
|
{
|
|
|
|
aName.AssignLiteral("Gecko");
|
|
|
|
}
|
|
|
|
|
|
|
|
void PlatformVersion(nsAString& aVersion) const
|
|
|
|
{
|
|
|
|
nsAutoCString cversion;
|
|
|
|
mAppInfo->GetPlatformVersion(cversion);
|
|
|
|
AppendUTF8toUTF16(cversion, aVersion);
|
|
|
|
}
|
|
|
|
|
2007-06-01 20:01:38 -07:00
|
|
|
protected:
|
2014-07-08 14:23:18 -07:00
|
|
|
virtual ~ApplicationAccessible() {}
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void CacheChildren() override;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsresult *aError = nullptr) const override;
|
2010-03-18 11:49:39 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIXULAppInfo> mAppInfo;
|
2007-06-01 20:01:38 -07:00
|
|
|
};
|
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
inline ApplicationAccessible*
|
|
|
|
Accessible::AsApplication()
|
|
|
|
{
|
|
|
|
return IsApplication() ? static_cast<ApplicationAccessible*>(this) : nullptr;
|
|
|
|
}
|
|
|
|
|
2012-05-12 13:09:07 -07:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2007-06-01 20:01:38 -07:00
|
|
|
#endif
|
|
|
|
|