Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Burger::OSCursor Class Reference

Class to handle an operating system cursor. More...

Collaboration diagram for Burger::OSCursor:
Collaboration graph
[legend]

Public Types

enum  eCursor {
  CURSOR_NONE , CURSOR_ARROW , CURSOR_IBEAM , CURSOR_WAIT ,
  CURSOR_CROSS , CURSOR_COUNT , CURSOR_CUSTOM
}
 

Public Member Functions

 ~OSCursor ()
 Release all cursor resources.
 

Static Public Member Functions

static uint_t IsVisible (void) noexcept
 Return the current state of the visible flag.
 
static uint_t IsActive (void) noexcept
 Return TRUE if a cursor is visible while the mouse is in the client area.
 
static uint_t GetImageIDNumber (void) noexcept
 Return the current cursor shape number.
 
static uint_t IsThisADesktop (void) noexcept
 Is there a desktop cursor?
 
static void SetImageFromIDNumber (eCursor eCursorNumber) noexcept
 Load an OS resource and set the cursor to it.
 
static void SetImage (const OSCursorImage *pImage) noexcept
 Set the cursor to a generated cursor.
 
static uint_t Show (void) noexcept
 Make an OS cursor visible.
 
static uint_t Show (uint_t bVisible) noexcept
 Make an OS cursor visible if non-zero.
 
static uint_t Hide (void) noexcept
 Make an OS cursor disappear.
 
static void Init (void) noexcept
 Reset an OS cursor to an arrow and make it visible.
 
static void Shutdown (void) noexcept
 Release all resources allocated by the cursor.
 
static void Refresh (void) noexcept
 If a custom cursor is defined, refresh the operating system.
 

Private Member Functions

 OSCursor (const OSCursor &)=delete
 
OSCursoroperator= (const OSCursor &)=delete
 
 OSCursor (OSCursor &&)=delete
 
OSCursoroperator= (OSCursor &&)=delete
 
 OSCursor () noexcept
 Initialize the defaults.
 

Private Attributes

CCrsr ** m_pCursorImage
 MacOS only, handle to the cursor image.
 
HICON__m_pCursorImage
 Windows only, handle to the cursor image.
 
uint_t m_bVisibleFlag
 TRUE if the cursor is visible
 
uint_t m_bActiveFlag
 TRUE if a game cursor is loaded
 
eCursor m_eIDNumber
 ID Number of the currently set cursor.
 

Static Private Attributes

static OSCursor g_Global
 Singleton instance of the Burger::OSCursor class.
 

Detailed Description

Class to handle an operating system cursor.


For desktop operating systems like MacOS, Windows and Linux, a mouse cursor is drawn and updated by the operating system. This class standardizes the behavior of the cursor and allows the application to show, hide or if possible, change the shape of the cursor in a system neutral way.

Member Enumeration Documentation

◆ eCursor

Enumerator
CURSOR_NONE 

No cursor at all.

CURSOR_ARROW 

Standard arrow cursor.

CURSOR_IBEAM 

Text edit i-beam cursor.

CURSOR_WAIT 

Beachball cursor.

CURSOR_CROSS 

Crosshairs cursor.

CURSOR_COUNT 

Total number of system cursors.

CURSOR_CUSTOM 

Cursor set by a call with SetImage()

Constructor & Destructor Documentation

◆ OSCursor() [1/3]

Burger::OSCursor::OSCursor ( const OSCursor & )
privatedelete

◆ OSCursor() [2/3]

Burger::OSCursor::OSCursor ( OSCursor && )
privatedelete

◆ OSCursor() [3/3]

Burger::OSCursor::OSCursor ( )
privatenoexcept

Initialize the defaults.


Set up the variables to a default state, however, no actual calls to the operating system are performed. Call Burger::OSCursor::Init() to initialize.

See also
OSCursor::Init()

◆ ~OSCursor()

Burger::OSCursor::~OSCursor ( )

Release all cursor resources.


On shutdown, release any held custom cursor resources

Member Function Documentation

◆ GetImageIDNumber()

uint_t Burger::OSCursor::GetImageIDNumber ( void )
inlinestaticnoexcept

Return the current cursor shape number.


Returns
The operating system resource ID of the current cursor.

