UControl(3U)

πŸ’… UControl(3U) β€” the InterViews Reference Manual bestie edition

okay so welcome to the UControl page, from the InterViews Reference Manual ✨ it's giving "base classes for menu and button interfaces that work with ControlInfo objects" and honestly? iconic. πŸŽ€


🌸 NAME 🌸

UControl, UControlInteractor β€” the base classes for menu and button interfaces that vibe with ControlInfo objects 🫢


✨ SYNOPSIS ✨

#include <Unidraw/uctrl.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

so UControl is an abstract class, meaning you literally cannot just make one and call it a day, bestie 😭 it takes InterViews' Control base class and levels it up to deal with Unidraw's ControlInfo objects, which are the little guys that define a keyboard equivalent for the control ⌨️✨

UControlInteractor is also an abstract base class, and it's for interactors that base their whole appearance on the info inside a ControlInfo object. the way that UControl subclasses can use UControlInteractor subclasses to define their appearance? obsessed. πŸ’–

and listen β€” if your Unidraw-based app doesn't need Unidraw's keyboard equivalent mechanism, you genuinely don't have to use UControls and UControlInteractors to help define your look and feel. no pressure, no cap πŸ™ˆ


πŸ‘‘ UCONTROL PUBLIC OPERATIONS πŸ‘‘

  • virtual void SetControlInfo(ControlInfo*)
  • ControlInfo* GetControlInfo()

these two are your assign-and-retrieve duo for the UControl's ControlInfo object πŸ’… set it, get it, slay.


πŸŽ€ UCONTROL PROTECTED OPERATIONS πŸŽ€

  • UControl(ControlInfo*)
  • UControl(const char*, ControlInfo*)

UControl hands you these protected constructors so subclasses can initialize the ControlInfo object, and optionally also specify their instance name 🫢 (that's what the const char* is for, iykyk)


🌈 UCONTROLINTERACTOR PUBLIC OPERATIONS 🌈

  • virtual void SetControlInfo(ControlInfo*)
  • ControlInfo* GetControlInfo()

same energy as before: assign and retrieve the UControlInteractor's ControlInfo object ⭐

  • virtual void Highlight(boolean)

so here's the tea β˜• the UControlInteractor's appearance is defined by a Graphic object, and it builds that object from the info sitting inside its ControlInfo object. by default, UControlInteractor highlights itself by drawing this graphic with its foreground and background colors reversed πŸ”₯ lowkey a whole aesthetic.


πŸ’œ UCONTROLINTERACTOR PROTECTED OPERATIONS πŸ’œ

  • UControlInteractor(ControlInfo*)
  • UControlInteractor()

UControlInteractor defines two protected constructors, and they're a matched set fr fr:

  • the one that takes the ControlInfo object as an argument. this constructor also initializes the UControlInteractor's _label protected member by calling InitLabel (described below πŸ‘‡) with that ControlInfo object.
  • the parameterless constructor, which initializes _label to nil πŸ’€

and both of them initialize the UControlInteractor's _picture protected member so it points to an instance of a Picture object β€” and that is what defines the UControlInteractor's appearance ✨

  • virtual void Invert()

Invert reverses _picture's colors without drawing it 🎨 just flips the vibe, no visuals required.

  • Graphic* InitLabel(ControlInfo*)

this one creates a graphic from the information stored in a ControlInfo object that defines the UControlInteractor's appearance πŸ–ΌοΈ specifically: this operation creates a GraphicView of the ControlInfo's GraphicComp, and returns a copy of the view's graphic. copy, not the original β€” important, bestie πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€

  • Control(3I)
  • ControlInfo(3U)
  • Graphic(3U)
  • GraphicComp(3U)
  • GraphicView(3U)
  • KeyMap(3U)

go read those too, they're all part of the friend group 🫢


πŸ“ quick vibe check: UControl and UControlInteractor are both abstract, so don't come for me trying to instantiate them directly. subclass them like a main character. πŸ’€

k that's the whole page bestie, hope it ate πŸ’…βœ¨ this was Unidraw, dated 20 November 1990 β€” yes she's an elder but she's still iconic, periodt πŸ‘‘πŸŒˆ