home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 13 / boot-disc-1997-09.iso / HyprWire / DATA.Z / HwVisualUserPlugIn.java < prev    next >
Text File  |  1997-01-24  |  8KB  |  195 lines

  1. package kinetix.hyperc1.runtime;
  2.  
  3. /********************************************************************************\
  4. **                                                                              **
  5. **  (C) Copyright 1997 by Autodesk, Inc.                                        **
  6. **                                                                              **
  7. **  This program is copyrighted by Autodesk, Inc. and is licensed to you under  **
  8. **  the following conditions.  You may not distribute or publish the source     **
  9. **  code of this program in any form.  You may incorporate this code in object  **
  10. **  form in derivative works provided such derivative works are (i.) are de-    **
  11. **  signed and intended to work solely with Autodesk, Inc. products, and (ii.)  **
  12. **  contain Autodesk's copyright notice "(C) Copyright 1997 by Autodesk, Inc."  **
  13. **                                                                              **
  14. **  AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  AUTODESK SPE-  **
  15. **  CIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR  **
  16. **  A PARTICULAR USE.  AUTODESK, INC.  DOES NOT WARRANT THAT THE OPERATION OF   **
  17. **  THE PROGRAM WILL BE UNINTERRUPTED OR ERROR FREE.                            **
  18. **                                                                              **
  19. \********************************************************************************/
  20.  
  21. import java.awt.Rectangle;
  22. import java.awt.Graphics;
  23. import java.awt.Event;
  24. import java.awt.Point;
  25.  
  26. /******************************************************************************\
  27. **                                                                            **
  28. **  Class: HwVisualUserPlugIn                                                 **
  29. **  Purpose:                                                                  **
  30. **  Base class for user added visual plugins.                                 **
  31. **                                                                            **
  32. \******************************************************************************/
  33.  
  34. public class HwVisualUserPlugIn extends HwVisualPlugIn
  35.     {
  36.     public boolean piIsVisual()
  37.         {
  38.         return true;
  39.         }
  40.  
  41.      /** piEventAboutToShow **
  42.     * Called by the system just before the plug-in is transitioned
  43.     * to the "visible" state.  This occurs when the entire containment chain
  44.     * from the module up to the applet becomes visible.  Note that the
  45.     * notion of "visible" here is purely logical -- the module
  46.     * may not actually be visible due to occlusion, clipping, etc.
  47.     * "why" is an enumerative which describes what is causing the
  48.     * state change.
  49.     *        why = BasicRunPlugIn.E_THIS
  50.     *            This plug-in is being turned on.
  51.     *        why = BasicRunPlugIn.E_ANCESTOR
  52.     *            This plug-in is becoming visible because one its ancestors
  53.     *            which was previously off is being turned on, completing the
  54.     *            visibility requirements for this plug-in.
  55.     *        why = BasicRunPlugIn.E_ROOT
  56.     *            Special case of BasicRunPlugIn.E_ANCESTOR for the root
  57.     *            (usually the applet or window)
  58.     */
  59.     public void piEventAboutToShow(int why)
  60.             throws HwException
  61.         {}
  62.  
  63.     /** piEventAboutToHide **
  64.     * Called by the system just before the plug-in is transitioned
  65.     * to the "not visible" state.  This can occur when the module
  66.     * itself is made not visible or when a visual parent container
  67.     * of the module is made not visible.  Note that the
  68.     * notion of "visible" here is purely logical -- the module
  69.     * may not actually be visible due to occlusion, clipping, etc.
  70.     * "why" is an enumerative which describes what is causing the
  71.     * state change.
  72.     *        why = BasicRunPlugIn.E_THIS
  73.     *            This plug-in is being turned off.
  74.     *        why = BasicRunPlugIn.E_ANCESTOR
  75.     *            This plug-in is becoming not visible because one its ancestors
  76.     *            which was previously on is being turned off, breaking the
  77.     *            visibility requirements for this plug-in.
  78.     *        why = BasicRunPlugIn.E_ROOT
  79.     *            Special case of BasicRunPlugIn.E_ANCESTOR for the root
  80.     *            (usually the applet or window)
  81.     */
  82.     public void piEventAboutToHide(int why) 
  83.             throws HwException
  84.         {}
  85.  
  86.     /** piEventDragTranslate **
  87.     * Called by the system when the user has moved the mouse with
  88.     * the mouse initially down with the intent of dragging the plug-in.
  89.     * This method is called before the bounding rectangle of the plug-in
  90.     * is translated by the system. The plug-in should update its internal 
  91.     * state accordingly, but not its appearance.
  92.     * The implementation should return a rectangle bounding the area
  93.     * whose appearance has changed (a rectangle with either a zero width
  94.     * or height is legal, but is interpreted as "no change in appearance").
  95.     * Wire messages (if any) initiated by the event will be sent automatically
  96.     * by the system.
  97.     */
  98.     public Rectangle piEventDragTranslate(int xOffset, int yOffset)
  99.         {
  100.         return null;
  101.         }
  102.  
  103.     /** piContainsPoint **
  104.     * Return true if aPoint is within the clickable region of 
  105.     * the plug-in. This should take into account things like
  106.     * image transparency and non-rectangular extents
  107.     */
  108.      public boolean piContainsPoint(Point aPoint)
  109.         {
  110.         return (piGetVisualRunService().siGetAbsRect().inside(aPoint.x, aPoint.y));
  111.         }
  112.  
  113.     /** piDraw **
  114.     * Called by the system to draw the plug-in in the graphics
  115.     * context aGraphic with clipping rectangle, aClipRect. The
  116.     * plug-in should use the VisualRunService to get the current
  117.     * absolute bounding rectangle for the plug-in
  118.     */
  119.     public void piDraw(Graphics aGraphic, Rectangle aClipRect)
  120.             throws HwException
  121.         {
  122.         Rectangle drawRect = piGetVisualRunService().siGetAbsRect();
  123.         }
  124.  
  125.     /** piGetAbsRectComplete **
  126.     * Returns the bounding rectangle for the plug-in relative
  127.     * only to the surrounding applet, not to any intermediary
  128.     * visual containers. The rectangle is adjusted as
  129.     * appropriate to accommodate selection highlights. The implementation
  130.     * should call siGetAbsRect() to obtain the unadorned bounding
  131.     * rectangle for the plug-in relative to the applet.
  132.     */
  133.     public Rectangle piGetAbsRectComplete()
  134.         {
  135.         // Return the absolute screen rect adjusted for any ornamentation
  136.         // such as selection highlights
  137.         return (piGetVisualRunService().siGetAbsRect());
  138.         }
  139.  
  140.     /** piGetVisualRunService **
  141.     * Called by the plug-in to access the visual system services.
  142.     * The plug-in should return (VisualRunService) piGetRunService()
  143.     * which casts the BasicRunService reference to a VisualRunService
  144.     */
  145.     public VisualRunService piGetVisualRunService()
  146.         {
  147.         return((VisualRunService) piGetRunService());
  148.         }
  149.  
  150.     /** piMouseEntered **
  151.     * Called by the system the first time the user has moved the mouse with
  152.     * the mouse up within the plug-in's bounding rectangle.
  153.     * The plug-in should update its appearance and internal state 
  154.     * accordingly. Wire messages initiated by the event will be sent 
  155.     * automatically by the system.
  156.     */
  157.     public void piMouseEntered(Event evt, int x, int y)
  158.             throws HwException
  159.         {}
  160.  
  161.     /** piMouseLeft **
  162.     * Called by the system when the user has moved the mouse with
  163.     * the mouse up from inside the plug-in's bounding rectangle
  164.     * to outside the rectangle.
  165.     * The plug-in should update its appearance and internal state 
  166.     * accordingly. Wire messages initiated by the event will be sent 
  167.     * automatically by the system.
  168.     */
  169.     public void piMouseLeft(Event evt, int x, int y)
  170.             throws HwException
  171.         {}
  172.  
  173.     /** piSetAbsRect **
  174.     * Called by the system to inform the plug-in that its bounding rectangle
  175.     * relative to the applet has changed. The bounding rectangle
  176.     * itself is maintained by the system. This method is primarily for
  177.     * plug-ins which do not rely on piDraw to display themselves
  178.     */
  179.     public void piSetAbsRect(Rectangle aRect)
  180.             throws HwException
  181.         {}
  182.  
  183.     /** piIsOccluding **
  184.     * Called by the system to determine whether the plug-in complete obscures
  185.     * the background within its bounding rectangle.  If the plug-in does not
  186.     * completely fill the rectangle or has transparent pixels it should return
  187.     * false.  A value of true enables the system to optimize drawing to save time.
  188.     */
  189.     public boolean piIsOccluding()
  190.     {
  191.         return false;
  192.     }
  193.  
  194.     }
  195.