dom/events/ScrollAreaEvent.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/ScrollAreaEvent.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,86 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef mozilla_dom_ScrollAreaEvent_h_
    1.10 +#define mozilla_dom_ScrollAreaEvent_h_
    1.11 +
    1.12 +#include "mozilla/dom/DOMRect.h"
    1.13 +#include "mozilla/dom/ScrollAreaEventBinding.h"
    1.14 +#include "mozilla/dom/UIEvent.h"
    1.15 +#include "mozilla/Attributes.h"
    1.16 +#include "mozilla/EventForwards.h"
    1.17 +#include "nsIDOMScrollAreaEvent.h"
    1.18 +
    1.19 +namespace mozilla {
    1.20 +namespace dom {
    1.21 +
    1.22 +class ScrollAreaEvent : public UIEvent,
    1.23 +                        public nsIDOMScrollAreaEvent
    1.24 +{
    1.25 +public:
    1.26 +  ScrollAreaEvent(EventTarget* aOwner,
    1.27 +                  nsPresContext* aPresContext,
    1.28 +                  InternalScrollAreaEvent* aEvent);
    1.29 +
    1.30 +  NS_DECL_ISUPPORTS_INHERITED
    1.31 +
    1.32 +  NS_DECL_NSIDOMSCROLLAREAEVENT
    1.33 +
    1.34 +  NS_FORWARD_NSIDOMUIEVENT(UIEvent::)
    1.35 +
    1.36 +  NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION
    1.37 +  NS_IMETHOD DuplicatePrivateData()
    1.38 +  {
    1.39 +    return Event::DuplicatePrivateData();
    1.40 +  }
    1.41 +  NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) MOZ_OVERRIDE;
    1.42 +  NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) MOZ_OVERRIDE;
    1.43 +
    1.44 +  virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
    1.45 +  {
    1.46 +    return ScrollAreaEventBinding::Wrap(aCx, this);
    1.47 +  }
    1.48 +
    1.49 +  float X() const
    1.50 +  {
    1.51 +    return mClientArea.Left();
    1.52 +  }
    1.53 +
    1.54 +  float Y() const
    1.55 +  {
    1.56 +    return mClientArea.Top();
    1.57 +  }
    1.58 +
    1.59 +  float Width() const
    1.60 +  {
    1.61 +    return mClientArea.Width();
    1.62 +  }
    1.63 +
    1.64 +  float Height() const
    1.65 +  {
    1.66 +    return mClientArea.Height();
    1.67 +  }
    1.68 +
    1.69 +  void InitScrollAreaEvent(const nsAString& aType,
    1.70 +                           bool aCanBubble,
    1.71 +                           bool aCancelable,
    1.72 +                           nsIDOMWindow* aView,
    1.73 +                           int32_t aDetail,
    1.74 +                           float aX, float aY,
    1.75 +                           float aWidth, float aHeight,
    1.76 +                           ErrorResult& aRv)
    1.77 +  {
    1.78 +    aRv = InitScrollAreaEvent(aType, aCanBubble, aCancelable, aView,
    1.79 +                              aDetail, aX, aY, aWidth, aHeight);
    1.80 +  }
    1.81 +
    1.82 +protected:
    1.83 +  DOMRect mClientArea;
    1.84 +};
    1.85 +
    1.86 +} // namespace dom
    1.87 +} // namespace mozilla
    1.88 +
    1.89 +#endif // mozilla_dom_ScrollAreaEvent_h_

mercurial