#ifndef WheelEvent_h
#define WheelEvent_h
#include "EventDispatchMediator.h"
#include "FloatPoint.h"
#include "MouseRelatedEvent.h"
namespace WebCore {
class WheelEvent : public MouseRelatedEvent {
public:
enum { tickMultiplier = 120 };
enum Granularity { Pixel, Line, Page };
static PassRefPtr<WheelEvent> create()
{
return adoptRef(new WheelEvent);
}
static PassRefPtr<WheelEvent> create(const FloatPoint& wheelTicks,
const FloatPoint& rawDelta, Granularity granularity, PassRefPtr<AbstractView> view,
const IntPoint& screenLocation, const IntPoint& pageLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice)
{
return adoptRef(new WheelEvent(wheelTicks, rawDelta, granularity, view,
screenLocation, pageLocation, ctrlKey, altKey, shiftKey, metaKey, directionInvertedFromDevice));
}
void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
int wheelDelta() const { return m_wheelDelta.y() ? m_wheelDelta.y() : m_wheelDelta.x(); }
int wheelDeltaX() const { return m_wheelDelta.x(); }
int wheelDeltaY() const { return m_wheelDelta.y(); }
int rawDeltaX() const { return m_rawDelta.x(); }
int rawDeltaY() const { return m_rawDelta.y(); }
Granularity granularity() const { return m_granularity; }
bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedFromDevice; }
bool isHorizontal() const { return m_wheelDelta.x(); }
virtual const AtomicString& interfaceName() const;
private:
WheelEvent();
WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
Granularity granularity, PassRefPtr<AbstractView>,
const IntPoint& screenLocation, const IntPoint& pageLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice);
IntPoint m_wheelDelta;
IntPoint m_rawDelta;
Granularity m_granularity;
bool m_directionInvertedFromDevice;
};
class WheelEventDispatchMediator : public EventDispatchMediator {
public:
static PassRefPtr<WheelEventDispatchMediator> create(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
private:
WheelEventDispatchMediator(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
WheelEvent* event() const;
virtual bool dispatchEvent(EventDispatcher*) const;
};
}
#endif // WheelEvent_h