cgv
Loading...
Searching...
No Matches
cgv::gui::mouse_event Class Reference

class to represent all possible mouse events with the EID_MOUSE More...

#include <mouse_event.h>

Inheritance diagram for cgv::gui::mouse_event:
cgv::gui::event

Public Member Functions

 mouse_event (int x, int y, MouseAction _action, unsigned char _button_state=0, unsigned char _button=0, short _dx=0, short _dy=0, unsigned char _modifiers=0, unsigned char _toggle_keys=0, double _time=0)
 construct a mouse
 
void stream_out (std::ostream &os) const
 write to stream
 
void stream_in (std::istream &is)
 read from stream
 
short get_x () const
 current mouse x position (origin is top-left of window)
 
short get_y () const
 current mouse y position (origin is top-left of window)
 
short get_dx () const
 for move and drag events the difference in x to the previous position
 
short get_dy () const
 for move and drag events the difference in y to the previous position, for wheel events the amount the wheel has changed
 
MouseAction get_action () const
 return the mouse action
 
unsigned char get_button_state () const
 return the button state as values from MouseButton combined with a logical or-operation
 
unsigned char get_button () const
 return the pressed or released button for a button press or release action
 
const std::string & get_dnd_text () const
 only valid in a MA_RELEASE event with the flag MF_DND set, return the text resulting from the drag&drop action
 
void set_x (short _x)
 set current mouse x position
 
void set_y (short _y)
 set current mouse y position
 
void set_dx (short _dx)
 set for move and drag events the difference in x to the previous position
 
void set_dy (short _dy)
 set for move and drag events the difference in y to the previous position, for wheel events the amount the wheel has changed
 
void set_action (MouseAction _action)
 return the mouse action
 
void set_button_state (unsigned char _button_state)
 set the button state as values from MouseButton combined with a logical or-operation
 
void set_button (unsigned char _button)
 set the pressed or released button for a button press or release action
 
void set_dnd_text (const std::string &text)
 set the drag&drop text
 
- Public Member Functions inherited from cgv::gui::event
 event (unsigned int _kind=EID_NONE, unsigned char _modifiers=0, unsigned char _toggle_keys=0, double _time=0)
 construct event from its kind
 
virtual ~event ()
 virtual destructor for events
 
virtual void * get_device_id () const
 return the device id, by default returns 0
 
void set_kind (unsigned char _kind)
 set the kind of the event
 
unsigned get_kind () const
 return, what kind of event this is, typically a value from the EventId enum
 
void set_flags (unsigned char _flags)
 return the set the event flags
 
unsigned get_flags () const
 return the event flags
 
void set_modifiers (unsigned char _modifiers)
 set the modifiers
 
unsigned char get_modifiers () const
 return the active modifiers as values from EventModifier combined with a logical or-operation
 
void set_toggle_keys (unsigned char _toggle_keys)
 set the state of the toggle keys
 
unsigned char get_toggle_keys () const
 return the state of the toggle keys as values from EventToggleKeys combined with a logical or-operation
 
void set_time (const double &_time)
 set the time of the event
 
double get_time () const
 return the time of the event in seconds
 

Protected Attributes

short x
 x position of mouse pointer
 
short y
 y position of mouse pointer
 
short dx
 change in x position
 
short dy
 change in y position
 
unsigned char action
 store MouseAction
 
unsigned char button_state
 store the button state
 
unsigned char button
 store the pressed button
 
unsigned char flags
 store mouse event flags
 
std::string dnd_text
 the texted resulting from a drag and drop event
 
- Protected Attributes inherited from cgv::gui::event
unsigned char kind
 store which kind of event we have
 
unsigned char flags
 store event flags
 
unsigned char modifiers
 store the active modifiers
 
unsigned char toggle_keys
 store the active toggle keys
 
double time
 store the time of the event in seconds
 

Detailed Description

class to represent all possible mouse events with the EID_MOUSE

Definition at line 32 of file mouse_event.h.

Constructor & Destructor Documentation

◆ mouse_event()

cgv::gui::mouse_event::mouse_event ( int  x,
int  y,
MouseAction  _action,
unsigned char  _button_state = 0,
unsigned char  _button = 0,
short  _dx = 0,
short  _dy = 0,
unsigned char  _modifiers = 0,
unsigned char  _toggle_keys = 0,
double  _time = 0 
)

construct a mouse

Definition at line 8 of file mouse_event.cxx.

Member Function Documentation

◆ get_action()

◆ get_button()

unsigned char cgv::gui::mouse_event::get_button ( ) const

return the pressed or released button for a button press or release action

Definition at line 75 of file mouse_event.cxx.

References button.

Referenced by cgv::app::navigator::handle_mouse_event(), and stream_out().

◆ get_button_state()

unsigned char cgv::gui::mouse_event::get_button_state ( ) const

return the button state as values from MouseButton combined with a logical or-operation

Definition at line 70 of file mouse_event.cxx.

References button_state.

