ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Graphics::CursorManager Class Reference

#include <cursorman.h>

Inheritance diagram for Graphics::CursorManager:
Collaboration diagram for Graphics::CursorManager:

List of all members.

Classes

struct  Cursor
struct  Palette

Public Member Functions

bool isVisible ()
 Query whether the mouse cursor is visible.
bool showMouse (bool visible)
 Show or hide the mouse cursor.
void pushCursor (const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale=false, const Graphics::PixelFormat *format=NULL)
 Push a new cursor onto the stack, and set it in the backend.
void popCursor ()
 Pop a cursor from the stack, and restore the previous one to the backend.
void replaceCursor (const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale=false, const Graphics::PixelFormat *format=NULL)
 Replace the current cursor on the stack.
void popAllCursors ()
 Pop all of the cursors and cursor palettes from their respective stacks.
bool supportsCursorPalettes ()
 Test whether cursor palettes are supported.
void disableCursorPalette (bool disable)
 Enable/Disable the current cursor palette.
void pushCursorPalette (const byte *colors, uint start, uint num)
 Push a new cursor palette onto the stack, and set it in the backend.
void popCursorPalette ()
 Pop a cursor palette from the stack, and restore the previous one to the backend.
void replaceCursorPalette (const byte *colors, uint start, uint num)
 Replace the current cursor palette on the stack.
void lock (bool locked)

Private Member Functions

 CursorManager ()
 ~CursorManager ()

Private Attributes

Common::Stack< Cursor * > _cursorStack
Common::Stack< Palette * > _cursorPaletteStack
bool _locked

Friends

class Common::Singleton< SingletonBaseType >

Detailed Description

Definition at line 33 of file cursorman.h.


Constructor & Destructor Documentation

Graphics::CursorManager::CursorManager (  )  [inline, private]

Definition at line 170 of file cursorman.h.

Graphics::CursorManager::~CursorManager (  )  [private]

Definition at line 34 of file cursorman.cpp.


Member Function Documentation

void Graphics::CursorManager::disableCursorPalette ( bool  disable  ) 

Enable/Disable the current cursor palette.

Parameters:
disable 

Definition at line 154 of file cursorman.cpp.

bool Graphics::CursorManager::isVisible (  ) 

Query whether the mouse cursor is visible.

Definition at line 43 of file cursorman.cpp.

void Graphics::CursorManager::lock ( bool  locked  ) 

Definition at line 233 of file cursorman.cpp.

void Graphics::CursorManager::popAllCursors (  ) 

Pop all of the cursors and cursor palettes from their respective stacks.

The purpose is to ensure that all unecessary cursors are removed from the stack when returning to the launcher from an engine.

Definition at line 89 of file cursorman.cpp.

void Graphics::CursorManager::popCursor (  ) 

Pop a cursor from the stack, and restore the previous one to the backend.

If there is no previous cursor, the cursor is hidden.

Definition at line 71 of file cursorman.cpp.

void Graphics::CursorManager::popCursorPalette (  ) 

Pop a cursor palette from the stack, and restore the previous one to the backend.

If there is no previous palette, the cursor palette is disabled instead.

Definition at line 180 of file cursorman.cpp.

void Graphics::CursorManager::pushCursor ( const void *  buf,
uint  w,
uint  h,
int  hotspotX,
int  hotspotY,
uint32  keycolor,
bool  dontScale = false,
const Graphics::PixelFormat format = NULL 
)

Push a new cursor onto the stack, and set it in the backend.

A local copy will be made of the cursor data, so the original buffer can be safely freed afterwards.

Parameters:
buf the new cursor data
w the width
h the height
hotspotX the hotspot X coordinate
hotspotY the hotspot Y coordinate
keycolor the color value for the transparent color. This may not exceed the maximum color value as defined by format.
dontScale Whether the cursor should never be scaled. An exception are high ppi displays, where the cursor would be too small to notice otherwise, these are allowed to scale the cursor anyway.
format a pointer to the pixel format which the cursor graphic uses, CLUT8 will be used if this is NULL or not specified.
Note:
It is ok for the buffer to be a NULL pointer. It is sometimes useful to push a "dummy" cursor and modify it later. The cursor will be added to the stack, but not to the backend.

Definition at line 62 of file cursorman.cpp.

void Graphics::CursorManager::pushCursorPalette ( const byte colors,
uint  start,
uint  num 
)

Push a new cursor palette onto the stack, and set it in the backend.

The palette entries from 'start' till (start+num-1) will be replaced so a full palette updated is accomplished via start=0, num=256.

The palette data is specified in the same interleaved RGB format as used by all backends.

Parameters:
colors the new palette data, in interleaved RGB format
start the first palette entry to be updated
num the number of palette entries to be updated
Note:
If num is zero, the cursor palette is disabled.

Definition at line 167 of file cursorman.cpp.

void Graphics::CursorManager::replaceCursor ( const void *  buf,
uint  w,
uint  h,
int  hotspotX,
int  hotspotY,
uint32  keycolor,
bool  dontScale = false,
const Graphics::PixelFormat format = NULL 
)

Replace the current cursor on the stack.

If the stack is empty, the cursor is pushed instead. It's a slightly more optimized way of popping the old cursor before pushing the new one.

Parameters:
buf the new cursor data
w the width
h the height
hotspotX the hotspot X coordinate
hotspotY the hotspot Y coordinate
keycolor the color value for the transparent color. This may not exceed the maximum color value as defined by format.
dontScale Whether the cursor should never be scaled. An exception are high ppi displays, where the cursor would be too small to notice otherwise, these are allowed to scale the cursor anyway.
format a pointer to the pixel format which the cursor graphic uses, CLUT8 will be used if this is NULL or not specified.

Definition at line 106 of file cursorman.cpp.

void Graphics::CursorManager::replaceCursorPalette ( const byte colors,
uint  start,
uint  num 
)

Replace the current cursor palette on the stack.

If the stack is empty, the palette is pushed instead. It's a slightly more optimized way of popping the old palette before pushing the new one.

Parameters:
colors the new palette data, in interleaved RGB format
start the first palette entry to be updated
num the number of palette entries to be updated
Note:
If num is zero, the cursor palette is disabled.

Definition at line 203 of file cursorman.cpp.

bool Graphics::CursorManager::showMouse ( bool  visible  ) 

Show or hide the mouse cursor.

This function does not call OSystem::updateScreen, when visible is true. This fact might result in a non visible mouse cursor if the caller does not call OSystem::updateScreen itself after a showMouse(true) call.

TODO: We might want to reconsider this behavior, it might be confusing for the user to call OSystem::updateScreen separately, on the other hand OSystem::updateScreen might as well display unwanted changes on the screen. Another alternative would be to let the backend worry about this on OSystem::showMouse call.

See also:
OSystem::showMouse.

Definition at line 49 of file cursorman.cpp.

bool Graphics::CursorManager::supportsCursorPalettes (  ) 

Test whether cursor palettes are supported.

This is just an convenience wrapper for checking for OSystem::kFeatureCursorPalette to be supported by OSystem.

See also:
OSystem::kFeatureCursorPalette
OSystem::hasFeature

Definition at line 150 of file cursorman.cpp.


Friends And Related Function Documentation

friend class Common::Singleton< SingletonBaseType > [friend]

Definition at line 166 of file cursorman.h.


Member Data Documentation

Definition at line 203 of file cursorman.h.

Definition at line 205 of file cursorman.h.


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


Generated on Sat Mar 16 2019 05:05:47 for ResidualVM by doxygen 1.7.1
curved edge   curved edge