Class sgraphics.wrapper.HitGlyph
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sgraphics.wrapper.HitGlyph

java.lang.Object
   |
   +----sgraphics.GlyphImpl
           |
           +----sgraphics.MonoGlyph
                   |
                   +----sgraphics.wrapper.HitGlyph

public class HitGlyph
extends MonoGlyph
A class that adds it self to the pick any time a decendent glyph is hit.

It is useful when a ancestor glyph needs to know about a glyph that is the ancestor of another glyph. For example, an editor may have a vbox full of hboxes that are in turn full of FigLabels. When a FigLabel is hit, the parent of the vbox may need to know which hbox contained the hit FigLabel to determine which row it was in. In this case, each hbox can be wrapped in a HitGlyph. (You must make sure there is no Viewer between HitGlyph and the FigLabel.)

The parent glyph of the vbox would store the FigLabel reference when the event reaches it. Then when the event from the HitGlyph reaches it, it could use its reference to determine the row, and the saved FigLabel reference to determine the position in the row.

This is an alternative approach to building glyphs that have knowledge of their row and column. While the latter works, it means updating their state after scrolling, etc. Using the HitGlyph approach means looking through a list to find the glyph index, possibly with a hash table for speed.


Constructor Index

 o HitGlyph(Glyph)
Make a hit glyph.

Method Index

 o pick(Picker)
Overrides the pick.

Constructors

 o HitGlyph
  public HitGlyph(Glyph glyph)
Make a hit glyph.
Parameters:
glyph - the child glyph.

Methods

 o pick
  public void pick(Picker pick)
Overrides the pick.
Parameters:
pick - the picker.
Overrides:
pick in class MonoGlyph

All Packages  Class Hierarchy  This Package  Previous  Next  Index