GraphicComp,  GraphicComps  -  base  classes for graphical
       component subjects


SYNOPSIS

       #include <Unidraw/Components/grcomp.h>


DESCRIPTION

       GraphicComp is an abstract base class for components  that
       store graphical information in a Graphic object.  Graphic-
       Comp is derived from Component  and  adds  operations  for
       manipulating  its graphical attributes.  GraphicComps is a
       non-abstract subclass of GraphicComp for composite graphi-
       cal component subjects.


GRAPHICCOMP PUBLIC OPERATIONS

       virtual ~GraphicComp()
              The  destructor  deletes the GraphicComp's graphic,
              if any.

       virtual void Interpret(Command*)
       virtual void Uninterpret(Command*)
              GraphicComp objects can (un)interpret the following
              commands:

              AlignCmd  aligns  the  GraphicComp's  graphic  with
              respect to the graphic in the GraphicComp  returned
              by  AlignCmd::GetReference.   The alignment's sense
              is defined by  the  alignments  that  the  AlignCmd
              specifies:  The  first Alignment parameter returned
              by AlignCmd::GetAlignment specifies  the  alignment
              with  respect  to  the reference graphic, while the
              second Alignment parameter specifies the  alignment
              with respect to this's graphic.

              BrushCmd sets the graphic's brush to the BrushCmd's
              value.

              ColorCmd sets the graphic's  foreground  and  back-
              ground colors.

              FontCmd sets the graphic's font.

              MobilityCmd  sets the GraphicComp's mobility to the
              MobilityCmd's value.

              MoveCmd translates the GraphicComp's graphic by the
              amounts in the MoveCmd.

              PatternCmd sets the graphic's pattern.

              RotateCmd  rotates the GraphicComp's graphic by the
              amount in the RotateCmd.
              amounts in the ScaleCmd.

       virtual Graphic* GetGraphic()
              Return the GraphicComp's graphic.  GraphicComp sub-
              class normally redefine this  operation  to  return
              the graphic that defines their appearance.

       virtual Component* GetParent()
              GraphicComp  redefines GetParent to return its par-
              ent.  However, GraphicComp does not store a pointer
              to  the  parent explicitly; instead, it obtains its
              graphic's parent and obtains the GraphicComp  asso-
              ciated with the parent graphic.  The graphic stores
              the GraphicComp that contains it in  its  tag  (see
              SetGraphic below).

       GraphicComp* GetComp(Iterator)
       void SetComp(GraphicComp*, Iterator&)
              These operations do nothing by default.  Subclasses
              that contain children should redefine them as  fol-
              lows:  GetComp  should  return  the  GraphicComp to
              which an iterator points.  SetComp should  initial-
              ize  the iterator to point to a particular Graphic-
              Comp in the list of children; it should  initialize
              the  iterator  to  point  to  a nil instance if the
              given GraphicComp is 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 the their (concep-
              tual)  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.

              Modify  the  GraphicComp's graphic state by calling
              Bequeath on its Graphic.  Graphic::Bequeath  propa-
              gates  this's  graphic state to its immediate chil-
              dren,  nullifying  its  own  graphics  state;   see
              Graphic(3U) for a more complete description.

       virtual Mobility GetMobility()
       virtual void SetMobility(Mobility)
              Get  and set the GraphicComp's mobility.  GetMobil-
              ity returns Undef by default, and SetMobility  does
              nothing.


GRAPHICCOMP PROTECTED OPERATIONS

       GraphicComp(Graphic* = nil)
              The Graphic instance that defines the GraphicComp's
              graphical attributes can be specified in  the  con-
              structor,  which  is  protected  to  guard  against
              instantiation.

       virtual void SetGraphic(Graphic*)
       virtual GraphicComp* GetGraphicComp(Graphic*)
              SetGraphic sets the GraphicComp's  graphic  to  the
              given  one,  and  store  this  in the graphic using
              Graphic::SetTag.  This makes it possible to  obtain
              the  GraphicComp  that  owns  the  graphic from the
              graphic itself.  GetGraphicComp returns the  Graph-
              icComp associated with the given graphic.

       void Skip(istream&)
       void Mark(ostream&)
              Convenience  functions that simply call their Cata-
              log counterparts.

       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 WriteGraymap(Raster*, ostream&)
       void WriteRaster(Raster*, ostream&)
       void WriteVertices(const Coord*, const Coord*, int,
              ostream&)
              Convenience  functions for reading and writing com-
              mon GraphicComp information.  These operations  are
              most  often  used  in  the  Read and Write calls of
              GraphicComp subclasses.   The  Write...  operations
              send  a  stream of bytes characterizing their first
              parameter to the ostream.  The  Read...  operations
              reconstruct  the  object(s) from the bytes that the
              istream supplies.


