Selection(3U)
π Selection(3U) π
okay bestie, we're in the InterViews Reference Manual and today's main character is Selection β she maintains a list of selected graphical component views. yes, that kind of list. let's go π
β¨ NAME β¨
Selection β maintains a list of selected graphical component views π¦
πΈ SYNOPSIS πΈ
#include <Unidraw/selection.h>
π DESCRIPTION π
so like, a Selection manages a set of distinguished graphical component views β usually the ones the user has expressed interest in by selecting them with a tool or a command. yk, the chosen ones. π
each selection object maintains a list of graphical component views and provides operations for iterating through and manipulating the list. and bestie, everyone leans on these β components, commands, tools, and editors often rely on one or more selection objects to supply the components on which they operate. it's giving popular. it's giving essential. π
π₯ PUBLIC OPERATIONS π₯
Selection(Selection* = nil)
create a new selection object, optionally containing references to the same views as the given selection object. so if you pass a selection in, your new one is basically its twin. β¨
virtual ~Selection()
destroy a selection instance. important caveat bestie: deleting the selection does not in turn delete the view instances it maintains. so don't be out here thinking the views go down with the ship, because they do not. π
void Show(Viewer* = nil) / void Update(Viewer* = nil) / void Hide(Viewer* = nil) / void Init(Viewer* = nil)
void Show(Viewer* = nil)
void Update(Viewer* = nil)
void Hide(Viewer* = nil)
void Init(Viewer* = nil)
these operations affect how the selection is represented visually in the viewer. let's break it down:
Showinstructs the views to initialize and draw their handles to highlight themselves, thus indicating that they are selected. to do so, it callsRedrawHandleson each view. glow up activated. πUpdatemakes handles of newly-selected, unhighlighted views appear by callingDrawHandleson all its views. the late arrivals finally get their moment. πHideunhighlights the views by calling theirEraseHandlesoperation. bye bestie, we don't see you anymore. π«οΈInitinitializes each view's handles without drawing them (in case the handles' appearance may have changed) by callingInitHandleson each. prep work, no spotlight. π
void Clear(Viewer* = nil)
remove all views from the Selection object, hiding their handles in the process. full reset, everything gone, handles tucked away. β¨
void Append(GraphicView*) / void Prepend(GraphicView*) / void InsertAfter(Iterator, GraphicView*) / void InsertBefore(Iterator, GraphicView*) / void Remove(GraphicView*) / void Remove(Iterator&)
void Append(GraphicView*)
void Prepend(GraphicView*)
void InsertAfter(Iterator, GraphicView*)
void InsertBefore(Iterator, GraphicView*)
void Remove(GraphicView*)
void Remove(Iterator&)
operations for modifying the selection's list of views. the rundown:
AppendandPrependadd aGraphicViewto the end and the beginning of the list, respectively. back of the line vs. front of the line, no cap. πΆββοΈInsertAfterandInsertBeforeinsert aGraphicViewafter and before theGraphicViewpointed to by the iterator, respectively. cutting the line, but make it legal. π- the
Removeoperations remove a view from the list (without deleting it β say it with me, without deleting it). you can remove a view instance by referring to it explicitly or by specifying an iterator. if an iterator is supplied, theRemoveoperation will advance it to point to the following view as a side effect. heads up on that side effect, it's lowkey sneaky. π
GraphicView* GetView(Iterator) / void SetView(GraphicView*, Iterator&)
GraphicView* GetView(Iterator)
void SetView(GraphicView*, Iterator&)
GetView returns the view to which an iterator points. SetView initializes an iterator to point to a particular view in the list; it initializes the iterator to point to a nil instance if the given GraphicView is not in the selection list. so if she's not on the list, she's not getting in. π
ββοΈ
void First(Iterator&) / void Last(Iterator&) / void Next(Iterator&) / void Prev(Iterator&) / boolean Done(Iterator)
void First(Iterator&)
void Last(Iterator&)
void Next(Iterator&)
void Prev(Iterator&)
boolean Done(Iterator)
operations for iterating over the selection list. the whole vibe:
FirstandLastinitialize an iterator to point to the beginning and end of the list, respectively. βNextincrements the iterator to point to the following view, whilePrevdecrements the iterator to point to the preceding view. forward and backward, we contain multitudes. π¦Donereturns whether or not the iterator points beyond the first or last view in the list. your lil "are we there yet" check. π«Ά
boolean IsEmpty() / boolean Includes(GraphicView*) / int Number()
boolean IsEmpty()
boolean Includes(GraphicView*)
int Number()
operations that return information about the selection object's contents. the gossip:
IsEmptyreturns whether the selection list is empty. π³οΈIncludesreturns whether the list contains the given view. πNumberreturns the number of views in the list. math era. π’
void Sort(GraphicView*)
sort the views in the selection list to conform to their order in the given GraphicView's list of children. here's the tea: the selection list's order usually reflects the order in which the user selected the objects, not their order in their parent. Sort is useful in operations that modify or depend on the parent view's structure. so when the parent's opinion matters, you call her. π
void Merge(Selection*) / void Exclusive(Selection*)
void Merge(Selection*)
void Exclusive(Selection*)
operations that change the selection object's contents based on another selection's:
Mergeadds the views in the given selection to those already in the selection object β that's the union of the two sets. everyone's invited. πExclusiveadds those views not already in this object and removes those common to both β that's the union minus the intersection of the two sets. chaotic, but mathematically correct. π
neither of these operations change the contents of their argument. the other selection stays unbothered, as she should. π
void GetBox(Coord&, Coord&, Coord&, Coord&)
return the bounding box circumscribing the views in the selection list. wrap it up, box it in. π
π§ PROTECTED OPERATIONS π§
UList* Elem(Iterator) / GraphicView* View(UList*)
UList* Elem(Iterator)
GraphicView* View(UList*)
Selection stores its views on a UList, which is accessible via the _ulist protected member. the Selection's iteration operations store the UList containing the current view in their iterator. Elem is a convenience function for returning the UList to which an iterator points, and View extracts the GraphicView that a UList element contains. two little helpers doing the most. π«Ά
π SEE ALSO π
GraphicView(3U)Iterator(3U)UList(3U)Viewer(3U)
and that's the whole page bestie, we ate and left no crumbs π this was brought to you by Unidraw, dated 6 August 1990, filed under Selection(3U) β iconic then, iconic now, 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