GraphicView(3U)
π GraphicView(3U) π
okay bestie, welcome to the InterViews Reference Manual β this page is all about GraphicView and GraphicViews, the base classes for graphical component views. lowkey iconic, highkey foundational, let's get into it. π
π NAME π
GraphicView, GraphicViews β base classes for graphical component views. periodt. β¨
β¨ SYNOPSIS β¨
#include <Unidraw/Components/grview.h>
π¦ DESCRIPTION π¦
So GraphicView is an abstract base class for graphical views of GraphicComp objects. It's derived from ComponentView and adds operations for manipulating its graphical attributes. Then GraphicViews is a non-abstract subclass of GraphicView for composite graphical component views. slay.
π GRAPHICVIEW PUBLIC OPERATIONS π
Now the public stuff, bestie. These are the operations you can call on GraphicView objects.
virtual void Interpret(Command*)virtual void Uninterpret(Command*)
GraphicView objects can (un)interpret the following command:
AlignToGridCmdaligns the graphical component to the grid that affects the view.InterpretusesAlignToGridCmd::Alignto carry out the alignment, whileUninterpretusesAlignToGridCmd::Unalignto reverseInterpret's effects. π«
virtual void DrawHandles()virtual void RedrawHandles()virtual void InitHandles()virtual void EraseHandles()
These are the operations for displaying and hiding the view's selection handles. All of them use CreateHandles (described below) to create component-specific rubberbands that draw the handles if they do not already exist. The rubberband is stored in the _handles protected member. So:
DrawHandlesmakes the handles visible if they are not already visible. β¨RedrawHandlesforces the handles to draw themselves even if they are already drawn, which may make them disappear if the rubberband draws them in XOR mode. π (yes, XOR mode can be like that)InitHandlesdeletes and recreates the rubberband defining the handles if it existed whenInitHandleswas called.EraseHandleserases the handles and deletes the rubberband. bye bye handles π
virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer*, Tool*)virtual void InterpretManipulator(Manipulator*)
These operations define how the GraphicView reacts when it is manipulated by a tool and how the tool affects that component following manipulation. They effectively override the tool's default behavior if the tool defers manipulator creation and interpretation to the view. This allows the same tool to behave differently depending on the component it manipulates. it's giving adaptive π
CreateManipulator creates a manipulator that is appropriate for the given tool. It receives the viewer in which the manipulation will take place, an event with which to initialize the manipulator if necessary, and the coordinate transformation that maps canvas coordinates into the subject's coordinate space. InterpretManipulator is called following manipulation and defines how to construct a command that carries out the manipulation's desired effect. GraphicView objects create and interpret manipulators for the following tools:
GraphicCompToolwill let the user position a fixed-sized outline reflecting the view's bounding box on the screen. Interpretation will produce a command that inserts a copy of the subject into the editor's component at the specified position. Placement will be constrained by gravity, if active. πͺMoveToolwill let the user move a fixed-sized outline reflecting the view's bounding box on the screen. Interpretation will produce a command that moves the subject to the specified position. Holding down theShiftkey will constrain the movement to purely horizontal or vertical, and movement will be constrained by gravity.ScaleToolwill let the user drag a scaling rectangular outline corresponding to the view's scale following manipulation with the tool. Scaling will be constrained by gravity.StretchToolwill let the user drag a variable-sized rectangular outline corresponding to a two-dimensional stretch that the component will undergo following manipulation. Holding theShiftkey down will constrain the stretch to one dimension. Stretching will be constrained by gravity.RotateToolwill let the user rotate a fixed-sized rectangular outline reflecting the view's bounding box. The rotation of the outline corresponds to the rotation that the component will undergo following manipulation. Rotation will be constrained by gravity.
virtual Graphic* GetGraphic()
Return the graphic that defines the GraphicView's appearance. Often this graphic is a copy of that in the subject, but it needn't be. no cap.
virtual Viewer* GetViewer()
Return the viewer (if any) that displays the view.
GraphicComp* GetGraphicComp()
Return the view's subject. that's the main character it's showing off π«Ά
boolean Includes(GraphicView*)
A convenience function that returns whether or not the GraphicView includes the given view, that is, whether the view is a child of this. family check β
GraphicView* GetGraphicView(Component*)
A convenience function that returns the view of the given component (if any) that appears in the same viewer as this.
GraphicView* GetView(Iterator)void SetView(GraphicView*, Iterator&)
These operations do nothing by default. Subclasses that contain children should redefine them as follows: GetView should return the GraphicView to which an iterator points. SetView should initialize the iterator to point to a particular GraphicView in the list of children; it should initialize the iterator to point to a nil instance if the given GraphicView is not a child.
virtual Selection* SelectAll()virtual Selection* ViewContaining(Coord, Coord)virtual Selection* ViewsContaining(Coord, Coord)virtual Selection* ViewIntersecting(Coord, Coord, Coord, Coord)virtual Selection* ViewsIntersecting(Coord, Coord, Coord, Coord)virtual Selection* ViewsWithin(Coord, Coord, Coord, Coord)virtual ConnectorView* ConnectorIntersecting(Coord, Coord, Coord, Coord)
These convenience operations do nothing by default. Subclasses containing children should redefine them to do the following:
SelectAllshould return a selection object containing (pointers to) all its children.ViewContainingshould return the last (visibly topmost) child view containing the given point, whileViewsContainingshould return all children containing the point.ViewIntersectingshould return the last (visibly topmost) child view intersecting a rectangular area, whileViewsIntersectingshould return all such children.ViewsWithinshould return all the child views falling strictly within a rectangular area.ConnectorIntersectingshould return the childConnectorView(if any) that intersects a rectangular area.
π GRAPHICVIEW PROTECTED OPERATIONS π
Protected zone, bestie β for the subclasses and internals. π
GraphicView(GraphicComp* = nil)
The constructor is protected to guard against instantiation. It takes the view's subject as an optional argument, passing it to the ComponentView constructor.
virtual void SetGraphic(Graphic*)
Set the GraphicView's graphic to the given one, and store this in the graphic using Graphic::SetTag. This makes it possible to obtain the GraphicView that owns the graphic from the graphic itself, e.g., after hit detection. π
virtual void CreateHandles()
Initialize the _handles member with a rubberband that will draw the appropriate handles. By default, CreateHandles creates a RubberHandles object with eight handles around the periphery of the view's bounding box. eight! octopus energy π
virtual int ClosestPoint(Coord x[], Coord y[], int n, Coord px, Coord py)
A convenience function that returns the index of the point closest to (px, py) in an array of n points.
GraphicView* View(UList*)GraphicView* GetGraphicView(Graphic*)
Convenience functions that return the GraphicView in a UList element and the GraphicView associated with a graphic, respectively.
Manipulator* CreateGraphicCompManip(Viewer*, Event&, Transformer*, Tool*)Manipulator* CreateStretchManip(Viewer*, Event&, Transformer*, Tool*)Command* InterpretGraphicCompManip(Manipulator*)Command* InterpretStretchManip(Manipulator*)
Helper functions used by CreateManipulator and InterpretManipulator to create and interpret the manipulators associated with GraphicCompTool and StretchTool.
void AddDamage(Graphic*)void IncurDamage(Graphic*)
GraphicViews should incur damage in response to a change in their appearance, which generally happens in their Update function. AddDamage and IncurDamage produce damage by calling the related operations on the enclosing viewer's damage object. Subclasses can use these functions for convenience to avoid accessing the enclosing viewer's damage object directly.
void Unselect(GraphicView*)
A convenience function that unselects the given view, which entails erasing its handles and removing it from the enclosing editor's selection object.
virtual void Add(GraphicView*)virtual void Append(GraphicView*)virtual void InsertBefore(Iterator, GraphicView*)virtual void Remove(Iterator&)virtual void DeleteView(Iterator&)
Unimplemented operations that composite subclasses should redefine for modifying their (conceptual) list of children. Note that subclasses needn't necessarily store their children in a list data structure, but a list maps closely to the semantics of these operations. These operations are not public because only the view itself knows how to keep its structure consistent with that of the subject and/or its semantics.
Addadds aGraphicViewto the end of the list of children.InsertBeforeinserts aGraphicViewbefore theGraphicViewpointed to by the iterator.Removeremoves a view to which the given iterator refers from the list without deleting it, whileDeleteViewremoves it and deletes it.RemoveandDeleteViewshould advance the iterator to point to the following view as a side effect.
β¨ GRAPHICVIEWS PUBLIC OPERATIONS β¨
okay so bestie, we're in the public operations now, and it's giving very much "here's what you can actually call." Let's go. π«Ά
GraphicViews(GraphicComps* = nil)β this constructor creates aGraphicViews, and you can optionally supply the subject. The= nildefault means you don't have to pass one if you're not feeling it. πvirtual ~GraphicViews()β the destructor. It deletes theGraphicViews' children. Yes, the children. not me hyping up a destructor, but here we are. πvirtual void Interpret(Command*)βGraphicViewsobjects interpret the following command:AlignToGridCmdβ aligns the graphical component to the grid that affects the view. The overall alignment is based on how the first leaf subcomponent aligns itself:Interpretaligns the first leaf subcomponent to the grid and then moves all other subcomponents by the amount that the leaf moved. the way thatInterprethandlesAlignToGridCmdis so specific, and I'm obsessed. periodt. β¨
virtual void Update()β automatically update theGraphicViews' state and structure to match the subject's. It usesGVUpdaterto do its work.
β οΈ Important vibe check: Update will not necessarily detect restructurings or state modifications made to the subject's children more than one level deep. So if you're messing with deeper children, don't assume this will catch it. π
virtual Graphic* GetGraphic()β returns theGraphicViews' graphic, which (like its subject's graphic) is aPicture. Iconic main character energy. πGraphicComps* GetGraphicComps()β returns the subject. That's it. Simple, clean, slay. π
π GRAPHICVIEWS PROTECTED OPERATIONS π
UList* Elem(Iterator)β a convenience function for extracting aUListfrom an iterator. Helpful little helper, no cap. πΈ
π₯ SEE ALSO π₯
literally go read these too, bestie, they're all part of the extended universe, iykyk:
Command(3U)ComponentView(3U)Connector(3U)Damage(3U)GVUpdater(3U)GraphicComp(3U)GraphicCompTool(3U)Grid(3U)Event(3I)Manipulator(3U)MoveTool(3U)Picture(3U)RotateTool(3U)Rubband(3I)ScaleTool(3U)Selection(3U)StretchTool(3U)Transformer(3I)Viewer(3U)align(3U)
and that's the whole page, bestie. This one comes from Unidraw, dated 18 January 1991, and it's the GraphicView(3U) manual page. Bye! πβ¨
π¦ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms