Simplifies the handling of drag events. More...
#include <vgui_drag_mixin.h>
Public Member Functions | |
vgui_drag_mixin (void) | |
Constructor - create a default vgui_drag_mixin. | |
virtual | ~vgui_drag_mixin (void) |
Destructor. | |
virtual bool | handle (vgui_event const &) |
Look for drag events and pass them to mouse_drag(). | |
virtual bool | mouse_drag (int, int, vgui_button, vgui_modifier) |
Called when the user is dragging the mouse. | |
Private Attributes | |
vgui_button | last_down_button_ |
Mouse button the user is pressing (vgui_BUTTON_NULL if none is pressed). |
Simplifies the handling of drag events.
A drag event occurs when the user moves the mouse with one of the mouse buttons pressed down. In VGUI there is no vgui_DRAG event (there is only vgui_MOTION for when the mouse is moving). So if you want to capture drag events you may find this class handy.
The drag_mixin records the last mouse button to be pressed and will send vgui_MOTION events to the function mouse_drag() if the mouse is being moved with a button depressed.
An easy way to use vgui_drag_mixin is to derive your tableau from vgui_drag_tableau. You would then be able to implement mouse_drag and all the other function like key_press, mouse_down in vgui_tableau to handle events.
Definition at line 37 of file vgui_drag_mixin.h.
vgui_drag_mixin::vgui_drag_mixin | ( | void | ) |
Constructor - create a default vgui_drag_mixin.
Definition at line 20 of file vgui_drag_mixin.cxx.
vgui_drag_mixin::~vgui_drag_mixin | ( | void | ) | [virtual] |
Destructor.
Definition at line 25 of file vgui_drag_mixin.cxx.
bool vgui_drag_mixin::handle | ( | vgui_event const & | event | ) | [virtual] |
Look for drag events and pass them to mouse_drag().
Reimplemented in vgui_drag_tableau, vgui_viewer2D_tableau, vgui_viewer3D_tableau, and vgui_displaylist3D_tableau.
Definition at line 29 of file vgui_drag_mixin.cxx.
bool vgui_drag_mixin::mouse_drag | ( | int | , |
int | , | ||
vgui_button | , | ||
vgui_modifier | |||
) | [virtual] |
Called when the user is dragging the mouse.
Reimplemented in vgui_viewer2D_tableau, and vgui_viewer3D_tableau.
Definition at line 44 of file vgui_drag_mixin.cxx.
Mouse button the user is pressing (vgui_BUTTON_NULL if none is pressed).
Definition at line 40 of file vgui_drag_mixin.h.