nomlib
Loading...
Searching...
No Matches
nom::Cursor Class Reference

Platform-dependent mouse cursor interface. More...

#include <Cursor.hpp>

Public Types

enum  Type {
  Arrow , Beam , Wait , CrossHair ,
  WaitArrow , SizeENWSE , SizeNESW , SizeWE ,
  SizeNS , SizeAll , No , Hand ,
  NumSystemCursors
}
 The mouse cursor types. More...
typedef Cursor self_type
typedef self_type * raw_ptr

Public Member Functions

 Cursor (void)
 Default constructor.
 ~Cursor (void)
 Destructor.
SDL_Cursor * cursor (void) const
 Get the active mouse cursor.
SDL_Cursor * default_cursor (void) const
 Get the default mouse cursor.
Type system_cursor (void) const
void set_system_cursor (Type id)
 Set a platform-dependent system cursor.
bool cursor_state (void) const
 Get the state of the cursor.
void show_cursor (bool state)
 Toggle the visibility state of the cursor.

Static Public Member Functions

static MouseState mouse_state (void)
 Retrieve the current state of the mouse.

Private Member Functions

void set_cursor (SDL_Cursor *cursor)
 Set the active cursor.

Private Attributes

Type system_cursor_
 Track the active system cursor in use.

Detailed Description

Platform-dependent mouse cursor interface.

Todo
Implement interfacing for SDL_CreateCursor and SDL_CreateSystemCursor.
See also
https://wiki.libsdl.org/CategoryMouse

Definition at line 62 of file Cursor.hpp.

Member Typedef Documentation

◆ raw_ptr

typedef self_type* nom::Cursor::raw_ptr

Definition at line 67 of file Cursor.hpp.

◆ self_type

typedef Cursor nom::Cursor::self_type

Definition at line 65 of file Cursor.hpp.

Member Enumeration Documentation

◆ Type

The mouse cursor types.

See also
SDL_SystemCursor
Enumerator
Beam 

Arrow.

Wait 

Infrared-beam.

CrossHair 

Wait.

WaitArrow 

Crosshair.

SizeENWSE 

Small wait cursor, or MouseCursor::CursorType::Wait if not available

SizeNESW 

Double arrow pointing northwest and southeast.

SizeWE 

Double arrow pointing northeast and southwest.

SizeNS 

Double arrow pointing west and east.

SizeAll 

Double arrow pointing north and south.

No 

Four pointed arrow pointing north, south, east and west.

Hand 

Slashed circle or crossbones.

NumSystemCursors 

Hand.

Definition at line 72 of file Cursor.hpp.

Member Function Documentation

◆ cursor()

SDL_Cursor * nom::Cursor::cursor ( void ) const

Get the active mouse cursor.

Returns
The active mouse cursor on success, or NULL on failure, such as if there is no mouse.
Remarks
This method returns a pointer to the current cursor, which is owned by SDL. You should not free the pointer.

◆ cursor_state()

bool nom::Cursor::cursor_state ( void ) const

Get the state of the cursor.

Returns
Boolean TRUE if the cursor state is enabled, and boolean FALSE if the cursor state is disabled.

◆ default_cursor()

SDL_Cursor * nom::Cursor::default_cursor ( void ) const

Get the default mouse cursor.

Returns
The default mouse cursor on success, or NULL on failure.

◆ mouse_state()

MouseState nom::Cursor::mouse_state ( void )
static

◆ set_cursor()

void nom::Cursor::set_cursor ( SDL_Cursor * cursor)
private

Set the active cursor.

Remarks
This method can be used to force a cursor redraw by passing NULL.

◆ set_system_cursor()

void nom::Cursor::set_system_cursor ( Type id)

Set a platform-dependent system cursor.

See also
nom::Cursor::Type enumerations.

◆ show_cursor()

void nom::Cursor::show_cursor ( bool state)

Toggle the visibility state of the cursor.

Todo
Error handling?

Member Data Documentation

◆ system_cursor_

Type nom::Cursor::system_cursor_
private

Track the active system cursor in use.

Definition at line 141 of file Cursor.hpp.


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