ardour
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
CursorContext Class Reference

#include <cursor_context.h>

Public Types

typedef boost::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
 

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

A smart handle for a cursor change context.

Definition at line 47 of file cursor_context.h.

Constructor & Destructor Documentation

CursorContext::~CursorContext ( )

Definition at line 30 of file cursor_context.cc.

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

Definition at line 25 of file cursor_context.cc.

Member Function Documentation

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

Change the editor cursor of an existing cursor context.

Definition at line 46 of file cursor_context.cc.

CursorContext::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.

Definition at line 40 of file cursor_context.cc.

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.

Definition at line 55 of file cursor_context.cc.

Member Data Documentation

Editor& CursorContext::_editor
private

Definition at line 69 of file cursor_context.h.

size_t CursorContext::_index
private

Definition at line 70 of file cursor_context.h.


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