Interface sgraphics.Glyph
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface sgraphics.Glyph

public interface Glyph
extends Object
The Glyph is the smallest unit in the Sgraphics library. Glyphs can be assembled in a tree and they allow children to overlap, but instances can only be used once in a tree.

It is up to the user to insure there are no circular references or any instance sharing!


Method Index

 o allocate(Allocation)
Allocate the size of the region where the glyph will draw.
 o append(Glyph)
Append a glyph to the composite list.
 o body()
Get the body of a glyph.
 o count()
Get the number of child glyphs for a PolyGlyph.
 o draw(Painter)
Tell the glyph to draw itself with the given graphics.
 o empty()
Remove all the glyphs added with append() or prepend();
 o getChild(int)
Get a child glyph;
 o getParentGlyph()
Get the parent glyph.
 o getSgraphicsAdapter()
Get the adapter.
 o grab(Viewer)
Grab the events.
 o needRedraw()
This is called when a glyph needs to be redrawn because it has changed internal state.
 o needRedraw(Area)
This is called when an area needs to be redrawn.
 o needResize()
This is called when a glyph needs to be redrawn because it has changed size.
 o pick(Picker)
Traverse the glyph tree and return all the glyphs that intersect the position of the given event.
 o prepend(Glyph)
Prepend a glyph to the composite list.
 o replace(int, Glyph)
Replace a glyph to the composite list.
 o requirements()
Ask for the glyph's geometry requirements.
 o setBody(Glyph)
Set the body of the glyph.
 o setParent(Glyph)
Set the parent glyph.
 o swap(int, int)
Swap to child glyphs in the composite list.
 o ungrab()
Ungrab the events.

Methods

 o setParent
  public abstract void setParent(Glyph parent)
Set the parent glyph. It is the responsibility of the parent to call this and pass its pointer. (Not used for normal use.)
 o getParentGlyph
  public abstract Glyph getParentGlyph()
Get the parent glyph. (Not used for normal use.)
 o requirements
  public abstract Requirements requirements()
Ask for the glyph's geometry requirements. A composite glyph can store its requisition rather than compute it to speed up the system as long as its children notify the parent when their size changes.
Returns:
the requirements.
 o allocate
  public abstract void allocate(Allocation allocation)
Allocate the size of the region where the glyph will draw. This operation is called by the parent after it has computed the actual size its child must use. The child is responsible for determining how to deal with a size that is smaller or larger than its requirement, but should not draw outside the allocation.
Parameters:
allocation - the actual screen space the glyph should use to draw.
 o pick
  public abstract void pick(Picker pick)
Traverse the glyph tree and return all the glyphs that intersect the position of the given event. This starts at the top of a tree and proceeds downward.
Parameters:
pick - the traversal object.
 o body
  public abstract Glyph body()
Get the body of a glyph. (This returns null for PolyGlyph.)
Returns:
the body.
 o setBody
  public abstract void setBody(Glyph body)
Set the body of the glyph. (This does noththing for a PolyGlyph.)
Parameters:
param - body the child (body) glyph.
 o append
  public abstract void append(Glyph glyph)
Append a glyph to the composite list. (This does nothing for a MonoGlyph.)
Parameters:
glyph - the glyph appended.
 o prepend
  public abstract void prepend(Glyph glyph)
Prepend a glyph to the composite list. (This does nothing for a MonoGlyph.)
Parameters:
glyph - the glyph appended.
 o replace
  public abstract void replace(int position,
                               Glyph glyph)
Replace a glyph to the composite list. (This does nothing for a MonoGlyph.) If the position is bad, nothing happens and the no error is reported.
Parameters:
position - the glyph to replace.
glyph - the glyph appended.
 o swap
  public abstract void swap(int position1,
                            int position2)
Swap to child glyphs in the composite list. (This does nothing for a MonoGlyph.) If a position is bad, nothing happens and the no error is reported.
Parameters:
position1 - the first glyph to swap.
position2 - the second glyph to swap.
 o getChild
  public abstract Glyph getChild(int pos)
Get a child glyph;
Parameters:
pos - the position of the child.
Returns:
the child or null if the pos is too large.
 o empty
  public abstract void empty()
Remove all the glyphs added with append() or prepend();
 o count
  public abstract int count()
Get the number of child glyphs for a PolyGlyph.
Returns:
the count;
 o needRedraw
  public abstract void needRedraw()
This is called when a glyph needs to be redrawn because it has changed internal state.
 o needRedraw
  public abstract void needRedraw(Area area)
This is called when an area needs to be redrawn.
Parameters:
area - the area to redraw.
 o needResize
  public abstract void needResize()
This is called when a glyph needs to be redrawn because it has changed size.
 o draw
  public abstract void draw(Painter painter)
Tell the glyph to draw itself with the given graphics.
Parameters:
painter - the place to draw.
 o grab
  public abstract void grab(Viewer target)
Grab the events. No other viewer will receive events.
Parameters:
target - the glyph that is grabbing the events.
 o ungrab
  public abstract void ungrab()
Ungrab the events.
 o getSgraphicsAdapter
  public abstract SgraphicsAdapter getSgraphicsAdapter()
Get the adapter.

All Packages  Class Hierarchy  This Package  Previous  Next  Index