Editor(3U)
π Editor(3U) π
InterViews Reference Manual π
πΈ NAME πΈ
Editor β bestie, this is the base class for top-level windows in an application. That's the whole vibe. π
π¦ SYNOPSIS π¦
#include <Unidraw/editor.h>
β¨ DESCRIPTION β¨
Okay so picture this: an editor is literally a complete user interface for editing a component subject. It unites one or more viewers with commands and tools that act upon the component and its subcomponents. π
Editor is an abstract class derived from MonoScene; the Editor class adds the protocol for associating tools, commands, and viewers with the component(s) they affect. A programmer normally derives one or more application-specific editors from the Editor base class and defines their appearance with a composition of interactors. Each window of a Unidraw application is usually an instance of an editor subclass designed for the editing domain, and it is these windows that the user recognizes as the application program. So like, the windows are the app, fr fr. πͺβ¨
π PUBLIC OPERATIONS π
virtual ~Editor()β Editors should not be deleted explicitly if theUnidrawobject is used to open and close them. Moreover,Editorsubclasses should not explicitly delete the component they edit. TheUnidrawobject 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. So like... hands off the destructor bestie, letUnidrawhandle it. πvirtual void Open()virtual void Close()
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. So not me calling Open myself β the Unidraw object does it. π
virtual void Handle(Event&)βEditorredefinesHandleto interpret key events as keyboard equivalents via theHandleKeyoperation (described below). This is appropriate in the common case where the interactor composition that defines the editor's appearance does not interpret keyboard events. Keyboard shortcuts go brrr. β¨οΈπ₯virtual void Update()β By default, the editor'sUpdateoperation callsUpdateon its viewer(s). Chain reaction, iconic behaviour. π«virtual void SetComponent(Component*)virtual void SetViewer(Viewer*, int = 0)virtual void SetSelection(Selection*)virtual void SetKeyMap(Viewer*, int = 0)virtual void SetCurTool(Tool*)virtual Component* GetComponent()virtual Viewer* GetViewer(int = 0)virtual KeyMap* GetKeyMap()virtual Selection* GetSelection()virtual Tool* GetCurTool()
Assign and return various objects managed by the editor. These operations are undefined by default (so like, don't expect freebies β).
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. She's got range, she's got layers. π
virtual StateVar* GetState(const char*)β The editor may maintain a string-to-state variable mapping to provide external access to any state variables it defines. TheGetStateoperation 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 returnsnilby default. Friendship ended with extending protocol, now mapping is my best friend. πvirtual void InsertDialog(Interactor*)virtual void RemoveDialog(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 twoInsertDialogoperations will always be separated by aRemoveDialogoperation; that is, multiple dialogs might be visible at once. Okay so the popups can stack. Chaos mode: enabled. π
π«Ά PROTECTED OPERATIONS π«Ά
Editor()β You cannot create instances of theEditorclass; rather, you define subclasses that suit your application. The constructor is thus protected to disallow instantiation. She's abstract, she's mysterious, she's unavailable. π«β¨virtual void HandleKey(Event&)β Executes a command given a valid keyboard event as defined by the key-to-command mapping in theKeyMapobject. The key map said so, so it's law. πvirtual boolean DependsOn(Component*)β Return whether the editor depends on the given component in any way.Unidrawmay destroy the component if no editor depends on it. So like, if nobody claims her, she's gone. πvoid SetWindow(ManagedWindow*)ManagedWindow* GetWindow()
Get and set the window associated with the editor. Window matchy-matchy. πͺπ
π SEE ALSO π
Catalog(3U), Command(3U), Component(3U), Interactor(3I), KeyMap(3U), MonoScene(3I), Selection(3U), StateVar(3U), Tool(3U), Unidraw(3U), Viewer(3U), Window(3I), World(3I) β go read the whole friend group, iykyk. π«Άπ
That's the whole page, no cap. Written up by the lovely humans at Unidraw, dated 30 July 1990, and filed under Editor(3U) β so when you cite her, cite her right, bestie. ππ Periodt.
π¦ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms