XULTabAccessible.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_a11y_XULTabAccessible_h__
  6. #define mozilla_a11y_XULTabAccessible_h__
  7. // NOTE: alphabetically ordered
  8. #include "XULMenuAccessible.h"
  9. #include "XULSelectControlAccessible.h"
  10. namespace mozilla {
  11. namespace a11y {
  12. /**
  13. * An individual tab, xul:tab element.
  14. */
  15. class XULTabAccessible : public AccessibleWrap
  16. {
  17. public:
  18. enum { eAction_Switch = 0 };
  19. XULTabAccessible(nsIContent* aContent, DocAccessible* aDoc);
  20. // Accessible
  21. virtual a11y::role NativeRole() override;
  22. virtual uint64_t NativeState() override;
  23. virtual uint64_t NativeInteractiveState() const override;
  24. virtual Relation RelationByType(RelationType aType) override;
  25. // ActionAccessible
  26. virtual uint8_t ActionCount() override;
  27. virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
  28. virtual bool DoAction(uint8_t aIndex) override;
  29. };
  30. /**
  31. * A container of tab objects, xul:tabs element.
  32. */
  33. class XULTabsAccessible : public XULSelectControlAccessible
  34. {
  35. public:
  36. XULTabsAccessible(nsIContent* aContent, DocAccessible* aDoc);
  37. // Accessible
  38. virtual void Value(nsString& aValue) override;
  39. virtual a11y::role NativeRole() override;
  40. // ActionAccessible
  41. virtual uint8_t ActionCount() override;
  42. protected:
  43. // Accessible
  44. virtual ENameValueFlag NativeName(nsString& aName) override;
  45. };
  46. /**
  47. * A container of tab panels, xul:tabpanels element.
  48. */
  49. class XULTabpanelsAccessible : public AccessibleWrap
  50. {
  51. public:
  52. XULTabpanelsAccessible(nsIContent* aContent, DocAccessible* aDoc) :
  53. AccessibleWrap(aContent, aDoc)
  54. { mType = eXULTabpanelsType; }
  55. // Accessible
  56. virtual a11y::role NativeRole() override;
  57. };
  58. /**
  59. * A tabpanel object, child elements of xul:tabpanels element.
  60. *
  61. * XXX: we need to move the class logic into generic class since
  62. * for example we do not create instance of this class for XUL textbox used as
  63. * a tabpanel.
  64. */
  65. class XULTabpanelAccessible : public AccessibleWrap
  66. {
  67. public:
  68. XULTabpanelAccessible(nsIContent* aContent, DocAccessible* aDoc);
  69. // Accessible
  70. virtual a11y::role NativeRole() override;
  71. virtual Relation RelationByType(RelationType aType) override;
  72. };
  73. } // namespace a11y
  74. } // namespace mozilla
  75. #endif