xoreos  0.0.5
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Graphics::Aurora::CursorManager Class Reference

The global Aurora cursor manager. More...

#include <cursorman.h>

Inheritance diagram for Graphics::Aurora::CursorManager:
Inheritance graph
[legend]
Collaboration diagram for Graphics::Aurora::CursorManager:
Collaboration graph
[legend]

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::UStringgetCurrentGroup () const
 Return the current group. More...
 
const Common::UStringgetCurrentState () const
 Return the current state. More...
 

Private Types

typedef std::map< Common::UString, Cursor * > StateMap
 
typedef std::map< Common::UString, StateMapCursorMap
 

Private Member Functions

Cursorfind (Common::UString &group, Common::UString &state, bool def=false) const
 
void update ()
 

Private Attributes

CursorMap _cursors
 
Common::UString _currentGroup
 
Common::UString _currentState
 
Common::UString _defaultGroup
 
Common::UString _defaultState
 
bool _hidden
 
Cursor_currentCursor
 
Common::Mutex _mutex
 

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 ()
 

Detailed Description

The global Aurora cursor manager.

Definition at line 42 of file cursorman.h.

Member Typedef Documentation

◆ CursorMap

Definition at line 102 of file cursorman.h.

◆ StateMap

Definition at line 101 of file cursorman.h.

Constructor & Destructor Documentation

◆ CursorManager()

Graphics::Aurora::CursorManager::CursorManager ( )

Definition at line 41 of file cursorman.cpp.

◆ ~CursorManager()

Graphics::Aurora::CursorManager::~CursorManager ( )

Definition at line 44 of file cursorman.cpp.

References clear(), and showCursor().

Here is the call graph for this function:

Member Function Documentation

◆ add()

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.

Parameters
nameThe name of the cursor image resource.
groupThe tag to identify the cursor group.
stateThe state this cursor has within the cursor group.
hotspotXThe X coordinate of the hotspot.
hotspotYThe Y coordinate of the hotspot.
Returns
true if the cursor could be added to the manager.

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().

Here is the call graph for this function:

◆ clear()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find()

Cursor * Graphics::Aurora::CursorManager::find ( Common::UString group,
Common::UString state,
bool  def = false 
) const
private

Definition at line 199 of file cursorman.cpp.

References _cursors, _defaultGroup, and _defaultState.

Referenced by set().

Here is the caller graph for this function:

◆ fromScreenCoordinates()

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.

◆ getCurrentGroup()

const Common::UString & Graphics::Aurora::CursorManager::getCurrentGroup ( ) const

Return the current group.

Definition at line 53 of file cursorman.cpp.

References _currentGroup.

◆ getCurrentState()

const Common::UString & Graphics::Aurora::CursorManager::getCurrentState ( ) const

Return the current state.

Definition at line 57 of file cursorman.cpp.

References _currentState.

◆ getPosition()

uint8 Graphics::Aurora::CursorManager::getPosition ( int &  x,
int &  y 
) const

Get the current cursor position.

Definition at line 159 of file cursorman.cpp.

◆ hideCursor()

void Graphics::Aurora::CursorManager::hideCursor ( )

Hide the cursor completely.

Definition at line 183 of file cursorman.cpp.

References _hidden, _mutex, and update().

Here is the call graph for this function:

◆ isVisible()

bool Graphics::Aurora::CursorManager::isVisible ( ) const

Is a cursor current visible?

Definition at line 49 of file cursorman.cpp.

References _hidden.

◆ reset()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set() [1/2]

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().

Here is the call graph for this function:

◆ set() [2/2]

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.

◆ setDefault()

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.

◆ setGroup()

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.

◆ setPosition()

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.

◆ setState()

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.

◆ showCursor()

void Graphics::Aurora::CursorManager::showCursor ( )

Unhide the cursor.

Definition at line 191 of file cursorman.cpp.

References _hidden, _mutex, and update().

Referenced by ~CursorManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toScreenCoordinates()

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.

◆ update()

void Graphics::Aurora::CursorManager::update ( )
private

Definition at line 220 of file cursorman.cpp.

References _currentCursor, _hidden, GfxMan, and WindowMan.

Referenced by hideCursor(), reset(), set(), and showCursor().

Here is the caller graph for this function:

Member Data Documentation

◆ _currentCursor

Cursor* Graphics::Aurora::CursorManager::_currentCursor
private

Definition at line 114 of file cursorman.h.

Referenced by reset(), set(), and update().

◆ _currentGroup

Common::UString Graphics::Aurora::CursorManager::_currentGroup
private

Definition at line 106 of file cursorman.h.

Referenced by clear(), getCurrentGroup(), reset(), and set().

◆ _currentState

Common::UString Graphics::Aurora::CursorManager::_currentState
private

Definition at line 107 of file cursorman.h.

Referenced by clear(), getCurrentState(), reset(), and set().

◆ _cursors

CursorMap Graphics::Aurora::CursorManager::_cursors
private

Definition at line 104 of file cursorman.h.

Referenced by add(), clear(), and find().

◆ _defaultGroup

Common::UString Graphics::Aurora::CursorManager::_defaultGroup
private

Definition at line 109 of file cursorman.h.

Referenced by clear(), find(), set(), setDefault(), and setState().

◆ _defaultState

Common::UString Graphics::Aurora::CursorManager::_defaultState
private

Definition at line 110 of file cursorman.h.

Referenced by clear(), find(), set(), setDefault(), and setGroup().

◆ _hidden

bool Graphics::Aurora::CursorManager::_hidden
private

Definition at line 112 of file cursorman.h.

Referenced by hideCursor(), isVisible(), showCursor(), and update().

◆ _mutex

Common::Mutex Graphics::Aurora::CursorManager::_mutex
private

Definition at line 116 of file cursorman.h.

Referenced by add(), clear(), hideCursor(), reset(), set(), setDefault(), setGroup(), setState(), and showCursor().


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