Vaca::MouseEvent Class Reference

#include <MouseEvent.h>

Inheritance diagram for Vaca::MouseEvent:

Vaca::Event

List of all members.


Detailed Description

An event from the mouse.

It has a trigger mouse button (the button of the mouse that was the trigger of the event), a point where the event was happend (relative to the widget's client area).

This kind of event is generated when the mouse position is changed, the wheel is moved, or a button is pressed (click or double-click).

getButton returns MouseButton::None if the event was produced by mouse movement (no button was pressed to trigger the event).

Public Member Functions

 MouseEvent (Widget *source, Point point, int clicks, int flags, MouseButton trigger, int delta=0)
 Creates an event from the mouse.
virtual ~MouseEvent ()
int getX () const
 Returns the X component of the mouse position (getPoint).
int getY () const
 Returns the Y component of the mouse position (getPoint).
Point getPoint () const
 Returns the mouse position relative to the Widget client area.
int getClicks () const
 Returns how many clicks the user did:.
MouseButton getButton () const
 Returns the button that trigger the event (if the event is Widget::onMouseUp or Widget::onMouseDown).
bool isLeftButtonPressed () const
 Returns true if the left button was pressed when the event was generated.
bool isRightButtonPressed () const
 Returns true if the left button was pressed when the event was generated.
bool isMiddleButtonPressed () const
 Returns true if the middle button was pressed when the event was generated.
bool isShiftKeyPressed () const
bool isControlKeyPressed () const
bool isAltKeyPressed () const
int getDelta () const

Private Attributes

Point m_point
int m_clicks
int m_flags
MouseButton m_trigger
int m_delta


Constructor & Destructor Documentation

MouseEvent::MouseEvent ( Widget source,
Point  point,
int  clicks,
int  flags,
MouseButton  trigger,
int  delta = 0 
)

Creates an event from the mouse.

Parameters:
source Source of the event (a Widget or Component)
point Point where the mouse happened
clicks How many clicks the user pressed? 1 means click-down, 2 means double-click.
flags Flags used internally (see MK_* constants of Win32)
trigger Which buttons were pressed
delta The wheel delta (Z axis) counted in notches.
Todo:
positive is up or down?

MouseEvent::~MouseEvent (  )  [virtual]


Member Function Documentation

int MouseEvent::getX (  )  const

Returns the X component of the mouse position (getPoint).

The position is relative to the client-bounds of the source.

See also:
getSource, Widget::getClientBounds

int MouseEvent::getY (  )  const

Returns the Y component of the mouse position (getPoint).

The position is relative to the client-bounds of the source.

See also:
getSource, Widget::getClientBounds

Point MouseEvent::getPoint (  )  const

Returns the mouse position relative to the Widget client area.

See also:
Widget::getClientBounds

int MouseEvent::getClicks (  )  const

Returns how many clicks the user did:.

  • 0 = mouse movement;
  • 1 = single click;
  • 2 = double click.

MouseButton MouseEvent::getButton (  )  const

Returns the button that trigger the event (if the event is Widget::onMouseUp or Widget::onMouseDown).

bool MouseEvent::isLeftButtonPressed (  )  const

Returns true if the left button was pressed when the event was generated.

See also:
getButton

bool MouseEvent::isRightButtonPressed (  )  const

Returns true if the left button was pressed when the event was generated.

See also:
getButton

bool MouseEvent::isMiddleButtonPressed (  )  const

Returns true if the middle button was pressed when the event was generated.

The middle button could be the wheel in modern mouses with wheel.

See also:
getButton

bool MouseEvent::isShiftKeyPressed (  )  const

bool MouseEvent::isControlKeyPressed (  )  const

bool MouseEvent::isAltKeyPressed (  )  const

int MouseEvent::getDelta (  )  const


Member Data Documentation