Cursors

The cursor factor provides an easy way to get a cursor shape according to the given state.

Motivation

Mechanics

Figure 5-15. UML Class Diagram: Cursors

UML Class Diagram: Cursors

If the cursor is moved over a OpenCAGE window, its shape must be changed according to the state. This is done by attaching a Cursor_Observer to the State_Model. The Cursor_Observer receives the window to be changed and the factory that holds the needed cursor shapes.

The Cursor_Factory returns cursors for normal windows according to the given state. The DC_Cursor_Factory respective for graph windows. The Cursor_Observer gets an event for every state change, asks the factory for the new cursor and changes the window to use it.

The factory instances are stored in the global Oc_Data structure.

Future Enhancements

If there is another type of window that requires a new set of cursors, inherit the Cursor_Factory and overwrite the Get_Cursor method. Consider augmenting Oc_data to include an instance of the new factory.