nsMaiHyperlink.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 __MAI_HYPERLINK_H__
  6. #define __MAI_HYPERLINK_H__
  7. #include "nsMai.h"
  8. #include "Accessible.h"
  9. struct _AtkHyperlink;
  10. typedef struct _AtkHyperlink AtkHyperlink;
  11. namespace mozilla {
  12. namespace a11y {
  13. /*
  14. * MaiHyperlink is a auxiliary class for MaiInterfaceHyperText.
  15. */
  16. class MaiHyperlink
  17. {
  18. public:
  19. explicit MaiHyperlink(AccessibleOrProxy aHyperLink);
  20. ~MaiHyperlink();
  21. public:
  22. AtkHyperlink* GetAtkHyperlink() const { return mMaiAtkHyperlink; }
  23. Accessible* GetAccHyperlink()
  24. {
  25. if (!mHyperlink.IsAccessible())
  26. return nullptr;
  27. Accessible* link = mHyperlink.AsAccessible();
  28. if (!link) {
  29. return nullptr;
  30. }
  31. NS_ASSERTION(link->IsLink(), "Why isn't it a link!");
  32. return link;
  33. }
  34. ProxyAccessible* Proxy() const { return mHyperlink.AsProxy(); }
  35. protected:
  36. AccessibleOrProxy mHyperlink;
  37. AtkHyperlink* mMaiAtkHyperlink;
  38. };
  39. } // namespace a11y
  40. } // namespace mozilla
  41. #endif /* __MAI_HYPERLINK_H__ */