PlatformMouseEvent.h [plain text]
#ifndef PlatformMouseEvent_h
#define PlatformMouseEvent_h
#include "IntPoint.h"
#include "PlatformEvent.h"
#if PLATFORM(GTK)
typedef struct _GdkEventButton GdkEventButton;
typedef struct _GdkEventMotion GdkEventMotion;
#endif
#if PLATFORM(EFL)
typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down;
typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up;
typedef struct _Evas_Event_Mouse_Move Evas_Event_Mouse_Move;
#endif
#if PLATFORM(WIN)
typedef struct HWND__* HWND;
typedef unsigned UINT;
typedef unsigned WPARAM;
typedef long LPARAM;
#endif
#if PLATFORM(WX)
class wxMouseEvent;
#endif
namespace WebCore {
enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton };
#if PLATFORM(BLACKBERRY)
enum MouseInputMethod { PointingDevice, TouchScreen };
#endif
class PlatformMouseEvent : public PlatformEvent {
public:
PlatformMouseEvent()
: PlatformEvent(PlatformEvent::MouseMoved)
, m_button(NoButton)
, m_clickCount(0)
, m_modifierFlags(0)
{
}
PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type,
int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp)
: PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
, m_position(position)
, m_globalPosition(globalPosition)
, m_button(button)
, m_clickCount(clickCount)
, m_modifierFlags(0)
{
}
const IntPoint& position() const { return m_position; }
const IntPoint& globalPosition() const { return m_globalPosition; }
#if ENABLE(POINTER_LOCK)
const IntPoint& movementDelta() const { return m_movementDelta; }
#endif
MouseButton button() const { return m_button; }
int clickCount() const { return m_clickCount; }
unsigned modifierFlags() const { return m_modifierFlags; }
#if PLATFORM(GTK)
PlatformMouseEvent(GdkEventButton*);
PlatformMouseEvent(GdkEventMotion*);
void setClickCount(int count) { m_clickCount = count; }
#endif
#if PLATFORM(EFL)
void setClickCount(unsigned int);
PlatformMouseEvent(const Evas_Event_Mouse_Down*, IntPoint);
PlatformMouseEvent(const Evas_Event_Mouse_Up*, IntPoint);
PlatformMouseEvent(const Evas_Event_Mouse_Move*, IntPoint);
#endif
#if PLATFORM(WIN)
PlatformMouseEvent(HWND, UINT, WPARAM, LPARAM, bool didActivateWebView = false);
void setClickCount(int count) { m_clickCount = count; }
bool didActivateWebView() const { return m_didActivateWebView; }
#endif
#if PLATFORM(WX)
PlatformMouseEvent(const wxMouseEvent&, const wxPoint& globalPoint, int clickCount);
#endif
#if PLATFORM(BLACKBERRY)
PlatformMouseEvent(const IntPoint& eventPosition, const IntPoint& globalPosition, const PlatformEvent::Type, int clickCount, MouseButton, MouseInputMethod = PointingDevice);
MouseInputMethod inputMethod() const { return m_inputMethod; }
#endif
protected:
IntPoint m_position;
IntPoint m_globalPosition;
#if ENABLE(POINTER_LOCK)
IntPoint m_movementDelta;
#endif
MouseButton m_button;
int m_clickCount;
unsigned m_modifierFlags;
};
}
#endif // PlatformMouseEvent_h