|
V-ARTContributions
|
Keeps track of mouse events and state. More...
#include <mousecontrol.h>
Classes | |
| class | ClickHandler |
| Click handler. More... | |
| class | DragHandler |
| class | MotionHandler |
Public Types | |
| enum | ButtonID { LEFT, MIDDLE, RIGHT, WHEEL_UP, WHEEL_DOWN } |
| enum | ModifierID { SHIFT, CONTROL, ALT } |
| enum | StateID { DOWN, UP } |
Public Member Functions | |
| MouseControl () | |
| Creates an unitialized mouse controller. More... | |
| bool | LastClickButtonIs (ButtonID btValue) const |
| Checks if last event is relative to given button. More... | |
| ButtonID | GetLastClickButton () const |
| Returns button relative to last event. More... | |
| void | SetLastClickButton (ButtonID btValue) |
| Sets button relative to last event. More... | |
| bool | ModifierIsActive (ModifierID mdValue) const |
| Checks if given modifier was active on last event. More... | |
| void | SetModifierState (ModifierID mdValue, bool state) |
| Sets the modifier state on last event. More... | |
| bool | LastClickIsDown () const |
| Checks whether state is DOWN. More... | |
| StateID | GetLastClickState () const |
| Returns the button state of last click. More... | |
| void | SetLastClickState (StateID newState) |
| Set the button state on last click. More... | |
| int | GetClickXPosition () const |
| Returns the x positon of last click. More... | |
| void | SetClickXPosition (int newValue) |
| Sets the x postion of last click. More... | |
| int | GetClickYPosition () const |
| Returns the y positon of last click. More... | |
| void | SetClickYPosition (int newValue) |
| Sets the y postion of last click. More... | |
| void | SetClickPosition (int newX, int newY) |
| Sets the position of last click. More... | |
| int | GetCurrentX () const |
| Returns the current x postion. More... | |
| void | SetCurrentX (int newValue) |
| Sets the current x position. More... | |
| int | GetCurrentY () const |
| Returns the current y postion. More... | |
| void | SetCurrentY (int newValue) |
| Sets the current y position. More... | |
| void | SetCurrentPosititon (int newX, int newY) |
| Set the current position. More... | |
| int | GetReleasedXPosition () const |
| Returns the x positon of last button release. More... | |
| void | SetReleasedXPosition (int newValue) |
| Sets the x postion of last button release. More... | |
| int | GetReleasedYPosition () const |
| Returns the y positon of last button release. More... | |
| void | SetReleasedYPosition (int newValue) |
| Sets the y postion of last button release. More... | |
| void | SetReleasedPosition (int newX, int newY) |
| Sets the position of last button release. More... | |
| void | OnClick () |
| Activates click handler, if any. More... | |
| void | OnDrag () |
| Activates drag (motion with buttons pressed) handler, if any. More... | |
| void | OnMotion () |
| Activates motion (with no buttons pressed) handler, if any. More... | |
| void | SetClickHandler (ClickHandler *handlerPtr) |
| Sets the click handler. More... | |
| void | SetDragHandler (DragHandler *handlerPtr) |
| Sets the drag handler. More... | |
| void | SetMotionHandler (MotionHandler *handlerPtr) |
| Sets the motion handler. More... | |
| void | SetOwner (ViewerGlutOGL *ownerPtr) |
| Set the owner viewer. More... | |
| void | NewEvent (ButtonID btn, StateID newState) |
| Registers new button event. More... | |
| bool | AnyButtonIsDown () const |
| Checks whether any of LEFT, MIDDLE, RIGHT buttons are down. More... | |
| bool | ButtonIsDown (ButtonID btn) const |
| Returns true if given button is down. More... | |
| int | GetYDrag () const |
| int | GetXDrag () const |
Protected Attributes | |
| ButtonID | button |
| which button was last pressed or released More... | |
| std::bitset< 3 > | modifiers |
| state of modifiers upon last button event More... | |
| std::bitset< 5 > | buttonsState |
| state (down if set) of LEFT, MIDDLE, RIGHT, WHEEL_UP and WHEEL_DOWN buttons More... | |
| StateID | state |
| state of button event (DOWN/UP) More... | |
| int | clickX |
| Mouse X position for last button down event. More... | |
| int | clickY |
| Mouse Y position for last button down event. More... | |
| int | currentX |
| Current mouse X position. More... | |
| int | currentY |
| Current mouse Y position. More... | |
| int | releasedX |
| Mouse X position for last button up event. More... | |
| int | releasedY |
| Mouse Y position for last button up event. More... | |
| ViewerGlutOGL * | viewerPtr |
| Pointer to the viewer that owns the mouse control. More... | |
Keeps track of mouse events and state.
The mouse control class provides a common ground for mouse related classes. It provides a few nested classes that are used to handle mouse events.
Definition at line 17 of file mousecontrol.h.
| Enumerator | |
|---|---|
| LEFT | |
| MIDDLE | |
| RIGHT | |
| WHEEL_UP | |
| WHEEL_DOWN | |
Definition at line 20 of file mousecontrol.h.
| Enumerator | |
|---|---|
| SHIFT | |
| CONTROL | |
| ALT | |
Definition at line 21 of file mousecontrol.h.
| Enumerator | |
|---|---|
| DOWN | |
| UP | |
Definition at line 22 of file mousecontrol.h.
| VART::MouseControl::MouseControl | ( | ) |
Creates an unitialized mouse controller.
Definition at line 10 of file mousecontrol.cpp.
|
inline |
Checks whether any of LEFT, MIDDLE, RIGHT buttons are down.
Definition at line 153 of file mousecontrol.h.
References buttonsState.
|
inline |
Returns true if given button is down.
Definition at line 155 of file mousecontrol.h.
References buttonsState.
|
inline |
Returns the x positon of last click.
Definition at line 104 of file mousecontrol.h.
References clickX.
|
inline |
Returns the y positon of last click.
Definition at line 108 of file mousecontrol.h.
References clickY.
|
inline |
|
inline |
|
inline |
Returns button relative to last event.
Definition at line 90 of file mousecontrol.h.
References button.
|
inline |
Returns the button state of last click.
Definition at line 100 of file mousecontrol.h.
References state.
|
inline |
Returns the x positon of last button release.
Definition at line 126 of file mousecontrol.h.
References releasedX.
|
inline |
Returns the y positon of last button release.
Definition at line 130 of file mousecontrol.h.
References releasedY.
|
inline |
Returns X drag.
X drag is the current X coordinate minus X coordinate of last button press.
Definition at line 163 of file mousecontrol.h.
|
inline |
Returns Y drag.
Y drag is the current Y coordinate minus Y coordinate of last button press.
Definition at line 159 of file mousecontrol.h.
|
inline |
Checks if last event is relative to given button.
Definition at line 88 of file mousecontrol.h.
References button.
|
inline |
Checks whether state is DOWN.
Definition at line 98 of file mousecontrol.h.
|
inline |
Checks if given modifier was active on last event.
Definition at line 94 of file mousecontrol.h.
References modifiers.
Registers new button event.
Definition at line 53 of file mousecontrol.cpp.
| void VART::MouseControl::OnClick | ( | ) |
Activates click handler, if any.
Definition at line 18 of file mousecontrol.cpp.
|
inline |
Activates drag (motion with buttons pressed) handler, if any.
Definition at line 139 of file mousecontrol.h.
References VART::MouseControl::DragHandler::OnDrag().
|
inline |
Activates motion (with no buttons pressed) handler, if any.
Definition at line 141 of file mousecontrol.h.
References VART::MouseControl::MotionHandler::OnMotion().
| void VART::MouseControl::SetClickHandler | ( | ClickHandler * | handlerPtr | ) |
Sets the click handler.
Definition at line 39 of file mousecontrol.cpp.
References VART::MouseControl::ClickHandler::mouseCtrlPtr, and VART::MouseControl::ClickHandler::viewerPtr.
|
inline |
Sets the position of last click.
Definition at line 112 of file mousecontrol.h.
|
inline |
|
inline |
|
inline |
Set the current position.
Definition at line 123 of file mousecontrol.h.
|
inline |
|
inline |
| void VART::MouseControl::SetDragHandler | ( | DragHandler * | handlerPtr | ) |
Sets the drag handler.
Definition at line 32 of file mousecontrol.cpp.
References VART::MouseControl::DragHandler::mouseCtrlPtr, and VART::MouseControl::DragHandler::viewerPtr.
|
inline |
Sets button relative to last event.
Definition at line 92 of file mousecontrol.h.
References button.
|
inline |
Set the button state on last click.
Definition at line 102 of file mousecontrol.h.
References state.
| void VART::MouseControl::SetModifierState | ( | ModifierID | mdValue, |
| bool | state | ||
| ) |
Sets the modifier state on last event.
Definition at line 25 of file mousecontrol.cpp.
| void VART::MouseControl::SetMotionHandler | ( | MotionHandler * | handlerPtr | ) |
Sets the motion handler.
Definition at line 46 of file mousecontrol.cpp.
References VART::MouseControl::MotionHandler::mouseCtrlPtr, and VART::MouseControl::MotionHandler::viewerPtr.
|
inline |
|
inline |
Sets the position of last button release.
Definition at line 134 of file mousecontrol.h.
|
inline |
Sets the x postion of last button release.
Definition at line 128 of file mousecontrol.h.
References releasedX.
|
inline |
Sets the y postion of last button release.
Definition at line 132 of file mousecontrol.h.
References releasedY.
|
protected |
which button was last pressed or released
Definition at line 166 of file mousecontrol.h.
Referenced by GetLastClickButton(), LastClickButtonIs(), and SetLastClickButton().
|
protected |
state (down if set) of LEFT, MIDDLE, RIGHT, WHEEL_UP and WHEEL_DOWN buttons
Definition at line 170 of file mousecontrol.h.
Referenced by AnyButtonIsDown(), and ButtonIsDown().
|
protected |
Mouse X position for last button down event.
Definition at line 174 of file mousecontrol.h.
Referenced by GetClickXPosition(), GetXDrag(), SetClickPosition(), and SetClickXPosition().
|
protected |
Mouse Y position for last button down event.
Definition at line 176 of file mousecontrol.h.
Referenced by GetClickYPosition(), GetYDrag(), SetClickPosition(), and SetClickYPosition().
|
protected |
Current mouse X position.
Definition at line 178 of file mousecontrol.h.
Referenced by GetCurrentX(), GetXDrag(), SetCurrentPosititon(), and SetCurrentX().
|
protected |
Current mouse Y position.
Definition at line 180 of file mousecontrol.h.
Referenced by GetCurrentY(), GetYDrag(), SetCurrentPosititon(), and SetCurrentY().
|
protected |
state of modifiers upon last button event
Definition at line 168 of file mousecontrol.h.
Referenced by ModifierIsActive().
|
protected |
Mouse X position for last button up event.
Definition at line 182 of file mousecontrol.h.
Referenced by GetReleasedXPosition(), SetReleasedPosition(), and SetReleasedXPosition().
|
protected |
Mouse Y position for last button up event.
Definition at line 184 of file mousecontrol.h.
Referenced by GetReleasedYPosition(), SetReleasedPosition(), and SetReleasedYPosition().
|
protected |
state of button event (DOWN/UP)
Definition at line 172 of file mousecontrol.h.
Referenced by GetLastClickState(), LastClickIsDown(), and SetLastClickState().
|
protected |
Pointer to the viewer that owns the mouse control.
Definition at line 186 of file mousecontrol.h.
Referenced by SetOwner().
1.8.6