manips(3U)
manips(3U) β InterViews Reference Manual π¦
okay so bestie, this is the manips(3U) page from the InterViews Reference Manual, and it's giving direct-manipulation semantics in the best way. part 1, more coming. π
NAME π
The girlies in this file are ConnectManip, DragManip, ManipGroup, TextManip, and VertexManip β all of them are Manipulator subclasses for defining common direct-manipulation semantics. periodt. β¨
SYNOPSIS πΈ
#include <Unidraw/manips.h>
DESCRIPTION π¦
So Manipulator is an abstract base class for objects that encapsulate the mechanics of direct manipulation. Subclasses support different manipulation semantics, and they all have their own little main character energy. π«
DragManipis the subclass that implements a downclick-drag-upclick style of interaction, with optional constraints on motion (for example, horizontal or vertical only). slay.ConnectManipis aDragManipsubclass that adds a gravitational bias towards connector views. it's giving magnetic.VertexManipis aDragManipthat supports multiple downclick-and-drag interactions terminated by a distinguished downclick. multiple drags? iconic.TextManipprovides a text editing interface. typing era. π- Finally,
ManipGroupcomposes manipulator instances so that their interaction may proceed concurrently. group chat energy, fr fr.
DRAGMANIP PUBLIC OPERATIONS π₯
DragManip(
Viewer*, Rubberband*, Transformer* = nil, Tool* = nil,
DragConstraint = None
)
DragManip(
Viewer*, Rubberband*, Transformer*, Tool*,
DragConstraint, Coord, Coord
)
A DragManip uses a rubberband to animate the manipulation. The constructor takes the rubberband as a parameter along with the viewer in which it should appear, a transformer reflecting the transformation that component views undergo in the viewer, the tool that created the manipulator, and a DragConstraint that effectively restricts mouse motion in one or more ways. By default, motion is constrained when the Shift key is held down. The second constructor adds two Coord parameters. The DragManip will use these values to override the event coordinates when Grasp is first called. no cap. π«Ά
virtual void Grasp(Event&)βDragManipredefinesGraspoperation to call the rubberband'sTrackoperation, supplying the coordinates in the event.GraspcallsConstrain(described below) on the event prior to passing the coordinate information. The rubberband will not be drawn untilGraspis called. okay so don't expect the rubberband to show up early, bestie. πvirtual boolean Manipulating(Event&)β If the event is aMotionEvent,ManipulatingcallsTrackwith the event's coordinates and returnstrue.Manipulatingsimply returnsfalseif the event is anUpEvent. LikeDragManip::Grasp, this operation callsConstrainon the event prior to passing the coordinate information. so it's tracking and constraining, periodt. β¨virtual void Effect(Event&)βEffectsimply erases the rubberband by calling itsEraseoperation. bye bye rubberband. πvirtual void SetViewer(Viewer*)virtual void SetRubberband(Rubberband*)virtual void SetTransformer(Transformer*)virtual void SetTool(Tool*)virtual void SetConstraint(DragConstraint)virtual Viewer* GetViewer()virtual Rubberband* GetRubberband()virtual Transformer* GetTransformer()virtual Tool* GetTool()virtual DragConstraint GetConstraint()
Set and get the various parameters supplied to the DragManip in its constructor. getters and setters? we love a balanced duo. π
const Event& GraspEvent()β Return the event supplied to the last call toGrasp. the receipts, basically. π§Ύβ¨
DRAGMANIP PROTECTED OPERATIONS π‘οΈ
void Init(
Viewer*, Rubberband*, Transformer*, Tool*, DragConstraint
)
Assign the various constructor values common to both DragManip constructors. shared setup? we love to see it. π
virtual void Constrain(Event&)β Constrain the event to reflect theDragConstraint. The event coordinates are constrained when the event indicates that the shift key is held down for allDragConstraintvalues exceptGravity, which constrains the coordinates unconditionally with the viewer'sConstrainoperation. soGravityis the exception that does the most, naturally. π
CONNECTMANIP PUBLIC OPERATIONS π§²
ConnectManip(
Viewer*, Rubberband*, Transformer* = nil, Tool* = nil
)
ConnectManip supports the same type of interaction as DragManip, except the rubberband tracking is affected by a gravitational bias towards connector views. Whenever the user drags near a connector view, the tracking coordinates are suddenly constrained to coincide with the center of the connector view. The rubberband will not change its appearance thereafter until the user drags beyond the gravity threshold, which corresponds to SLOP (see globals(3U)) units beyond the nearest point on the connector view. magnetic behavior, fr fr. π§²π
virtual boolean Manipulating(Event&)βConnectManipredefinesManipulatingto support the gravitational effect. it's the same but with pull. π«ConnectorView* GetTarget()β Return the connector view that has captured the rubberband, if any. caught in 4k. πΈ
VERTEXMANIP PUBLIC OPERATIONS π
VertexManip(
Viewer*, GrowingVertices*, Transformer* = nil,
Tool* = nil, DragConstraint = None
)
VertexManip is like DragManip but supports multiple drags and clicks in one manipulation. The VertexManip constructor restricts the rubberband to be an instance of GrowingVertices. multi-step manipulation? main character behavior. π
virtual boolean Manipulating(Event&)β This operation is similar toDragManip's, except it callsAppendVertexon theGrowingVerticesrubberband on each down-click and returnsfalseif and only if the middle button is pressed. middle button said "I'm the terminator." πGrowingVertices* GetGrowingVertices()β Return theGrowingVerticesinstance. Use this operation as an alternative toGetRubberbandwhen that operation isn't specific enough. when you need the more specific bestie. π
TEXTMANIP PUBLIC OPERATIONS βοΈ
TextManip(Viewer*, Painter*, Coord tabwidth, Tool* = nil)
TextManip(
Viewer*, Painter*, Coord lineheight, Coord tabwidth,
Tool* = nil
)
Create a TextManip, supplying (at minimum) a viewer, a painter with which to draw (usually reflecting graphics attributes defined by the enclosing editor object), and the width of a tab character. Tab characters in the text will position the following character at an integral multiple of tabwidth from the beginning of the line. The distance between baselines in the text can be specified with the second constructor; this value corresponds to the font height by default. These constructors create text manipulators containing no text initially; the lower left corner of the first line of text (including the descender) will be positioned at the coordinates in the event passed to the Grasp operation. empty text era, but make it cute. π
TextManip(
Viewer*, const char* buf, int bufsize, Coord x, Coord y,
Painter*, Coord tabwidth, Tool* = nil
)
TextManip(
Viewer*, const char* buf, int bufsize, Coord x, Coord y,
Painter*, Coord lineheight, Coord tabwidth, Tool* = nil
)
Create text manipulators initialized with text by passing a buffer of text and its size. A copy of the buffer is used internally. The x and y parameters specify the position of the lower left corner of the first line of text (including the descender). These coordinates will override the coordinates specified by the event passed to Grasp. so if you brought your own position, it wins. periodt. π
virtual void Grasp(Event&)β Positions and draws the text. If the position-specifying constructors were used to create the instance, then the manipulator will use the event coordinates to set the insertion point's position in the text. insertion point placement? we love precision. β¨virtual boolean Manipulating(Event&)β Handle keystrokes and/or mouse motion events to support basic text editing. Motion events are interpreted to support text selection; selected text is displayed in reverse colors. TheManipulatingoperation returnsfalseif a downclick is detected outside the text or ifHandleKey(described below) returnsfalse. selection slay, reverse colors slay,falsemeans we out. πvirtual void Effect(Event&)βEffectdamages the viewer area thatTextManipcorrupted during editing. cleanup on aisle viewer. π§Ήvirtual Painter* GetPainter()virtual Coord GetLineHeight()virtual Coord GetTabWidth()virtual const char* GetText(int&)virtual void GetPosition(Coord&, Coord&)
Return various parameters specified in the constructor. GetText returns a pointer to the internal buffer containing the text; the reference parameter returns the buffer's size. getters said "here's the info, bestie." π
const Event& GraspEvent()β Return the event supplied to the last call toGrasp. same energy as before. π«Ά
π TEXTMANIP PROTECTED OPERATIONS π
Okay bestie, this is the backstage pass to TextManip β the protected ops that make the text widget do its little keyboard dance. π
virtual boolean HandleKey(Event&)β this one sets up TextManip's default key bindings, listed below. Unless it says otherwise down there, this function returnstrue. Periodt. β¨(^P)β backward line(^N)β forward line(^B)β backward character(^F)β forward character(ESC)β terminate text entry, causingHandleKeyto returnfalse(^A)β beginning of line(^E)β end of line(^D)β delete character(DEL)(^H)β delete backward character
int Dot()int Mark()β the current selection is bounded by two indices into the text buffer. By convention these indices are called dot and mark. Dot is the position at which text will be inserted and deleted. Mark locates the end of the selection that moves as the selection is modified. When the selection is empty (an insertion point), dot and mark are equal. Fr fr. π«Άvoid InsertText(const char* string, int count)void InsertCharacter(char)void DeleteText(int count)void DeleteCharacter(int)void DeleteLine()void DeleteSelection()β edit the text buffer at the current selection.InsertTextinsertscountcharacters fromstringafter dot. The selection becomes an insertion point following the newly inserted text.InsertCharacterreplaces the selected characters with a single character.DeleteTextdeletescountcharacters at dot. Ifcountis positive, the characters following dot are deleted; ifcountis negative the characters before dot are deleted. The selection becomes an insertion point in the place of the deleted text.DeleteSelectiondeletes the text between dot and mark, changing the selection to an insertion point.DeleteCharacteris identical toDeleteTextif the dot and mark are not the same; otherwise it is identical toDeleteSelection.DeleteCharacterprovides a convenient way to express the behavior of the backspace and delete operations. Finally,DeleteLinedeletes the line of text containing mark. The selection becomes an insertion point at mark. πvoid BackwardCharacter(int count)void ForwardCharacter(int count)void BackwardLine(int count)void ForwardLine(int count)void BackwardWord(int count)void ForwardWord(int count)β move the current selection forward or backward by the specified number of the specified units. The default movement is one unit. The selection is not moved before the beginning or after the end of the text. No cap. π¦void BeginningOfLine()void EndOfLine()void BeginningOfWord()void EndOfWord()void BeginningOfSelection()void EndOfSelection()void BeginningOfText()void EndOfText()β move the current selection forwards or backwards to the specified feature of the text. Slay. β¨void Select(int dot)void Select(int dot, int mark)void SelectMore(int mark)void SelectAll()β modify the current selection in terms of text indices. With a single parameter,Selectmoves both dot and mark to the specified index. With two parameters, dot and mark can be controlled independently.SelectMoreleaves dot unchanged and moves mark.SelectAllsets dot to the end of the text and mark to the beginning. Iconic behavior. πint Locate(Coord x, Coord y)boolean Contains(Coord, Coord)βLocatereturns the text index most closely matching the point(x, y).Containsreturns whether the text contains the point(x, y). Vibe check complete. πΈ
π MANIPGROUP PUBLIC OPERATIONS π
ManipGroup(Viewer* = nil, Tool* = nil)β create a ManipGroup, optionally supplying a viewer and a tool. β¨virtual void Grasp(Event&)β theGraspoperation simply callsGraspon each child in insertion order. πvirtual boolean Manipulating(Event&)βManipulatingcalls the corresponding operation on each child, skipping those children that have returnedfalsein previous calls (up to the lastGrasp). This function returnsfalsewhen all children have done so. No notes. π₯virtual void Effect(Event&)β ManipGroup'sEffectoperation callsEffecton each child.virtual void SetViewer(Viewer*)virtual void SetTool(Tool*)virtual Viewer* GetViewer()virtual Tool* GetTool()β set and get the ManipGroup's viewer and tool. The set operations set the ManipGroup's values for these parameters and call the corresponding operations on their children. The get operations simply return the ManipGroup's values.virtual void First(Iterator&)virtual void Last(Iterator&)virtual void Next(Iterator&)virtual void Prev(Iterator&)virtual boolean Done(Iterator)β operations for iterating over the ManipGroup's children, if any.FirstandLastinitialize an iterator to point to the beginning and end of the list of children, respectively.Nextincrements the iterator to point to the following child, whilePrevdecrements the iterator to point to the preceding child.Donereturns whether or not the iterator points beyond the first or last child in the list. π§Manipulator* GetManip(Iterator)void SetManip(Manipulator*, Iterator&)βGetManipreturns the child manipulator to which an iterator points.SetManipinitializes an iterator to point to a particular child; it initializes the iterator to point to anilinstance if the givenManipulatoris not a child of the ManipGroup. πvoid Append(...)andvoid Prepend(...)β these add up to four child manipulators, in order, to the end and the beginning of the list, respectively. Their exact signatures are:
void Append(
Manipulator*,
Manipulator* = nil, Manipulator* = nil, Manipulator* = nil
)
void Prepend(
Manipulator*,
Manipulator* = nil, Manipulator* = nil, Manipulator* = nil
)
void InsertBefore(Iterator, Manipulator*)void InsertAfter(Iterator, Manipulator*)void Remove(Manipulator*)void Remove(Iterator&)β operations for modifying the ManipGroup's list of children.InsertAfterandInsertBeforeinsert a child after and before the manipulator pointed to by the iterator, respectively. TheRemoveoperations remove a child from the list (without deleting it). You can remove a child by referring to it explicitly or by specifying an iterator. If an iterator is supplied, theRemoveoperation will advance it to point to the following child as a side effect. π
π§ MANIPGROUP PROTECTED OPERATIONS π§
UList* Elem(Iterator)Manipulator* Manip(UList*)β ManipGroup stores its children on aUList, which is accessible via the_kidsprotected member. TheSelection's iteration operations store theUListcontaining the current child in their iterator.Elemis a convenience function for returning theUListto which an iterator points, andManipextracts the child that aUListelement contains. π
πΈ SEE ALSO πΈ
Connector(3U)Event(3I)Iterator(3U)Manipulator(3U)Painter(3I)Rubband(3I)Tool(3U)Transformer(3I)UList(3U)Viewer(3U)globals(3U)
And that's the whole vibe, bestie. This page came from Unidraw, dated 1 August 1990, and it lives at manips(3U). Go off, text-manipulating icon. π β¨
π¦ 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