|
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 |
|
6 #ifndef mozilla_dom_ScrollAreaEvent_h_ |
|
7 #define mozilla_dom_ScrollAreaEvent_h_ |
|
8 |
|
9 #include "mozilla/dom/DOMRect.h" |
|
10 #include "mozilla/dom/ScrollAreaEventBinding.h" |
|
11 #include "mozilla/dom/UIEvent.h" |
|
12 #include "mozilla/Attributes.h" |
|
13 #include "mozilla/EventForwards.h" |
|
14 #include "nsIDOMScrollAreaEvent.h" |
|
15 |
|
16 namespace mozilla { |
|
17 namespace dom { |
|
18 |
|
19 class ScrollAreaEvent : public UIEvent, |
|
20 public nsIDOMScrollAreaEvent |
|
21 { |
|
22 public: |
|
23 ScrollAreaEvent(EventTarget* aOwner, |
|
24 nsPresContext* aPresContext, |
|
25 InternalScrollAreaEvent* aEvent); |
|
26 |
|
27 NS_DECL_ISUPPORTS_INHERITED |
|
28 |
|
29 NS_DECL_NSIDOMSCROLLAREAEVENT |
|
30 |
|
31 NS_FORWARD_NSIDOMUIEVENT(UIEvent::) |
|
32 |
|
33 NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION |
|
34 NS_IMETHOD DuplicatePrivateData() |
|
35 { |
|
36 return Event::DuplicatePrivateData(); |
|
37 } |
|
38 NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) MOZ_OVERRIDE; |
|
39 NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) MOZ_OVERRIDE; |
|
40 |
|
41 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE |
|
42 { |
|
43 return ScrollAreaEventBinding::Wrap(aCx, this); |
|
44 } |
|
45 |
|
46 float X() const |
|
47 { |
|
48 return mClientArea.Left(); |
|
49 } |
|
50 |
|
51 float Y() const |
|
52 { |
|
53 return mClientArea.Top(); |
|
54 } |
|
55 |
|
56 float Width() const |
|
57 { |
|
58 return mClientArea.Width(); |
|
59 } |
|
60 |
|
61 float Height() const |
|
62 { |
|
63 return mClientArea.Height(); |
|
64 } |
|
65 |
|
66 void InitScrollAreaEvent(const nsAString& aType, |
|
67 bool aCanBubble, |
|
68 bool aCancelable, |
|
69 nsIDOMWindow* aView, |
|
70 int32_t aDetail, |
|
71 float aX, float aY, |
|
72 float aWidth, float aHeight, |
|
73 ErrorResult& aRv) |
|
74 { |
|
75 aRv = InitScrollAreaEvent(aType, aCanBubble, aCancelable, aView, |
|
76 aDetail, aX, aY, aWidth, aHeight); |
|
77 } |
|
78 |
|
79 protected: |
|
80 DOMRect mClientArea; |
|
81 }; |
|
82 |
|
83 } // namespace dom |
|
84 } // namespace mozilla |
|
85 |
|
86 #endif // mozilla_dom_ScrollAreaEvent_h_ |