SVGZoomEvent.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_SVGZoomEvent_h
  6. #define mozilla_dom_SVGZoomEvent_h
  7. #include "DOMSVGPoint.h"
  8. #include "mozilla/dom/UIEvent.h"
  9. #include "mozilla/dom/SVGZoomEventBinding.h"
  10. #include "mozilla/EventForwards.h"
  11. class nsPresContext;
  12. namespace mozilla {
  13. class nsISVGPoint;
  14. namespace dom {
  15. class SVGZoomEvent final : public UIEvent
  16. {
  17. public:
  18. NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGZoomEvent, UIEvent)
  19. NS_DECL_ISUPPORTS_INHERITED
  20. SVGZoomEvent(EventTarget* aOwner, nsPresContext* aPresContext,
  21. InternalSVGZoomEvent* aEvent);
  22. // Forward to base class
  23. NS_FORWARD_TO_UIEVENT
  24. virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
  25. {
  26. return SVGZoomEventBinding::Wrap(aCx, this, aGivenProto);
  27. }
  28. float PreviousScale() const
  29. {
  30. return mPreviousScale;
  31. }
  32. nsISVGPoint* GetPreviousTranslate() const
  33. {
  34. return mPreviousTranslate;
  35. }
  36. float NewScale() const
  37. {
  38. return mNewScale;
  39. }
  40. nsISVGPoint* GetNewTranslate() const
  41. {
  42. return mNewTranslate;
  43. }
  44. private:
  45. ~SVGZoomEvent();
  46. float mPreviousScale;
  47. float mNewScale;
  48. RefPtr<DOMSVGPoint> mPreviousTranslate;
  49. RefPtr<DOMSVGPoint> mNewTranslate;
  50. };
  51. } // namespace dom
  52. } // namespace mozilla
  53. already_AddRefed<mozilla::dom::SVGZoomEvent>
  54. NS_NewDOMSVGZoomEvent(mozilla::dom::EventTarget* aOwner,
  55. nsPresContext* aPresContext,
  56. mozilla::InternalSVGZoomEvent* aEvent);
  57. #endif // mozilla_dom_SVGZoomEvent_h