Control(3I)
π Control(3I) π
okay bestie, gather round β this is the InterViews Reference Manual page for Control and ControlState, and yes we are about to make select-and-execute-an-action sound as cute as it actually is. no cap.
β¨ NAME β¨
Control, ControlState β pick an action and then actually do it. the choosing and the doing. iconic behavior honestly. π
πΈ SYNOPSIS πΈ
#include <InterViews/control.h>
that's it. that's the whole vibe. one include and you're in. β¨
π¦ DESCRIPTION π¦
okay so. a control is a monoscene that lets an action be selected and executed. that's literally its whole personality. π
the component of a control is what decides the appearance associated with that control β so like, the component is the ~lewk~, the control is the ~behavior~. main character energy fr fr.
a control state is a subject that coordinates a whole group of related controls, like a little friend group chat for controls. π± the control state holds a pointer to the currently selected control β if any, because sometimes nobody's selected and that's valid too bestie.
controls are lowkey the goat for grabbing input and moving over potentially selectable items. examples of controls include:
- popup menus
- pull-down menus
- menu items
and here's the tea π β it is generally not necessary to call functions directly on a control. she handles herself. let her cook. π
π PUBLIC OPERATIONS π
Control(Interactor*)β construct a brand new control, and use the given interactor as its component. build her. β¨~Controlβ destruct a control. and heads up bestie, because a control is a monoscene, deleting it implies deleting its component interactor too. π so like, one deletion, two gone. no take-backs.ControlState* State()andvoid SetState(ControlState*)β get or set the control state that's associated with a control. getter, setter, the classic duo. π«virtual void Handle(Event&)β controls start out inactive, like you at 7am. aDownEventcauses a control to become active. if an active control receives anEnterEvent, it will set the current selection to itself (she said "it's me, I'm the selection" π ). if an active control receives aLeaveEvent, it will set the current selection tonilβ and yeah,nilis the void, the nothing, the ghosting. πvirtual void Enable(boolean)andboolean Enabled()β depending on the argument,Enableenables (true) or disables (false) the control. control subclasses can check whether the control is enabled with theEnabledoperation and then take whatever action is appropriate. so basically:true= slay,false= sit down. πͺvirtual void Select()β highlight the control and call the protected virtual functionsOpenandGrab(see below, we'll get there bb π«Ά).virtual void Unselect()β call the protected virtual functionClose, and then unhighlight the control. order matters bestie, don't flip it. βvirtual void Do()β implement a selected action. when a control sees anUpEvent, it callsDoon the current selection. this is the moment everything was building toward. π¬Control* ParentControl()andControl* RootControl()β okay so plot twist: the control hierarchy does not necessarily correspond to the interactor hierarchy. they're two different maps, iykyk. these operations return the control's parent control or the root of the control hierarchy, if any, as defined by control subclasses. π
π₯ PROTECTED OPERATIONS π₯
virtual void Down()andvirtual void Up()βDownandUpare called when the control receives aDownEventand anUpEvent, respectively. by default,Downactivates the control if it is enabled, andUpdeactivates the control and callsDoon the current selection. default behavior ate, ngl. π½οΈvirtual void Enter()andvirtual void Leave()βEntermakes the control the current selection if it is enabled and active, whileLeavenullifies the current selection if the control is enabled and active. two conditions, both required, no shortcuts. π―virtual void Open()andvirtual void Close()β the base classOpenandClosedo nothing, but subclasses may insert and remove an interactor, such as a pull-down menu. the base class is a chill girl who does nothing; subclasses are the overachievers. πvirtual void Grab()βGrabreads input and only passes through an event if its target is an active control. gatekeeping, but make it functional. πͺvirtual void Skip()βSkipreads and discards input events until it reads an event targeted for a control that is currently grabbing input, as indicated byIsGrabbing(see below). throw it out, throw it out, oh wait this one's for us β keep it. ποΈvirtual void Busy()andvirtual void Done()β theUpoperation callsBusyjust before it callsDoon the target, and it callsDoneimmediately afterwards. these operations do nothing by default; subclasses may reimplement them to start and stop some indication that the control is doing its job. like a little "working on it β¨" spinner, but make it yours.virtual boolean IsGrabbing(Interactor*)β returnstrueif the given interactor is grabbing control. simple. honest. we love her. πvoid Reparent(Control* target, Control* parent)β set target's parent to parent. controls that compose child controls should call this operation on their children. yes bestie, you have to tell your kids who their parent is, they can't just guess. π«Ά
π SEE ALSO π
Event(3I)Interactor(3I)Menu(3I)Scene(3I)
go read those next, they're all part of the same friend group. π
and that's the page!! this one came from InterViews, dated 15 September 1989, and it's the Control(3I) entry β so yeah, 1989 called and it's still giving. mwah, go forth and select your actions responsibly. ππ¦π
π¦ 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