KeyMap(3U)

πŸ’… KeyMap(3U) β€” it's giving "press a key, get a control" energy πŸŽ€

okay bestie, welcome to the InterViews Reference Manual, Unidraw chapter, and today's main character is KeyMap β€” the lil guy that activates controls given their keyboard equivalents. πŸ¦‹


✨ SYNOPSIS ✨

#include <Unidraw/keymap.h>

like, that's it. that's the include. go off. πŸ’–


🌸 DESCRIPTION 🌸

so KeyMap supports keyboard equivalents, which is the whole vibe where the user of a Unidraw application can execute menu commands or select from a palette of controls by typing instead of pointing and clicking with the mouse. no cap, keyboard supremacy. βŒ¨οΈπŸ‘‘

The KeyMap can activate a control given its key code as defined by its ControlInfo object. Only those controls registered with the KeyMap can be activated through the KeyMap β€” so if you didn't register, you're not getting in, it's giving exclusive guest list. πŸ’…

By default, the Editor base class handles key events by having its KeyMap execute the key code. default behavior, iconic, no notes. ✨


πŸŽ€ PUBLIC OPERATIONS πŸŽ€

  • KeyMap() β€” construct a new keymap, initially with no registrants. brand new, empty, zero friends, we love a fresh start. πŸ™ˆ
  • void Register(UControl*)
  • void Register(KeyMap*)
  • void Unregister(UControl*)
  • void Unregister(KeyMap*) β€” register and unregister a control or another KeyMap. Registering a KeyMap is equivalent to registering all its registered controls individually β€” like, it's a whole friend group joining the party at once, slay. 🫢
  • void Execute(const char* keyCode) β€” execute the given key code by activating the corresponding control. Each UControl contains a ControlInfo object that specifies its key code; thus the mapping between key codes and controls is defined by the ControlInfo objects collectively. so it's a team effort fr fr. 🀝
⚠️ bestie listen: key codes among registered controls should be unique. two controls claiming the same key code is not the moment, it's a vibe check failure. πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

ControlInfo(3U), KeyMap(3U), UControl(3U), kybd(3U)

(yes it references itself, that's just self-love, periodt. πŸ‘‘)


Unidraw Β· 1 August 1990 β€” ok that's the whole page, mwah πŸ’‹ thanks for coming to my ted talk, go register some controls and stay hydrated bestie πŸ’–βœ¨πŸŒˆ