XULSliderAccessible.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_XULSliderAccessible_h__
  6. #define mozilla_a11y_XULSliderAccessible_h__
  7. #include "AccessibleWrap.h"
  8. #include "nsIDOMElement.h"
  9. namespace mozilla {
  10. namespace a11y {
  11. /**
  12. * Used for XUL slider and scale elements.
  13. */
  14. class XULSliderAccessible : public AccessibleWrap
  15. {
  16. public:
  17. XULSliderAccessible(nsIContent* aContent, DocAccessible* aDoc);
  18. // Accessible
  19. virtual void Value(nsString& aValue) override;
  20. virtual a11y::role NativeRole() override;
  21. virtual uint64_t NativeInteractiveState() const override;
  22. virtual bool NativelyUnavailable() const override;
  23. // Value
  24. virtual double MaxValue() const override;
  25. virtual double MinValue() const override;
  26. virtual double CurValue() const override;
  27. virtual double Step() const override;
  28. virtual bool SetCurValue(double aValue) override;
  29. // ActionAccessible
  30. virtual uint8_t ActionCount() override;
  31. virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
  32. virtual bool DoAction(uint8_t aIndex) override;
  33. protected:
  34. /**
  35. * Return anonymous slider element.
  36. */
  37. nsIContent* GetSliderElement() const;
  38. nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue) const;
  39. nsresult SetSliderAttr(nsIAtom *aName, const nsAString& aValue);
  40. double GetSliderAttr(nsIAtom *aName) const;
  41. bool SetSliderAttr(nsIAtom *aName, double aValue);
  42. private:
  43. mutable nsCOMPtr<nsIContent> mSliderNode;
  44. };
  45. /**
  46. * Used for slider's thumb element.
  47. */
  48. class XULThumbAccessible : public AccessibleWrap
  49. {
  50. public:
  51. XULThumbAccessible(nsIContent* aContent, DocAccessible* aDoc);
  52. // Accessible
  53. virtual a11y::role NativeRole() override;
  54. };
  55. } // namespace a11y
  56. } // namespace mozilla
  57. #endif