virtual~Editor()
Editors should not be deleted explicitly if the Unidraw object is used to open and close them.
Moreover, Editor subclasses should not explicitly delete the component they edit. The Unidraw
object will delete the editor's component after the editor is closed, provided no other editor
references the component (or its relatives) and the component is not known to the catalog.
virtualvoidOpen()virtualvoidClose()
Open informs the editor that it has just become visible and accessible to the user, in case it
needs to know, and Close signals the editor that it is no longer needed and should perform any
final housekeeping operations. For example, the editor may display a copyright message when it is
first opened, or it make take the opportunity when closed to warn the user to save a modified
component. These operations simply notify the editor of a condition and are not usually called by
the application; instead, the application makes editors appear and disappear with the Unidraw
object, which calls these operations as appropriate.
virtualvoidHandle(Event&)
Editor redefines Handle to interpret key events as keyboard equivalents via the HandleKey
operation (described below). This is appropriate in the common case where the interactor
composition that defines the editor's appearance does not interpret keyboard events.
virtualvoidUpdate()
By default, the editor's Update operation calls Update on its viewer(s).
virtualvoidSetComponent(Component*)virtualvoidSetViewer(Viewer*,int=0)virtualvoidSetSelection(Selection*)virtualvoidSetKeyMap(Viewer*,int=0)virtualvoidSetCurTool(Tool*)virtualComponent*GetComponent()virtualViewer*GetViewer(int=0)virtualKeyMap*GetKeyMap()virtualSelection*GetSelection()virtualTool*GetCurTool()
Assign and return various objects managed by the editor. These operations are undefined by
default.
The component is the object that the user edits through the editor. The editor can have any
number of viewers, identified serially. An editor can maintain a key map for defining keyboard
equivalents and a selection object for keeping track of selected components (typically
subcomponents of the component being edited). The editor also has a notion of the tool that is
currently engaged, that is, the tool that would be used if the user clicked in a viewer. The
SetCurTool and GetCurTool operations assign and return this tool, respectively.
virtualStateVar*GetState(constchar*)
The editor may maintain a string-to-state variable mapping to provide external access to any state
variables it defines. The GetState operation returns a state variable given an identifying
string. Defining such a mapping lets components query the editor for state variables that may
affect them without extending the editor protocol, potentially allowing interchange of components
from different applications. This operation returns nil by default.
virtualvoidInsertDialog(Interactor*)virtualvoidRemoveDialog(Interactor*)
Insert or remove an interactor that provides a modal interface, such as a dialog box. By default,
these operations insert the dialog into the world as a transient window centered atop the editor's
canvas. Subclasses can redefine them to insert and remove an interactor (suitably embellished
with a border, drop shadow, etc.) as needed. Subclasses should not assume that two InsertDialog
operations will always be separated by a RemoveDialog operation; that is, multiple dialogs might
be visible at once.