Scene(3I)

🌸 NAME 🌸

Scene, MonoScene β€” composite interactors 🫢

okay so real talk, this is the page for Scene(3I) out of the InterViews Reference Manual, and it's genuinely iconic. Scene and MonoScene are your composite interactors β€” the ones that are built out of other interactors. no cap, it's giving "interactors all the way down" πŸ’…


πŸ“¦ SYNOPSIS πŸ“¦

#include <InterViews/scene.h>

πŸ’« DESCRIPTION πŸ’«

so bestie, Scene is the base class for every single interactor that's defined in terms of one or more instances of other interactors. that's the whole vibe. ✨

MonoScene is a subclass for scenes that contain exactly one instance. a monoscene's shape is copied from its component, and the component's canvas is given the same size and location as the monoscene's canvas. like, they match, periodt. πŸͺž

⚠️ important cleanup rule: when a scene is deleted, it should delete all its component interactors. and a monoscene deletes its existing component if a new component is inserted. so don't come for the memory leaks, bestie πŸ’€

πŸ”₯ PUBLIC OPERATIONS πŸ”₯

  • void Insert(Interactor*) β€” add an interactor to the scene. simple. clean. no alignment drama.
  • void Insert(Interactor*, Coord x, Coord y, Alignment = BottomLeft) β€” add an interactor to the scene, optionally aligned with respect to a specific position relative to the lower-left corner of the scene.
  • virtual Interactor* Wrap(Interactor*) β€” the wrapping hook. the base scene class always calls Wrap and DoInsert from Insert, so subclasses only implement DoInsert (plus Wrap if they want to wrap additional interactors around the inserted interactor) and users only ever call Insert. πŸŽ€
  • virtual void DoInsert(Interactor*, boolean, Coord& x, Coord& y, Shape*) β€” the real one, the one subclasses implement. adds an interactor to the scene, optionally aligned with respect to a specific position relative to the lower-left corner of the scene. valid alignment types are TopLeft, TopCenter, TopRight, CenterLeft, Center, CenterRight, BottomLeft, BottomCenter, BottomRight, Left, Right, Top, Bottom, HorizCenter, and VertCenter β€” yes, all fifteen, memorize them iykyk πŸ‘‘. the scene uses the interactor's desired shape, if it has non-zero width, to size the interactor. and remember: the base scene class always calls Wrap and DoInsert from Insert, so subclasses only implement DoInsert (and Wrap if they want to wrap additional interactors around the inserted interactor) while users only call Insert. in the case of a monoscene, the current interior interactor, if not nil, is deleted and replaced by the given interactor. and if an interactor is inserted into a scene that is already mapped, the interactor and its descendants will be configured before DoInsert is called. ⭐
  • void Propagate(boolean) β€” sets the propagate flag, which is true by default.
  • void Change(Interactor*) β€” the user-facing "hey, something changed its desired shape" call.
  • virtual void DoChange(Interactor*, Shape*) β€” Change notifies a scene that a given interactor has changed its desired shape. if the propagate flag associated with the scene is true, Change will call DoChange and then Change(this) on the scene's parent. if the propagate flag is false, Resize will be called instead. the propagate flag is true by default and can be set with the Propagate operation. 🌈
  • void Move(Interactor*, Coord x, Coord y, Alignment = BottomLeft), virtual void DoMove(Interactor*, Coord& x, Coord& y) β€” request that an interactor be moved to the given coordinates using the given alignment. as with Insert and Change, users call Move and subclasses implement DoMove. πŸ¦‹
  • void Remove(Interactor*), virtual void DoRemove(Interactor*) β€” remove an interactor from a scene. users call Remove and subclasses implement DoRemove. bye bestie πŸ’…
  • void Lower(Interactor*), virtual void DoLower(Interactor*) β€” put the interactor's canvas below all others in the scene, potentially obscuring it. users call Lower and subclasses implement DoLower. πŸ™ˆ
  • void Raise(Interactor*), virtual void DoRaise(Interactor*) β€” put the interactor's canvas above all others in the scene, making it fully visible. main character energy, honestly. users call Raise and subclasses implement DoRaise. πŸ‘‘

🧚 PROTECTED OPERATIONS 🧚

  • Scene(), MonoScene() β€” construct a new scene or monoscene. ⚠️ but listen: scenes and monoscenes are abstract classes, so the constructors should only be called implicitly by subclass constructors. don't call them yourself, that's not the move πŸ“
  • void Place(Interactor*, Coord x1, Coord y1, Coord x2, Coord y2, boolean = true) β€” assign an interactor's canvas to be a given region of the scene's canvas. unless the optional sixth parameter is false, the interactor will be mapped. and here's the cute part: if the interactor is already assigned the given position and size, then this operation will have no effect. that optimization means a scene can place all of its elements in response to a Change and be assured that only those elements that have really changed will be redrawn. slay ✨
  • void Map(Interactor*, boolean = true) β€” make the interactor visible on the display if and when the scene is visible. unless the optional second parameter is false, the interactor will be raised to the top of the scene. πŸ’–
  • void Unmap(Interactor*) β€” make the interactor not be visible on the display if and when the scene is visible. ghost mode πŸ‘»
  • void UserPlace(Interactor*, int w, int h) β€” let the user interact with the window manager to specify the size and location of the interactor's canvas, whose default width and height must also be supplied by the program. πŸŽ€

🌈 SEE ALSO 🌈

  • Canvas(3I) 🎨
  • Interactor(3I) 🫢
  • Shape(3I) πŸ“

okay that's the whole page bestie, go build something gorgeous with it πŸ’œ

this was InterViews Β· 7 Mar 1989 Β· Scene(3I) β€” and yes, she's been iconic since '89. periodt. πŸ’…βœ¨