GraphicComp(3U)
π NAME π
GraphicComp, GraphicComps β base classes for graphical component subjects. Okay so this is from GraphicComp(3U), the InterViews Reference Manual, and it's giving foundational, bestie. π
β¨ SYNOPSIS β¨
#include <Unidraw/Components/grcomp.h>
Lowkey just one include, periodt.
πΈ DESCRIPTION πΈ
GraphicComp is an abstract base class for components that store graphical information in a Graphic object. It's derived from Component and adds operations for manipulating its graphical attributes. GraphicComps is a non-abstract subclass of GraphicComp for composite graphical component subjects. That's the vibe.
π GRAPHICCOMP PUBLIC OPERATIONS π
virtual ~GraphicComp()β The destructor deletes theGraphicComp's graphic, if any. π Not me crying over memory management.virtual void Interpret(Command*)virtual void Uninterpret(Command*)βGraphicCompobjects can (un)interpret the following commands, and honestly? iconic behavior:AlignCmdaligns theGraphicComp's graphic with respect to the graphic in theGraphicCompreturned byAlignCmd::GetReference. The alignment's sense is defined by the alignments that theAlignCmdspecifies: The firstAlignmentparameter returned byAlignCmd::GetAlignmentspecifies the alignment with respect to the reference graphic, while the secondAlignmentparameter specifies the alignment with respect to this's graphic. (Yes, "this's" β we keep it exact, no cap.)BrushCmdsets the graphic's brush to theBrushCmd's value.ColorCmdsets the graphic's foreground and background colors.FontCmdsets the graphic's font.MobilityCmdsets theGraphicComp's mobility to theMobilityCmd's value.MoveCmdtranslates theGraphicComp's graphic by the amounts in theMoveCmd.PatternCmdsets the graphic's pattern.RotateCmdrotates theGraphicComp's graphic by the amount in theRotateCmd.ScaleCmdscales theGraphicComp's graphic by the amounts in theScaleCmd.
virtual Graphic* GetGraphic()β Return theGraphicComp's graphic.GraphicCompsubclasses normally redefine this operation to return the graphic that defines their appearance. Slay.virtual Component* GetParent()βGraphicCompredefinesGetParentto return its parent. However,GraphicCompdoes not store a pointer to the parent explicitly; instead, it obtains its graphic's parent and obtains theGraphicCompassociated with the parent graphic. The graphic stores theGraphicCompthat contains it in its tag (seeSetGraphicbelow). π¦ iykyk.GraphicComp* GetComp(Iterator)void SetComp(GraphicComp*, Iterator&)β These operations do nothing by default. Subclasses that contain children should redefine them as follows:GetCompshould return theGraphicCompto which an iterator points.SetCompshould initialize the iterator to point to a particularGraphicCompin the list of children; it should initialize the iterator to point to a nil instance if the givenGraphicCompis not a child.void Append(GraphicComp*)void Prepend(GraphicComp*)void InsertAfter(Iterator, GraphicComp*)void InsertBefore(Iterator, GraphicComp*)void Remove(GraphicComp*)void Remove(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.
Append and Prepend add a GraphicComp to the end and the beginning of the list, respectively. InsertAfter and InsertBefore insert a GraphicComp after and before the GraphicComp pointed to by the iterator, respectively. The Remove operations remove a view from the list without deleting it. You can remove a view instance by referring to it explicitly or by specifying an iterator. If an iterator is supplied, the Remove operation should advance it to point to the following view as a side effect. π₯
virtual void Bequeath()β Modify theGraphicComp's graphic state by callingBequeathon itsGraphic.Graphic::Bequeathpropagates this's graphic state to its immediate children, nullifying its own graphics state; seeGraphic(3U)for a more complete description. Go read it, bestie.virtual Mobility GetMobility()virtual void SetMobility(Mobility)β Get and set theGraphicComp's mobility.GetMobilityreturnsUndefby default, andSetMobilitydoes nothing. It's giving default behavior. π
π§ GRAPHICCOMP PROTECTED OPERATIONS π§
GraphicComp(Graphic* = nil)β TheGraphicinstance that defines theGraphicComp's graphical attributes can be specified in the constructor, which is protected to guard against instantiation. πvirtual void SetGraphic(Graphic*)virtual GraphicComp* GetGraphicComp(Graphic*)βSetGraphicsets theGraphicComp's graphic to the given one, and store this in the graphic usingGraphic::SetTag. This makes it possible to obtain theGraphicCompthat owns the graphic from the graphic itself.GetGraphicCompreturns theGraphicCompassociated with the given graphic.void Skip(istream&)void Mark(ostream&)β Convenience functions that simply call theirCatalogcounterparts.int ReadBgFilled(istream&),PSBrush* ReadBrush(istream&),PSColor* ReadColor(istream&),PSFont* ReadFont(istream&),PSPattern* ReadPattern(istream&),PSTransformer* ReadTransformer(istream&),char* ReadString(istream&),Bitmap* ReadBitmap(istream&),Raster* ReadGraymap(istream&),Raster* ReadRaster(istream&),void ReadVertices(istream&, Coord*&, Coord*&, int&)void WriteBgFilled(boolean, ostream&),void WriteBrush(PSBrush*, ostream&),void WriteColor(PSColor*, ostream&),void WriteFont(PSFont*, ostream&),void WritePattern(PSPattern*, ostream&),void WriteTransformer(PSTransformer*, ostream&),void WriteString(const char*, ostream&),void WriteBitmap(Bitmap*, ostream&),void WriteGraymap(Raster*, ostream&),void WriteRaster(Raster*, ostream&),void WriteVertices(const Coord*, const Coord*, int, ostream&)β Convenience functions for reading and writing commonGraphicCompinformation. These operations are most often used in theReadandWritecalls ofGraphicCompsubclasses. TheWrite...operations send a stream of bytes characterizing their first parameter to theostream. TheRead...operations reconstruct the object(s) from the bytes that theistreamsupplies. Slay.
π GRAPHICCOMPS PUBLIC OPERATIONS π
GraphicComps()GraphicComps(Graphic*)virtual ~GraphicComps()β The parameterless constructor sets theGraphicComps' graphic to a newPictureinstance, while the other lets you specify the graphic explicitly. The destructor deletes its children. πvirtual void Interpret(Command*)virtual void Uninterpret(Command*)βGraphicCompscan (un)interpret the following commands in addition to those thatGraphicCompobjects (un)interpret:BackCmdandFrontCmdchange the position of theGraphicComps' children that are in the command's clipboard object. If the command has no clipboard, it will create one and fill it with the subjects ofGraphicViewsthat are selected currently in the command's editor. Interpreting aBackCmdwill move the children on the clipboard so that they appear behind the others, preserving their relative order; the opposite occurs when interpreting aFrontCmd.CutCmdremoves the components in theCutCmd's clipboard from theGraphicCompsand places them in the catalog's global clipboard.Interpretwill create a clipboard containing the subjects of selectedGraphicViewsif theCutCmdhas no clipboard initially.DeleteCmdremoves the components in theDeleteCmd's clipboard from theGraphicCompsand destroys them when theDeleteCmdis destroyed if it has not been uninterpreted.Interpretwill create a clipboard containing the subjects of selectedGraphicViewsif theDeleteCmdhas no clipboard initially.DupCmdduplicates the components in theDupCmd's clipboard, appending them to the list of children.Interpretwill create a clipboard containing the subject of selectedGraphicViewsif theDupCmdhas no clipboard initially.GroupCmdremoves the components in theGroupCmd's clipboard from theGraphicCompsand inserts them into the destinationGraphicCompreturned byGroupCmd::GetGroup. The destination is inserted at the position formerly occupied by the last component in the clipboard. If theGroupCmdhas no clipboard initially,interpretwill create a clipboard containing the subjects of selectedGraphicViews. IfGroupCmddoes not define a destination,Interpretwill create aGraphicCompsinstance and set theGroupCmd's destination explicitly.Interpretdoes nothing if the clipboard contains less than two components.UngroupCmdextracts the children from components in theUngroupCmd's clipboard and inserts them in order immediately after their parents. The parents are then removed from theGraphicComps. The parents are destroyed along with theUngroupCmdif it has not beenUninterpreted.PasteCmdappends copies of the components in thePasteCmd's clipboard to theGraphicComps. If thePasteCmdhas no clipboard initially, it will use the global clipboard from the catalog.
β¨ GRAPHICCOMPS PROTECTED OPERATIONS β¨
Okay bestie, these are the protected ops β the behind-the-scenes helpers that make the magic happen π«. No cap.
GraphicComp* Comp(UList*)andUList* Elem(Iterator)β these are convenience functions for extracting a GraphicComp from a UList element and a UList from an iterator. They're like little extractor tools, so you don't have to do it manually. π οΈvoid SelectViewsOf(GraphicComp*, Editor*)β a convenience function for selecting all the views of the given GraphicComp that appear in the given editor. Heads up:SelectViewsOfclears the original contents of the selection. So yeah, it's a full reset, no leftovers. π§Ήvoid SelectClipboard(Clipboard*, Editor)β a convenience function for selecting all the views of all the components in the given Clipboard that appear in the given editor. And same vibe:SelectViewsOfclears the original contents of the selection. (Yes, the manpage saysSelectViewsOfhere too β we're just quoting the queen. π )void StorePosition(GraphicComp*, Command*)β stores the given child's position into the given Command withCommand::Store. Basically saving the spot so you can find it later. πvoid RestorePosition(GraphicComp*, Command*)β inserts the given GraphicComp into this based on position information stored in the given command. The position info must have been stored withStorePosition. No guessing, bestie β it's gotta be saved first. π§void Group(Clipboard*, GraphicComp* destination, Command*)andvoid Ungroup(GraphicComp* parent, Clipboard*, Command*)β these are helper functions used in the interpretation ofGroupCmdandUngroupCmd, respectively. Group inserts the components in the clipboard into destination and inserts destination into this, storing undo information in the command. Ungroup removes all children from parent, puts them on the clipboard, and then removes parent from this. Ungroup also stores undo information in the command. So yeah, they're like the backstage crew for grouping and ungrouping β and they always save the undo. π
π SEE ALSO π
You already know these are the besties you should also check out:
BrushCmd(3U)Catalog(3U)Clipboard(3U)ColorCmd(3U)Component(3U)Editor(3U)FontCmd(3U)Iterator(3U)PatternCmd(3U)Picture(3U)Selection(3U)UList(3U)align(3U)edit(3U)globals(3U)struct(3U)transforms(3U)
That's the whole page, bestie! This iconic manual page comes from Unidraw, dated 24 November 1990 β yeah, it's vintage but still slaying. The source is GraphicComp(3U). Periodt. π β¨
π¦ 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