FormControlAccessible.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_FormControlAccessible_H_
  6. #define MOZILLA_A11Y_FormControlAccessible_H_
  7. #include "BaseAccessibles.h"
  8. namespace mozilla {
  9. namespace a11y {
  10. /**
  11. * Generic class used for progress meters.
  12. */
  13. template<int Max>
  14. class ProgressMeterAccessible : public LeafAccessible
  15. {
  16. public:
  17. ProgressMeterAccessible(nsIContent* aContent, DocAccessible* aDoc) :
  18. LeafAccessible(aContent, aDoc)
  19. {
  20. // Ignore 'ValueChange' DOM event in lieu of @value attribute change
  21. // notifications.
  22. mStateFlags |= eHasNumericValue | eIgnoreDOMUIEvent;
  23. mType = eProgressType;
  24. }
  25. // Accessible
  26. virtual void Value(nsString& aValue) override;
  27. virtual mozilla::a11y::role NativeRole() override;
  28. virtual uint64_t NativeState() override;
  29. // Value
  30. virtual double MaxValue() const override;
  31. virtual double MinValue() const override;
  32. virtual double CurValue() const override;
  33. virtual double Step() const override;
  34. virtual bool SetCurValue(double aValue) override;
  35. // Widgets
  36. virtual bool IsWidget() const override;
  37. protected:
  38. virtual ~ProgressMeterAccessible() {}
  39. };
  40. /**
  41. * Generic class used for radio buttons.
  42. */
  43. class RadioButtonAccessible : public LeafAccessible
  44. {
  45. public:
  46. RadioButtonAccessible(nsIContent* aContent, DocAccessible* aDoc);
  47. // Accessible
  48. virtual mozilla::a11y::role NativeRole() override;
  49. // ActionAccessible
  50. virtual uint8_t ActionCount() override;
  51. virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
  52. virtual bool DoAction(uint8_t aIndex) override;
  53. enum { eAction_Click = 0 };
  54. // Widgets
  55. virtual bool IsWidget() const override;
  56. };
  57. } // namespace a11y
  58. } // namespace mozilla
  59. #endif