SYNOPSIS

#include <Unidraw/clipboard.h>

DESCRIPTION

A Clipboard maintains a list of GraphicComp objects and provides operations for manipulating the list. Catalog and Command classes use clipboards to store graphical components they affect.

PUBLIC OPERATIONS

Clipboard(GraphicComp* = nil)

Construct a new clipboard object, optionally with a GraphicComp that should appear initially on the list.

virtual ~Clipboard()

Delete the clipboard. Deleting the clipboard does not delete the GraphicComp objects it contains.

void Init(Selection*)

void CopyInit(Selection*)

Init initializes the clipboard with the subjects belonging to the graphical views in the given selection object. CopyInit initializes it with copies of the subjects.

void Clear()

Remove all GraphicComp objects from the clipboard. The objects are not deleted.

void DeleteComps()

Delete each GraphicComp in the clipboard. This operation does not delete the list itself; thus it will still be possible to iterate through the list afterwards. DeleteComps is generally called just before the clipboard is destroyed.

void Append(GraphicComp*)

void Prepend(GraphicComp*)

void InsertAfter(Iterator, GraphicComp*)

void InsertBefore(Iterator, GraphicComp*)

void Remove(GraphicComp*)

void Remove(Iterator&)

Operations for adding and removing GraphicComp objects from the clipboard. InsertAfter and InsertBefore take an iterator that specifies the point before or after which the given GraphicComp should be inserted. Remove(Iterator&) removes the GraphicComp to which the iterator refers and increments the iterator to point to the following GraphicComp.

GraphicComp* GetComp(Iterator)

void SetComp(GraphicComp*, Iterator&)

GetComp effectively dereferences an iterator, returning the GraphicComp to which it points. SetComp initializes an iterator to point to the given GraphicComp object, assuming the object is in the clipboard.

void First(Iterator&)

void Last(Iterator&)

void Next(Iterator&)

void Prev(Iterator&)

boolean Done(Iterator&)

Operations for iterating through the GraphicComps in the clipboard. First and Last modify the iterator to point to the first and last GraphicComp objects. Next and Prev make the iterator point to the succeeding and preceding GraphicComp objects. Done returns whether the iterator points to the sentinel object on the list, which marks the beginning and the end of list.

boolean IsEmpty()

boolean Includes(GraphicComp*)

Return whether or not the clipboard is empty or whether it includes the given GraphicComp object.

virtual Clipboard* Copy()

virtual Clipboard* DeepCopy()

Copy creates a new clipboard with a list of the same GraphicComp objects as this. DeepCopy creates a new clipboard containing copies of the objects in this.

PROTECTED OPERATIONS

UList* Elem(Iterator)

GraphicComp* Comp(UList*)

The Clipboard class stores its GraphicComp objects in a UList. These convenience functions convert an iterator into a UList element and dereference a UList element to obtain a GraphicComp object, respectively.

RELATED TO Clipboard…

Catalog(3U), Command(3U), GraphicComp(3U), Iterator(3U), Selection(3U), UList(3U)