◆ Hide()

uint_t BURGER_API Burger::OSCursor::Hide ( void )
staticnoexcept

Make an OS cursor disappear.


Returns
TRUE if the cursor was previously visible, FALSE if not.

◆ Init()

void BURGER_API Burger::OSCursor::Init ( void )
staticnoexcept

Reset an OS cursor to an arrow and make it visible.


◆ IsActive()

uint_t Burger::OSCursor::IsActive ( void )
inlinestaticnoexcept

Return TRUE if a cursor is visible while the mouse is in the client area.


Returns
TRUE if a cursor should be visible in the client area of the window, FALSE if not.

◆ IsThisADesktop()

uint_t Burger::OSCursor::IsThisADesktop ( void )
inlinestaticnoexcept

Is there a desktop cursor?


If the application wishes to detect if this is a desktop or mobile/console application, call this function to detect if there is a desktop cursor available.

Returns
TRUE if there is a desktop cursor, FALSE if not.

◆ IsVisible()

uint_t Burger::OSCursor::IsVisible ( void )
inlinestaticnoexcept

Return the current state of the visible flag.


Returns
TRUE if the cursor is currently visible, FALSE if not.

◆ operator=() [1/2]

OSCursor & Burger::OSCursor::operator= ( const OSCursor & )
privatedelete

◆ operator=() [2/2]

OSCursor & Burger::OSCursor::operator= ( OSCursor && )
privatedelete

◆ Refresh()

void BURGER_API Burger::OSCursor::Refresh ( void )
staticnoexcept

If a custom cursor is defined, refresh the operating system.


Note
This is only available on Windows
Windows will sometimes change the desktop cursor when the cursor moves out of scope. This function will restore the cursor once it's back in scope. It's only called from within Windows window callback functions when mouse events are processed.

◆ SetImage()

void BURGER_API Burger::OSCursor::SetImage ( const OSCursorImage * pImage)
staticnoexcept

Set the cursor to a generated cursor.


Given a custom cursor, set the cursor to it.

Parameters
pImageNULL to hide the cursor, or a pointer to a generated cursor

◆ SetImageFromIDNumber()

void BURGER_API Burger::OSCursor::SetImageFromIDNumber ( eCursor eCursorNumber)
staticnoexcept

Load an OS resource and set the cursor to it.


Given a resource number specific to the operating system, set the cursor to it.

\note This function will pull the cursor from the Windows Resource data or

the MacOS Resource fork using this value as the index. Great care must be taken if this call is issued in platform neutral code.

◆ Show() [1/2]

uint_t BURGER_API Burger::OSCursor::Show ( uint_t bVisible)
staticnoexcept

Make an OS cursor visible if non-zero.


If the input is a non-zero number, make the cursor visible. Otherwise, make it invisible.

Parameters
bVisibleTRUE to show the cursor, FALSE to hide it.
Returns
TRUE if the cursor was previously visible, FALSE if not.

◆ Show() [2/2]

uint_t BURGER_API Burger::OSCursor::Show ( void )
staticnoexcept

Make an OS cursor visible.


Returns
TRUE if the cursor was previously visible, FALSE if not.

◆ Shutdown()

void BURGER_API Burger::OSCursor::Shutdown ( void )
staticnoexcept

Release all resources allocated by the cursor.


Member Data Documentation

◆ g_Global

Burger::OSCursor Burger::OSCursor::g_Global
staticprivate

Singleton instance of the Burger::OSCursor class.


Since this is a shim to a global system resource, this class exists as a singleton.

◆ m_bActiveFlag

uint_t Burger::OSCursor::m_bActiveFlag
private

TRUE if a game cursor is loaded

◆ m_bVisibleFlag

uint_t Burger::OSCursor::m_bVisibleFlag
private

TRUE if the cursor is visible

◆ m_eIDNumber

eCursor Burger::OSCursor::m_eIDNumber
private

ID Number of the currently set cursor.

◆ m_pCursorImage [1/2]

CCrsr** Burger::OSCursor::m_pCursorImage
private

MacOS only, handle to the cursor image.

◆ m_pCursorImage [2/2]

HICON__* Burger::OSCursor::m_pCursorImage
private

Windows only, handle to the cursor image.