ScrollAreaEvent.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* -*- Mode: C++; tab-width: 8; 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_dom_ScrollAreaEvent_h_
  6. #define mozilla_dom_ScrollAreaEvent_h_
  7. #include "mozilla/dom/DOMRect.h"
  8. #include "mozilla/dom/ScrollAreaEventBinding.h"
  9. #include "mozilla/dom/UIEvent.h"
  10. #include "mozilla/Attributes.h"
  11. #include "mozilla/EventForwards.h"
  12. namespace mozilla {
  13. namespace dom {
  14. class ScrollAreaEvent : public UIEvent
  15. {
  16. public:
  17. ScrollAreaEvent(EventTarget* aOwner,
  18. nsPresContext* aPresContext,
  19. InternalScrollAreaEvent* aEvent);
  20. NS_DECL_ISUPPORTS_INHERITED
  21. NS_FORWARD_NSIDOMUIEVENT(UIEvent::)
  22. NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION
  23. NS_IMETHOD DuplicatePrivateData() override
  24. {
  25. return Event::DuplicatePrivateData();
  26. }
  27. NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
  28. NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
  29. virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
  30. {
  31. return ScrollAreaEventBinding::Wrap(aCx, this, aGivenProto);
  32. }
  33. float X() const
  34. {
  35. return mClientArea->Left();
  36. }
  37. float Y() const
  38. {
  39. return mClientArea->Top();
  40. }
  41. float Width() const
  42. {
  43. return mClientArea->Width();
  44. }
  45. float Height() const
  46. {
  47. return mClientArea->Height();
  48. }
  49. void InitScrollAreaEvent(const nsAString& aType,
  50. bool aCanBubble,
  51. bool aCancelable,
  52. nsGlobalWindow* aView,
  53. int32_t aDetail,
  54. float aX, float aY,
  55. float aWidth, float aHeight);
  56. protected:
  57. ~ScrollAreaEvent() {}
  58. RefPtr<DOMRect> mClientArea;
  59. };
  60. } // namespace dom
  61. } // namespace mozilla
  62. already_AddRefed<mozilla::dom::ScrollAreaEvent>
  63. NS_NewDOMScrollAreaEvent(mozilla::dom::EventTarget* aOwner,
  64. nsPresContext* aPresContext,
  65. mozilla::InternalScrollAreaEvent* aEvent);
  66. #endif // mozilla_dom_ScrollAreaEvent_h_