xoreos
0.0.5
|
The global Aurora cursor manager. More...
#include <cursorman.h>
Public Member Functions | |
CursorManager () | |
~CursorManager () | |
void | clear () |
Remove all managed cursors. More... | |
bool | add (const Common::UString &name, const Common::UString &group, const Common::UString &state="", int hotspotX=-1, int hotspotY=-1) |
Add a cursor. More... | |
void | setDefault (const Common::UString &group, const Common::UString &state="") |
Register this cursor as the default cursor. More... | |
void | set (const Common::UString &group, const Common::UString &state="") |
Set the cursor to a specific group and state. More... | |
void | setGroup (const Common::UString &group) |
Set the cursor to another group, using the current state name. More... | |
void | setState (const Common::UString &state) |
Set the cursor to a different state within the current group. More... | |
void | set () |
Set the cursor to the registered default. More... | |
void | reset () |
Reset the cursor to the system's default. More... | |
void | hideCursor () |
Hide the cursor completely. More... | |
void | showCursor () |
Unhide the cursor. More... | |
uint8 | getPosition (int &x, int &y) const |
Get the current cursor position. More... | |
void | setPosition (int x, int y) |
Move the cursor to a specific position. More... | |
void | toScreenCoordinates (int x, int y, float &sX, float &sY) |
Convert cursor position to screen position. More... | |
void | fromScreenCoordinates (float sX, float sY, int &x, int &y) |
Convert screen position to cursor position. More... | |
bool | isVisible () const |
Is a cursor current visible? More... | |
const Common::UString & | getCurrentGroup () const |
Return the current group. More... | |
const Common::UString & | getCurrentState () const |
Return the current state. More... | |
Private Types | |
typedef std::map< Common::UString, Cursor * > | StateMap |
typedef std::map< Common::UString, StateMap > | CursorMap |
Private Member Functions | |
Cursor * | find (Common::UString &group, Common::UString &state, bool def=false) const |
void | update () |
Additional Inherited Members | |
Static Public Member Functions inherited from Common::Singleton< CursorManager > | |
static CursorManager & | instance () |
static void | destroy () |
Protected Types inherited from Common::Singleton< CursorManager > | |
typedef CursorManager | SingletonBaseType |
Protected Member Functions inherited from Common::Singleton< CursorManager > | |
Singleton () | |
virtual | ~Singleton () |
The global Aurora cursor manager.
Definition at line 42 of file cursorman.h.
|
private |
Definition at line 102 of file cursorman.h.
|
private |
Definition at line 101 of file cursorman.h.
Graphics::Aurora::CursorManager::CursorManager | ( | ) |
Definition at line 41 of file cursorman.cpp.
Graphics::Aurora::CursorManager::~CursorManager | ( | ) |
Definition at line 44 of file cursorman.cpp.
References clear(), and showCursor().
bool Graphics::Aurora::CursorManager::add | ( | const Common::UString & | name, |
const Common::UString & | group, | ||
const Common::UString & | state = "" , |
||
int | hotspotX = -1 , |
||
int | hotspotY = -1 |
||
) |
Add a cursor.
name | The name of the cursor image resource. |
group | The tag to identify the cursor group. |
state | The state this cursor has within the cursor group. |
hotspotX | The X coordinate of the hotspot. |
hotspotY | The Y coordinate of the hotspot. |
Definition at line 79 of file cursorman.cpp.
References _cursors, _mutex, Common::UString::c_str(), Common::exceptionDispatcherWarning(), Common::ScopedPtrBase< T, Deallocator >::get(), and Common::ScopedPtrBase< T, Deallocator >::release().
void Graphics::Aurora::CursorManager::clear | ( | ) |
Remove all managed cursors.
Definition at line 61 of file cursorman.cpp.
References _currentGroup, _currentState, _cursors, _defaultGroup, _defaultState, _mutex, Common::UString::clear(), and reset().
Referenced by ~CursorManager().
|
private |
Definition at line 199 of file cursorman.cpp.
References _cursors, _defaultGroup, and _defaultState.
Referenced by set().
void Graphics::Aurora::CursorManager::fromScreenCoordinates | ( | float | sX, |
float | sY, | ||
int & | x, | ||
int & | y | ||
) |
Convert screen position to cursor position.
Definition at line 175 of file cursorman.cpp.
References WindowMan.
const Common::UString & Graphics::Aurora::CursorManager::getCurrentGroup | ( | ) | const |
const Common::UString & Graphics::Aurora::CursorManager::getCurrentState | ( | ) | const |
uint8 Graphics::Aurora::CursorManager::getPosition | ( | int & | x, |
int & | y | ||
) | const |
Get the current cursor position.
Definition at line 159 of file cursorman.cpp.
void Graphics::Aurora::CursorManager::hideCursor | ( | ) |
Hide the cursor completely.
Definition at line 183 of file cursorman.cpp.
References _hidden, _mutex, and update().
bool Graphics::Aurora::CursorManager::isVisible | ( | ) | const |
void Graphics::Aurora::CursorManager::reset | ( | ) |
Reset the cursor to the system's default.
Definition at line 119 of file cursorman.cpp.
References _currentCursor, _currentGroup, _currentState, _mutex, Common::UString::clear(), and update().
Referenced by clear().
void Graphics::Aurora::CursorManager::set | ( | const Common::UString & | group, |
const Common::UString & | state = "" |
||
) |
Set the cursor to a specific group and state.
Definition at line 148 of file cursorman.cpp.
References _currentCursor, _currentGroup, _currentState, _mutex, find(), and update().
void Graphics::Aurora::CursorManager::set | ( | ) |
Set the cursor to the registered default.
Definition at line 130 of file cursorman.cpp.
References _defaultGroup, _defaultState, and _mutex.
void Graphics::Aurora::CursorManager::setDefault | ( | const Common::UString & | group, |
const Common::UString & | state = "" |
||
) |
Register this cursor as the default cursor.
Definition at line 112 of file cursorman.cpp.
References _defaultGroup, _defaultState, and _mutex.
void Graphics::Aurora::CursorManager::setGroup | ( | const Common::UString & | group | ) |
Set the cursor to another group, using the current state name.
Definition at line 136 of file cursorman.cpp.
References _defaultState, and _mutex.
void Graphics::Aurora::CursorManager::setPosition | ( | int | x, |
int | y | ||
) |
Move the cursor to a specific position.
Definition at line 163 of file cursorman.cpp.
References WindowMan.
void Graphics::Aurora::CursorManager::setState | ( | const Common::UString & | state | ) |
Set the cursor to a different state within the current group.
Definition at line 142 of file cursorman.cpp.
References _defaultGroup, and _mutex.
void Graphics::Aurora::CursorManager::showCursor | ( | ) |
Unhide the cursor.
Definition at line 191 of file cursorman.cpp.
References _hidden, _mutex, and update().
Referenced by ~CursorManager().
void Graphics::Aurora::CursorManager::toScreenCoordinates | ( | int | x, |
int | y, | ||
float & | sX, | ||
float & | sY | ||
) |
Convert cursor position to screen position.
Definition at line 167 of file cursorman.cpp.
References WindowMan.
|
private |
Definition at line 220 of file cursorman.cpp.
References _currentCursor, _hidden, GfxMan, and WindowMan.
Referenced by hideCursor(), reset(), set(), and showCursor().
|
private |
Definition at line 114 of file cursorman.h.
|
private |
Definition at line 106 of file cursorman.h.
Referenced by clear(), getCurrentGroup(), reset(), and set().
|
private |
Definition at line 107 of file cursorman.h.
Referenced by clear(), getCurrentState(), reset(), and set().
|
private |
Definition at line 104 of file cursorman.h.
|
private |
Definition at line 109 of file cursorman.h.
Referenced by clear(), find(), set(), setDefault(), and setState().
|
private |
Definition at line 110 of file cursorman.h.
Referenced by clear(), find(), set(), setDefault(), and setGroup().
|
private |
Definition at line 112 of file cursorman.h.
Referenced by hideCursor(), isVisible(), showCursor(), and update().
|
private |
Definition at line 116 of file cursorman.h.
Referenced by add(), clear(), hideCursor(), reset(), set(), setDefault(), setGroup(), setState(), and showCursor().