GRAPHICCOMPS PUBLIC OPERATIONS

       GraphicComps()
       GraphicComps(Graphic*)
       virtual ~GraphicComps()
              The parameterless  constructor  sets  the  Graphic-
              Comps' graphic to a new Picture instance, while the
              other lets you specify the graphic explicitly.  The
              destructor deletes its children.

       virtual void Interpret(Command*)
       virtual void Uninterpret(Command*)
              GraphicComps  can  (un)interpret the following com-
              mands in addition to those that GraphicComp objects
              (un)interpret:

              BackCmd  and  FrontCmd  change  the position of the
              GraphicComps' 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 of
              GraphicViews  that  are  selected  currently in the
              command's editor.  Interpreting a BackCmd will move
              the  children  on the clipboard so that they appear
              behind the others, preserving their relative order;
              the opposite occurs when interpreting a FrontCmd.

              CutCmd removes the components in the CutCmd's clip-
              board from the GraphicComps and places them in  the
              catalog's  global clipboard.  Interpret will create
              a clipboard containing  the  subjects  of  selected
              GraphicViews  if  the  CutCmd has no clipboard ini-
              tially.

              DeleteCmd removes the components in the DeleteCmd's
              clipboard  from  the GraphicComps and destroys them
              when the DeleteCmd is destroyed if it has not  been
              uninterpreted.   Interpret  will create a clipboard
              containing the subjects of selected GraphicViews if
              the DeleteCmd has no clipboard initially.

              Interpret  will  create  a clipboard containing the
              subject of selected GraphicViews if the DupCmd  has
              no clipboard initially.

              GroupCmd  removes  the components in the GroupCmd's
              clipboard from the GraphicComps  and  inserts  them
              into   the   destination  GraphicComp  returned  by
              GroupCmd::GetGroup.  The destination is inserted at
              the  position  formerly occupied by the last compo-
              nent in the clipboard.   If  the  GroupCmd  has  no
              clipboard  initially, interpret will create a clip-
              board containing the subjects  of  selected  Graph-
              icViews. If GroupCmd does not define a destination,
              Interpret will create a GraphicComps  instance  and
              set  the GroupCmd's destination explicitly.  Inter-
              pret does nothing if the  clipboard  contains  less
              than two components.

              UngroupCmd extracts the children from components in
              the UngroupCmd's  clipboard  and  inserts  them  in
              order immediately after their parents.  The parents
              are then removed from the GraphicComps.   The  par-
              ents  are destroyed along with the UngroupCmd if it
              has not been Uninterpreted.

              PasteCmd appends copies of the  components  in  the
              PasteCmd's  clipboard  to the GraphicComps.  If the
              PasteCmd has no clipboard initially,  it  will  use
              the global clipboard from the catalog.


GRAPHICCOMPS PROTECTED OPERATIONS

       GraphicComp* Comp(UList*)
       UList* Elem(Iterator)
              Convenience  functions for extracting a GraphicComp
              from a UList element and a UList from an  iterator.

       void SelectViewsOf(GraphicComp*, Editor*)
              A  convenience function for selecting all the views
              of the given GraphicComp that appear in  the  given
              editor.  SelectViewsOf clears the original contents
              of the selection.

       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.   SelectViewsOf  clears
              the original contents of the selection.

       void StorePosition(GraphicComp*, Command*)
              Store  the  given  child's  position into the given
              Command with Command::Store.

              Insert the given GraphicComp  into  this  based  on
              position  information  stored in the given command.
              The position information must have been stored with
              StorePosition.

       void Group(Clipboard*, GraphicComp* destination, Command*)
       void Ungroup(GraphicComp* parent, Clipboard*, Command*)
              Helper functions  used  in  the  interpretation  of
              GroupCmd   and   UngroupCmd,  respectively.   Group
              inserts the components in the clipboard into desti-
              nation  and  inserts destination into this, storing
              undo information in the command.   Ungroup  removes
              all  children  from  parent, puts them on the clip-
              board, and then removes parent from this.   Ungroup
              also stores undo information in the command.


SEE ALSO

       BrushCmd(3U),  Catalog(3U),  Clipboard(3U),  ColorCmd(3U),
       Component(3U), Editor(3U), FontCmd(3U), Iterator(3U), Pat-
       ternCmd(3U),    Picture(3U),   Selection(3U),   UList(3U),
       align(3U),  edit(3U),  globals(3U),   struct(3U),   trans-
       forms(3U)































Man(1) output converted with man2html