Image Component Library (ICL)
|
Provided by interface MouseGrabber. More...
#include <MouseEvent.h>
Public Member Functions | |
MouseEvent (const utils::Point &widgetPos, const utils::Point &imagePos, const utils::Point32f &imagePos32f, const utils::Point32f &relImagePos, const bool downMask[3], const std::vector< double > &color, const utils::Point &wheelDelta, MouseEventType type, ICLWidget *widget) | |
constructor with given parameters | |
MouseEvent () | |
Create an empty mouse event. | |
int | getWidgetX () const |
returns event's x coordinate wrt. widget frame | |
int | getWidgetY () const |
returns event's y coordinate wrt. widget frame | |
const utils::Point & | getWidgetPos () const |
returns event's location wrt. widget frame | |
int | getX () const |
returns event's x coordinate wrt. image frame | |
int | getY () const |
returns event's y coordinate wrt. image frame | |
const utils::Point & | getPos () const |
returns event's location wrt. image frame | |
float | getX32f () const |
returns event's x coordinate wrt. image frame | |
float | getY32f () const |
returns event's y coordinate wrt. image frame | |
const utils::Point32f & | getPos32f () const |
returns event's location wrt. image frame | |
const utils::Point & | getWheelDelta () const |
wheel delta (x: horizontal wheel, y: vertical wheel (common)) | |
float | getRelX () const |
returns event's relative x coordinate wrt. image frame | |
float | getRelY () const |
returns event's relative y coordinate wrt. image frame | |
const utils::Point32f | getRelPos () const |
returns event's relative location wrt. image frame | |
const std::vector< double > & | getColor () const |
returns clicked pixels color (or a zero length vector, if there was no pixel) | |
bool | hitImage () const |
returns if the widget's image was hit (and a color is available) | |
std::vector< bool > | getDownMask () const |
returns the downmask in order [left, middle, right]- button | |
bool | isLeft () const |
convenience function for left button | |
bool | isMiddle () const |
convenience function for middle button | |
bool | isRight () const |
convenience function for right button | |
bool | isLeftOnly () const |
convenience function for left button | |
bool | isMiddleOnly () const |
convenience function for middle button | |
bool | isRightOnly () const |
convenience function for right button | |
const MouseEventType | getType () const |
returns the event type | |
bool | isMoveEvent () const |
convenience function for special event type | |
bool | isDragEvent () const |
convenience function for special event type | |
bool | isPressEvent () const |
convenience function for special event type | |
bool | isReleaseEvent () const |
convenience function for special event type | |
bool | isEnterEvent () const |
convenience function for special event type | |
bool | isLeaveEvent () const |
convenience function for special event type | |
bool | isWheelEvent () const |
convenience function for special event type | |
ICLWidget * | getWidget () const |
returns the ICLWidget, which produced this event | |
int | getKeyboardModifiers () const |
returns all active keyboard modifiers (ored) | |
bool | isModifierActive (KeyboardModifier m) const |
returns whether a certain modifier is currently active | |
MouseEvent | remapEvent (const utils::Point32f &imagePos) const |
creates a new MouseEvent instance with a different image position | |
Private Attributes | |
utils::Point | m_widgetPos |
event location in widget coordinates | |
utils::Point | m_imagePos |
event location in image coordinates (common) | |
utils::Point32f | m_imagePos32f |
event location in image coordinates in float | |
utils::Point32f | m_relImagePos |
relative image coordinates | |
utils::Point | m_wheelDelta |
wheel delta (x: horizontal wheel, y: vertical wheel) | |
bool | m_downMask [3] |
button downMask | |
std::vector< double > | m_color |
clicked color | |
ICLWidget * | m_widget |
ICLWidget where the event occured. | |
MouseEventType | m_type |
Type of this event (press, release, move, ...) | |
int | m_keyboardModifiers |
ored list of active keyboard modifiers |
Provided by interface MouseGrabber.
Most commonly, mouse events are processed wrt. the current image coordinate frame of the ICLWidget where the mouse event occurs. So, getX(), getY() and getPos() return the pixel coordinate of a mouse event. If mouse interaction shall be visualized, this coordinates can directly be passed to the drawing functions of ICLDrawWidget's.
icl::qt::MouseEvent::MouseEvent | ( | const utils::Point & | widgetPos, |
const utils::Point & | imagePos, | ||
const utils::Point32f & | imagePos32f, | ||
const utils::Point32f & | relImagePos, | ||
const bool | downMask[3], | ||
const std::vector< double > & | color, | ||
const utils::Point & | wheelDelta, | ||
MouseEventType | type, | ||
ICLWidget * | widget | ||
) |
constructor with given parameters
Create an empty mouse event.
const std::vector<double>& icl::qt::MouseEvent::getColor | ( | ) | const [inline] |
returns clicked pixels color (or a zero length vector, if there was no pixel)
std::vector<bool> icl::qt::MouseEvent::getDownMask | ( | ) | const [inline] |
returns the downmask in order [left, middle, right]- button
int icl::qt::MouseEvent::getKeyboardModifiers | ( | ) | const [inline] |
returns all active keyboard modifiers (ored)
A certain KeyboardModifier m can be checked for presence by
bool is_m_present = event.getKeyboardModifiers() & m;
or by using the isModifierActive(KeyboardModifier) method directly.
const utils::Point& icl::qt::MouseEvent::getPos | ( | ) | const [inline] |
returns event's location wrt. image frame
const utils::Point32f& icl::qt::MouseEvent::getPos32f | ( | ) | const [inline] |
returns event's location wrt. image frame
const utils::Point32f icl::qt::MouseEvent::getRelPos | ( | ) | const [inline] |
returns event's relative location wrt. image frame
float icl::qt::MouseEvent::getRelX | ( | ) | const [inline] |
returns event's relative x coordinate wrt. image frame
float icl::qt::MouseEvent::getRelY | ( | ) | const [inline] |
returns event's relative y coordinate wrt. image frame
const MouseEventType icl::qt::MouseEvent::getType | ( | ) | const [inline] |
returns the event type
const utils::Point& icl::qt::MouseEvent::getWheelDelta | ( | ) | const [inline] |
wheel delta (x: horizontal wheel, y: vertical wheel (common))
We use the unit of Qt's QWheelEvent's delta:
MouseEvent event = ...; int numDegrees = event.getWheelDelta().y / 8; int numSteps = numDegrees / 15;
A positive delta value means that the wheel was rotated forward (for y) and to the right (for x)
ICLWidget* icl::qt::MouseEvent::getWidget | ( | ) | const [inline] |
returns the ICLWidget, which produced this event
const utils::Point& icl::qt::MouseEvent::getWidgetPos | ( | ) | const [inline] |
returns event's location wrt. widget frame
int icl::qt::MouseEvent::getWidgetX | ( | ) | const [inline] |
returns event's x coordinate wrt. widget frame
int icl::qt::MouseEvent::getWidgetY | ( | ) | const [inline] |
returns event's y coordinate wrt. widget frame
int icl::qt::MouseEvent::getX | ( | ) | const [inline] |
returns event's x coordinate wrt. image frame
float icl::qt::MouseEvent::getX32f | ( | ) | const [inline] |
returns event's x coordinate wrt. image frame
int icl::qt::MouseEvent::getY | ( | ) | const [inline] |
returns event's y coordinate wrt. image frame
float icl::qt::MouseEvent::getY32f | ( | ) | const [inline] |
returns event's y coordinate wrt. image frame
bool icl::qt::MouseEvent::hitImage | ( | ) | const [inline] |
returns if the widget's image was hit (and a color is available)
bool icl::qt::MouseEvent::isDragEvent | ( | ) | const [inline] |
convenience function for special event type
bool icl::qt::MouseEvent::isEnterEvent | ( | ) | const [inline] |
convenience function for special event type
bool icl::qt::MouseEvent::isLeaveEvent | ( | ) | const [inline] |
convenience function for special event type
bool icl::qt::MouseEvent::isLeft | ( | ) | const [inline] |
convenience function for left button
bool icl::qt::MouseEvent::isLeftOnly | ( | ) | const [inline] |
convenience function for left button
bool icl::qt::MouseEvent::isMiddle | ( | ) | const [inline] |
convenience function for middle button
bool icl::qt::MouseEvent::isMiddleOnly | ( | ) | const [inline] |
convenience function for middle button
bool icl::qt::MouseEvent::isModifierActive | ( | KeyboardModifier | m | ) | const [inline] |
returns whether a certain modifier is currently active
bool icl::qt::MouseEvent::isMoveEvent | ( | ) | const [inline] |
convenience function for special event type
bool icl::qt::MouseEvent::isPressEvent | ( | ) | const [inline] |
convenience function for special event type
bool icl::qt::MouseEvent::isReleaseEvent | ( | ) | const [inline] |
convenience function for special event type
bool icl::qt::MouseEvent::isRight | ( | ) | const [inline] |
convenience function for right button
bool icl::qt::MouseEvent::isRightOnly | ( | ) | const [inline] |
convenience function for right button
bool icl::qt::MouseEvent::isWheelEvent | ( | ) | const [inline] |
convenience function for special event type
MouseEvent icl::qt::MouseEvent::remapEvent | ( | const utils::Point32f & | imagePos | ) | const [inline] |
creates a new MouseEvent instance with a different image position
This method can be used to simulate normal mouse-events, acutally received from another source, such as an 3D component
std::vector<double> icl::qt::MouseEvent::m_color [private] |
clicked color
bool icl::qt::MouseEvent::m_downMask[3] [private] |
button downMask
utils::Point icl::qt::MouseEvent::m_imagePos [private] |
event location in image coordinates (common)
event location in image coordinates in float
int icl::qt::MouseEvent::m_keyboardModifiers [private] |
ored list of active keyboard modifiers
relative image coordinates
MouseEventType icl::qt::MouseEvent::m_type [private] |
Type of this event (press, release, move, ...)
wheel delta (x: horizontal wheel, y: vertical wheel)
ICLWidget* icl::qt::MouseEvent::m_widget [private] |
ICLWidget where the event occured.
utils::Point icl::qt::MouseEvent::m_widgetPos [private] |
event location in widget coordinates