Viewport(3I)

✨ Viewport(3I) ✨

okay so bestie, we're in the InterViews Reference Manual today and the vibe is: scrolling. buckle up πŸŽ€


πŸ’– NAME πŸ’–

Viewport β€” a scrollable view, aka the little window that lets you peek at a bigger thing and slide it around πŸ’…


🌸 SYNOPSIS 🌸

#include <InterViews/viewport.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so Viewport is a subclass of MonoScene, and its whole thing is that it gives its component exactly as much space as the component wants β€” and it figures out how much that is from the component's shape. no negotiation, no shrinking, the component gets what it asks for, periodt.

that space then gets clipped down to the viewport's own size (because we can't just be showing everything, that's not the assignment), and the viewport keeps a perspective around to control which portion of the component is actually visible on screen. it's giving "camera operator for a widget" fr fr πŸŽ₯

and here's a cute lil detail: if the component is smaller than the viewport's canvas, the leftover background of the viewport gets filled in with a light gray pattern. so it's never just empty, it's got texture ✨


πŸ‘‘ PUBLIC OPERATIONS πŸ‘‘

  • Viewport(Interactor* = nil, Alignment = Center) β€” construct a brand new viewport, slay. if the interactor isn't nil, it gets inserted as the viewport's component. the second parameter decides where the component sits relative to the viewport. alignment matters, bestie πŸ’…
  • Insert(Interactor*) β€” set the component interactor. that's it, that's the move.
  • void Change(Interactor*) β€” okay so important lore: a viewport does not propagate changes. so if the component's shape changes, the viewport just resizes the component according to the new shape. no drama, no cascade, just a resize 🫢
  • void Remove(Interactor*) β€” take the component interactor out. bye bestie πŸ‘‹
  • virtual void Adjust(Perspective&) β€” change the viewport's perspective to the one you hand it. this will cause the desired area of the component to actually get drawn, so like, stuff happens on screen πŸ’–
  • void AdjustTo(float px, float py, float zx, float zy) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void AdjustBy(float dpx, float dpy, float dzx, float dzy) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ScrollTo(float px, float py) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ScrollXTo(float px) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ScrollYTo(float py) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ScrollBy(float dpx, float dpy) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ScrollXBy(float dpx) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ScrollYBy(float dpy) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ZoomTo(float zx, float zy) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ZoomXTo(float zx) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ZoomYTo(float zy) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ZoomBy(float dzx, float dzy) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ZoomXBy(float dzx) β€” short-hand for explicitly manipulating the viewport's perspective.
  • void ZoomYBy(float dzy) β€” short-hand for explicitly manipulating the viewport's perspective.
  • float XPos() β€” short-hand for retrieving info about the current perspective.
  • float YPos() β€” short-hand for retrieving info about the current perspective.
  • float XMag() β€” short-hand for retrieving info about the current perspective.
  • float YMag() β€” short-hand for retrieving info about the current perspective.

🌈 SEE ALSO 🌈

  • Perspective(3I)
  • Scene(3I)
  • Shape(3I)

go read those next, iykyk πŸ’œ


this whole page came to you from the InterViews era, dated 10 February 1988 β€” and yeah, Viewport(3I) is the one and only. iconic behavior from a 1988 manpage ngl πŸ’€βœ¨