Ardour  8.12
CursorContext Class Reference

#include <cursor_context.h>

Public Types

typedef std::shared_ptr< CursorContextHandle
 

Public Member Functions

 ~CursorContext ()
 
void change (Gdk::Cursor *cursor)
 

Static Public Member Functions

static Handle create (Editor &editor, Gdk::Cursor *cursor)
 
static void set (Handle *handle, Editor &editor, Gdk::Cursor *cursor)
 

Private Member Functions

 CursorContext (Editor &editor, Gdk::Cursor *cursor)
 

Private Attributes

Editor_editor
 
size_t _index
 

Detailed Description

A scoped handle for changing the editor mouse cursor.

This is a safe way to change the cursor that ensures it is only modified in a strict stack-like fashion. Whenever this handle goes out of scope, the cursor is restored to the previous one.

This is not quite entirely fool-proof, there is one case to be careful of: if a cursor context handle exists, to change it, you must first reset that handle (destroying the context) then set it. Assigning a new context to a non-NULL handle will create the new context (pushing a cursor), then destroy the old one, which would attempt to pop a non-top context which is an error. To account for this, when replacing a possibly existing context, use set() which will automatically do the right thing.

Definition at line 43 of file cursor_context.h.

Member Typedef Documentation

◆ Handle

typedef std::shared_ptr<CursorContext> CursorContext::Handle

A smart handle for a cursor change context.

Definition at line 47 of file cursor_context.h.

Constructor & Destructor Documentation

◆ ~CursorContext()

CursorContext::~CursorContext ( )

◆ CursorContext()

CursorContext::CursorContext ( Editor editor,
Gdk::Cursor cursor 
)
private

Member Function Documentation

◆ change()

void CursorContext::change ( Gdk::Cursor cursor)

Change the editor cursor of an existing cursor context.

◆ create()

static Handle CursorContext::create ( Editor editor,
Gdk::Cursor cursor 
)
static

Change the editor cursor and return a cursor context handle.

When the returned handle goes out of scope, the cursor will be reset to the previous value.

◆ set()

static void CursorContext::set ( Handle handle,
Editor editor,
Gdk::Cursor cursor 
)
static

Set a context handle to a new context.

If the handle points to an existing context, it will first be reset before the new context is created.

Member Data Documentation

◆ _editor

Editor& CursorContext::_editor
private

Definition at line 69 of file cursor_context.h.

◆ _index

size_t CursorContext::_index
private

Definition at line 70 of file cursor_context.h.


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