home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / LIB / SEMANTIC.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.8 KB  |  85 lines

  1.  
  2. package sub_arctic.lib;
  3.  
  4.  
  5. import java.awt.Point;
  6. import java.awt.Dimension;
  7. import java.awt.Rectangle;
  8.  
  9. /** 
  10.  * This class provides a container object that does the extra damage
  11.  * declarations for semantic_lens children.  Basically any damage that
  12.  * is inside the bound one of its children that is a semantic_lens object is 
  13.  * expanded to include all of that lens object.  This is needed since drawing 
  14.  * inside lenses is not limited to the bounds of the object that controls the 
  15.  * drawing (but is limited to the lens).
  16.  *
  17.  * @see semantic_lens
  18.  * @author Scott Hudson
  19.  */
  20. public class semantic_lens_parent extends base_parent_interactor 
  21.   {
  22.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  23.  
  24.     /** Full constructor.
  25.      *
  26.      * @param int x x position of the object
  27.      * @param int y y position of the object
  28.      * @param int w width of the object
  29.      * @param int h height of the object
  30.      */
  31.     public semantic_lens_parent(int x, int y, int w, int h) 
  32. {
  33.     super(x,y,w,h);
  34.       }
  35.  
  36.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  37.  
  38.     /** 
  39.      * Catch damage from children and expand it to include damage from
  40.      * each of our lenses that overlap the damage.  We need to do this
  41.      * because drawing in a lens is not limited to the bound of the object
  42.      * that created it (but is limited to the lens).  
  43.      * 
  44.      * @param Point     top_left top-left corner of damage from one of our 
  45.      *                           children (in our coordinates).
  46.      * @param Dimension sz       the size of the damage rectangle.
  47.      */
  48.     public void damage_from_child(Point top_left, Dimension sz) 
  49. {
  50.       Rectangle damage;
  51.  
  52.           /* let the super class do child damage itself */
  53.       super.damage_self(top_left, sz);
  54.  
  55.       /* look through the children and do damage for any lenses we find 
  56.        * that overlap the damage from the child. 
  57.        */
  58.       damage = new Rectangle(top_left, sz);
  59.       for (int i = 0; i < num_children(); i++)
  60.         {
  61.           if ((child(i) instanceof semantic_lens) && 
  62.            child(i).bound().intersects(damage))
  63.             damage_self(child(i).pos(), child(i).size());
  64.         }
  65.     }
  66.  
  67.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  68. }
  69. /*=========================== COPYRIGHT NOTICE ===========================
  70.  
  71. This file is part of the subArctic user interface toolkit.
  72.  
  73. Copyright (c) 1996 Scott Hudson and Ian Smith
  74. All rights reserved.
  75.  
  76. The subArctic system is freely available for most uses under the terms
  77. and conditions described in 
  78.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  79. and appearing in full in the lib/interactor.java source file.
  80.  
  81. The current release and additional information about this software can be 
  82. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  83.  
  84. ========================================================================*/
  85.