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!
-
allocate(Allocation)
- Allocate the size of the region where the glyph will draw.
-
append(Glyph)
- Append a glyph to the composite list.
-
body()
- Get the body of a glyph.
-
count()
- Get the number of child glyphs for a PolyGlyph.
-
draw(Painter)
- Tell the glyph to draw itself with the given graphics.
-
empty()
- Remove all the glyphs added with append() or prepend();
-
getChild(int)
- Get a child glyph;
-
getParentGlyph()
- Get the parent glyph.
-
getSgraphicsAdapter()
- Get the adapter.
-
grab(Viewer)
- Grab the events.
-
needRedraw()
- This is called when a glyph needs to be redrawn because it has changed
internal state.
-
needRedraw(Area)
- This is called when an area needs to be redrawn.
-
needResize()
- This is called when a glyph needs to be redrawn because it has changed
size.
-
pick(Picker)
- Traverse the glyph tree and return all the glyphs
that intersect the position of the given event.
-
prepend(Glyph)
- Prepend a glyph to the composite list.
-
replace(int, Glyph)
- Replace a glyph to the composite list.
-
requirements()
- Ask for the glyph's geometry requirements.
-
setBody(Glyph)
- Set the body of the glyph.
-
setParent(Glyph)
- Set the parent glyph.
-
swap(int, int)
- Swap to child glyphs in the composite list.
-
ungrab()
- Ungrab the events.
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.)
getParentGlyph
public abstract Glyph getParentGlyph()
- Get the parent glyph. (Not used for normal use.)
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.
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.
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.
body
public abstract Glyph body()
- Get the body of a glyph. (This returns null for PolyGlyph.)
- Returns:
- the body.
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.
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.
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.
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.
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.
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.
empty
public abstract void empty()
- Remove all the glyphs added with append() or prepend();
count
public abstract int count()
- Get the number of child glyphs for a PolyGlyph.
- Returns:
- the count;
needRedraw
public abstract void needRedraw()
- This is called when a glyph needs to be redrawn because it has changed
internal state.
needRedraw
public abstract void needRedraw(Area area)
- This is called when an area needs to be redrawn.
- Parameters:
- area - the area to redraw.
needResize
public abstract void needResize()
- This is called when a glyph needs to be redrawn because it has changed
size.
draw
public abstract void draw(Painter painter)
- Tell the glyph to draw itself with the given graphics.
- Parameters:
- painter - the place to draw.
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.
ungrab
public abstract void ungrab()
- Ungrab the events.
getSgraphicsAdapter
public abstract SgraphicsAdapter getSgraphicsAdapter()
- Get the adapter.
All Packages Class Hierarchy This Package Previous Next Index