![]() |
Ardour
8.12
|
#include <cursor_context.h>
Public Types | |
typedef std::shared_ptr< CursorContext > | Handle |
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 |
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.
typedef std::shared_ptr<CursorContext> CursorContext::Handle |
A smart handle for a cursor change context.
Definition at line 47 of file cursor_context.h.
CursorContext::~CursorContext | ( | ) |
|
private |
void CursorContext::change | ( | Gdk::Cursor * | cursor | ) |
Change the editor cursor of an existing cursor context.
|
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.
|
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.
|
private |
Definition at line 69 of file cursor_context.h.
|
private |
Definition at line 70 of file cursor_context.h.