Referenced by cgv::app::color_map_editor::handle_mouse_event(), cgv::app::color_selector::handle_mouse_event(), and stream_out().

◆ get_dnd_text()

const std::string & cgv::gui::mouse_event::get_dnd_text ( ) const

only valid in a MA_RELEASE event with the flag MF_DND set, return the text resulting from the drag&drop action

Definition at line 81 of file mouse_event.cxx.

References dnd_text.

Referenced by stream_out().

◆ get_dx()

short cgv::gui::mouse_event::get_dx ( ) const

for move and drag events the difference in x to the previous position

Definition at line 55 of file mouse_event.cxx.

References dx.

Referenced by stream_out().

◆ get_dy()

short cgv::gui::mouse_event::get_dy ( ) const

for move and drag events the difference in y to the previous position, for wheel events the amount the wheel has changed

Definition at line 60 of file mouse_event.cxx.

References dy.

Referenced by stream_out().

◆ get_x()

short cgv::gui::mouse_event::get_x ( ) const

current mouse x position (origin is top-left of window)

Definition at line 45 of file mouse_event.cxx.

References x.

Referenced by cgv::app::overlay::handle(), cgv::app::gizmo::handle(), and stream_out().

◆ get_y()

short cgv::gui::mouse_event::get_y ( ) const

current mouse y position (origin is top-left of window)

Definition at line 50 of file mouse_event.cxx.

References y.

Referenced by cgv::app::overlay::handle(), cgv::app::gizmo::handle(), and stream_out().

◆ set_action()

void cgv::gui::mouse_event::set_action ( MouseAction  _action)

return the mouse action

Definition at line 111 of file mouse_event.cxx.

References action.

Referenced by cgv::app::overlay::handle().

◆ set_button()

void cgv::gui::mouse_event::set_button ( unsigned char  _button)

set the pressed or released button for a button press or release action

Definition at line 123 of file mouse_event.cxx.

◆ set_button_state()

void cgv::gui::mouse_event::set_button_state ( unsigned char  _button_state)

set the button state as values from MouseButton combined with a logical or-operation

Definition at line 117 of file mouse_event.cxx.

References button_state.

◆ set_dnd_text()

void cgv::gui::mouse_event::set_dnd_text ( const std::string &  text)

set the drag&drop text

Definition at line 129 of file mouse_event.cxx.

References dnd_text.

◆ set_dx()

void cgv::gui::mouse_event::set_dx ( short  _dx)

set for move and drag events the difference in x to the previous position

Definition at line 99 of file mouse_event.cxx.

References dx.

◆ set_dy()

void cgv::gui::mouse_event::set_dy ( short  _dy)

set for move and drag events the difference in y to the previous position, for wheel events the amount the wheel has changed

Definition at line 105 of file mouse_event.cxx.

References dy.

◆ set_x()

void cgv::gui::mouse_event::set_x ( short  _x)

set current mouse x position

Definition at line 87 of file mouse_event.cxx.

References x.

◆ set_y()

void cgv::gui::mouse_event::set_y ( short  _y)

set current mouse y position

Definition at line 93 of file mouse_event.cxx.

References y.

◆ stream_in()

void cgv::gui::mouse_event::stream_in ( std::istream &  is)
virtual

read from stream

Reimplemented from cgv::gui::event.

Definition at line 41 of file mouse_event.cxx.

◆ stream_out()

Member Data Documentation

◆ action

unsigned char cgv::gui::mouse_event::action
protected

store MouseAction

Definition at line 44 of file mouse_event.h.

Referenced by get_action(), and set_action().

◆ button

unsigned char cgv::gui::mouse_event::button
protected

store the pressed button

Definition at line 48 of file mouse_event.h.

Referenced by get_button().

◆ button_state

unsigned char cgv::gui::mouse_event::button_state
protected

store the button state

Definition at line 46 of file mouse_event.h.

Referenced by get_button_state(), and set_button_state().

◆ dnd_text

std::string cgv::gui::mouse_event::dnd_text
protected

the texted resulting from a drag and drop event

Definition at line 52 of file mouse_event.h.

Referenced by get_dnd_text(), and set_dnd_text().

◆ dx

short cgv::gui::mouse_event::dx
protected

change in x position

Definition at line 40 of file mouse_event.h.

Referenced by get_dx(), and set_dx().

◆ dy

short cgv::gui::mouse_event::dy
protected

change in y position

Definition at line 42 of file mouse_event.h.

Referenced by get_dy(), and set_dy().

◆ flags

unsigned char cgv::gui::mouse_event::flags
protected

store mouse event flags

Definition at line 50 of file mouse_event.h.

◆ x

short cgv::gui::mouse_event::x
protected

x position of mouse pointer

Definition at line 36 of file mouse_event.h.

Referenced by get_x(), and set_x().

◆ y

short cgv::gui::mouse_event::y
protected

y position of mouse pointer

Definition at line 38 of file mouse_event.h.

Referenced by get_y(), and set_y().


The documentation for this class was generated from the following files: