#include <Pt/Forms/MouseEvent.h>

Pointer movement or button change. More...

Inherits BasicEvent< T >.

Public Types

enum  Action
 Defines the mouse action.
 
enum  Button
 Defines a mouse button.
 

Public Member Functions

 MouseEvent ()
 Creates an event without a target.
 
 MouseEvent (Widget &widget)
 Creates an event targeted at widget.
 
Pt::uint64_t widgetId () const
 Returns the target widget ID, or 0 when no target is set.
 
Widgetwidget () const
 Returns the target widget, or 0 when no target is set.
 
void setWidget (Widget *widget)
 Sets the target widget and its ID.
 
const Gfx::PointFposition () const
 Returns the pointer position in local coordinates.
 
void setPosition (const Gfx::PointF &pos)
 Sets the pointer position to pos.
 
double x () const
 Returns the local horizontal pointer position.
 
void setX (double x)
 Sets the local horizontal pointer position to x.
 
double y () const
 Returns the local vertical pointer position.
 
void setY (double y)
 Sets the local vertical pointer position to y.
 
bool isMove () const
 Returns true when the event reports pointer movement.
 
void setMove ()
 Changes the event to pointer movement.
 
bool isPressed (Pt::uint32_t button=Left) const
 Returns true if the button is in pressed state.
 
bool isPress (Pt::uint32_t button=Left) const
 Returns true if the button was just pressed.
 
void setPress (Pt::uint32_t button=Left)
 Changes the event to a press of button.
 
bool isReleased (Pt::uint32_t button=Left) const
 Returns true if the button is in released state.
 
bool isRelease (Pt::uint32_t button=Left) const
 Returns true if the button was just released.
 
void setRelease (Pt::uint32_t button=Left)
 Changes the event to a release of button.
 
Eventclone (Allocator &allocator) const
 Clones this event using an allocator.
 
void destroy (Allocator &allocator)
 Destroys this event using an allocator.
 
const std::type_info & typeInfo () const
 Returns the type info for this class of events.
 

Static Public Member Functions

template<typename EventT >
static EventcopyConstruct (const EventT &ev, Allocator &allocator)
 Copies an event using an allocator.
 
template<typename EventT >
static void destruct (EventT &ev, Allocator &allocator)
 Destructs an event using an allocator.
 

Detailed Description

The event carries a local position, the action, the button, and the button state. The widget pointer and widget ID identify the target.