struct(3U)

πŸ’– struct(3U) πŸ’–

okay bestie, welcome to the InterViews Reference Manual ✨ this one lives in section 3U and it's literally all about the little command girlies that restructure your components. no cap.


🌸 NAME 🌸

BackCmd</purl>, FrontCmd, GroupCmd, UngroupCmd β€” commands for modifying components structurally πŸŽ€


✨ SYNOPSIS ✨

#include <Unidraw/Commands/struct.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

So. BackCmd, FrontCmd, GroupCmd, and UngroupCmd are purely interpretive commands β€” they're not out here doing the work themselves, they're the main character energy that lets the structure of their editor's component get altered. πŸ’…

The way that all four of them redefine their Execute and Unexecute operations? iconic. It's so the editor's component can interpret them however it wants. fr fr, they just hand over the vibe and let the component do its thing. 🫢


πŸ‘‘ BACKCMD PUBLIC OPERATIONS πŸ‘‘

  • BackCmd(ControlInfo*)
  • BackCmd(Editor* = nil)

Construct a new BackCmd. that's it, that's the whole thing, slay. ✨


🌈 FRONTCMD PUBLIC OPERATIONS 🌈

  • FrontCmd(ControlInfo*)
  • FrontCmd(Editor* = nil)

Construct a new FrontCmd. periodt. πŸ’–


πŸŽ€ GROUPCMD PUBLIC OPERATIONS πŸŽ€

  • GroupCmd(ControlInfo*, GraphicComp* = nil)
  • GroupCmd(Editor* = nil, GraphicComp* = nil)

Create a new GroupCmd, and if you want, you can optionally specify the component into which components will be grouped. 🧚

  • virtual void Execute()
  • virtual void Unexecute()

Okay so Execute will set the value of the _executed protected member variable to true as a side effect β€” but only if anything was actually grouped. No grouping, no true, bestie. πŸ™ˆ

Similarly, Unexecute will reset the value to false as a side effect, once the operation was undone. πŸ’«

  • GraphicComp* GetGroup()
  • void SetGroup(GraphicComp*)

Get or set the component into which components will be grouped. πŸ‘‘

⚠️ heads up: SetGroup will not delete the old value. it just ghosts it. πŸ’€

πŸ’œ UNGROUPCMD PUBLIC OPERATIONS πŸ’œ

  • UngroupCmd(ControlInfo*)
  • UngroupCmd(Editor* = nil)

Construct a new UngroupCmd. she's new here, be nice. πŸŽ€

  • virtual void Execute()
  • virtual void Unexecute()

Execute will set the value of the _executed protected member variable to true as a side effect if anything was ungrouped. πŸ’₯

Similarly, Unexecute will reset the value to false as a side effect once the operation was undone. 🌸

  • Clipboard* GetKids()
  • void SetKids(Clipboard*)

Explicitly set and get a clipboard containing the child components that were ungrouped. Where does it live? In the _kids protected member. 🍼

Now here's the tea: UngroupCmd does not initialize this member. It merely provides the storage as a convenience to components that interpret the command and need a place to store the ungrouped children β€” because they need somewhere to keep them to support reverse execution. lowkey a little lending library. πŸ“š

However (and this part matters), UngroupCmd deletes the clipboard (if it exists) in ~UngroupCmd. so if you put something there, the destructor is gonna take it out. 😭

⚠️ also: SetKids will not delete the old value. same energy as SetGroup. no cleanup, no cap. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

  • Command(3U)
  • GraphicComp(3U)

and that's the whole page bestie!! πŸ¦‹ this one came to you from Unidraw, dated 24 January 1991 β€” yes she's vintage, yes she still ate, we love a classic. πŸ’–βœ¨πŸ‘‘