Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | Static Public Member Functions | List of all members
om::gui::input::Mouse Class Reference

A class that stores the state of a virtual mouse input device. More...

#include <omGUIInputMouse.h>

Public Member Functions

 Mouse ()
 Create a new empty mouse with no buttons. More...
 
Size getButtonCount () const
 Return the total number of buttons that there are for this mouse. More...
 
const MouseButtongetButton (MouseButtonCode buttonCode) const
 Return a pointer to the mouse button in this mouse with the specified code. More...
 
const MouseButtongetNativeButton (MouseButtonCode nativeButtonCode) const
 Return a pointer to the mouse button in this mouse with the specified native button code. More...
 
void addButton (const MouseButton &newButton, MouseButtonCode nativeButtonCode, Bool isPressed=false)
 Add a new mouse button to this mouse with the specified initial state. More...
 
Bool hasButton (MouseButtonCode buttonCode)
 Return whether or not this mouse contains a mouse button with the specified button code. More...
 
Bool removeButton (MouseButtonCode buttonCode)
 Remove the mouse button with the specified button code from this mouse. More...
 
void clearButtons ()
 Remove all mouse buttons from this mouse. More...
 
Bool isPressed (MouseButtonCode buttonCode) const
 Return whether or not the button with the specified code is pressed on the mouse. More...
 
Bool isPressed (const MouseButton &mouseButton) const
 Return whether or not the specified button is pressed on the mouse. More...
 
void unpressAll ()
 Set the state of all buttons in the mouse to the unpressed state. More...
 
MouseButtonCode convertNativeCode (MouseButtonCode buttonCode) const
 Convert the specified platform-native button code to a generic button code based on this mouse's mapping. More...
 
void mouseButtonEvent (const MouseButtonEvent &event)
 Change the state of the mouse to reflect the specified mouse button event. More...
 
void mouseMotionEvent (const MouseMotionEvent &event)
 Change the state of the mouse to reflect the specified mouse motion event. More...
 
void mouseWheelEvent (const MouseWheelEvent &event)
 Change the state of the mouse to reflect the specified mouse wheel event. More...
 

Static Public Member Functions

static Vector2f getPosition ()
 Return the current position of the global system mouse pointer in screen-space pixels. More...
 
static Bool setPosition (const Vector2f &newPosition)
 Move the global system mouse pointer to the specified screen-space position in pixels. More...
 
static Time getDoubleClickTime ()
 Return the system's user-set interval between successive mouse click events that corresponds to a double-click event. More...
 
static const MousegetDefault ()
 Return a const reference the default mouse for the current system platform. More...
 
static void getDefaultButtons (Mouse &mouse)
 Add the default mouse buttons for the current system platform to the specified mouse. More...
 

Detailed Description

A class that stores the state of a virtual mouse input device.

Constructor & Destructor Documentation

om::gui::input::Mouse::Mouse ( )

Create a new empty mouse with no buttons.

Member Function Documentation

Size om::gui::input::Mouse::getButtonCount ( ) const
inline

Return the total number of buttons that there are for this mouse.

const MouseButton* om::gui::input::Mouse::getButton ( MouseButtonCode  buttonCode) const

Return a pointer to the mouse button in this mouse with the specified code.

The method returns NULL if there is no button with that code.

const MouseButton* om::gui::input::Mouse::getNativeButton ( MouseButtonCode  nativeButtonCode) const

Return a pointer to the mouse button in this mouse with the specified native button code.

This method uses the internal native button code map to convert the button code, then uses the converted button code to find the button with that code. The method returns NULL if there is no button with that native button code.

void om::gui::input::Mouse::addButton ( const MouseButton newButton,
MouseButtonCode  nativeButtonCode,
Bool  isPressed = false 
)

Add a new mouse button to this mouse with the specified initial state.

If there is already a button with the new button's code in this mouse, the old mouse button is replaced with the new one. A button code conversion mapping is added for the specified native button code that maps to the given mouse button.

Bool om::gui::input::Mouse::hasButton ( MouseButtonCode  buttonCode)

Return whether or not this mouse contains a mouse button with the specified button code.

Bool om::gui::input::Mouse::removeButton ( MouseButtonCode  buttonCode)

Remove the mouse button with the specified button code from this mouse.

The method returns whether or not the key with that code was able to be removed.

void om::gui::input::Mouse::clearButtons ( )

Remove all mouse buttons from this mouse.

Bool om::gui::input::Mouse::isPressed ( MouseButtonCode  buttonCode) const

Return whether or not the button with the specified code is pressed on the mouse.

Bool om::gui::input::Mouse::isPressed ( const MouseButton mouseButton) const
inline

Return whether or not the specified button is pressed on the mouse.

void om::gui::input::Mouse::unpressAll ( )

Set the state of all buttons in the mouse to the unpressed state.

MouseButtonCode om::gui::input::Mouse::convertNativeCode ( MouseButtonCode  buttonCode) const
inline

Convert the specified platform-native button code to a generic button code based on this mouse's mapping.

void om::gui::input::Mouse::mouseButtonEvent ( const MouseButtonEvent event)

Change the state of the mouse to reflect the specified mouse button event.

void om::gui::input::Mouse::mouseMotionEvent ( const MouseMotionEvent event)

Change the state of the mouse to reflect the specified mouse motion event.

void om::gui::input::Mouse::mouseWheelEvent ( const MouseWheelEvent event)

Change the state of the mouse to reflect the specified mouse wheel event.

static Vector2f om::gui::input::Mouse::getPosition ( )
static

Return the current position of the global system mouse pointer in screen-space pixels.

This value is specified relative to the lower left corner of the main system display.

static Bool om::gui::input::Mouse::setPosition ( const Vector2f &  newPosition)
static

Move the global system mouse pointer to the specified screen-space position in pixels.

This value is specified relative to the lower left corner of the main system display.

static Time om::gui::input::Mouse::getDoubleClickTime ( )
static

Return the system's user-set interval between successive mouse click events that corresponds to a double-click event.

The user has their double click time set to their preferences. This function retrieves that value.

static const Mouse& om::gui::input::Mouse::getDefault ( )
static

Return a const reference the default mouse for the current system platform.

static void om::gui::input::Mouse::getDefaultButtons ( Mouse mouse)
static

Add the default mouse buttons for the current system platform to the specified mouse.


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