Note: This is an HTML facsimile of the actual Java code. To see the code itself in its most current version, you can look at HwVisualUserPlugIn.java in the directory \Hyperwire\Classes\kinetix\hyperc1\runtime\.

package kinetix.hyperc1.runtime;

/********************************************************************************\
**                                                                              **
**  (C) Copyright 1997 by Autodesk, Inc.                                        **
**                                                                              **
**  This program is copyrighted by Autodesk, Inc. and is licensed to you under  **
**  the following conditions.  You may not distribute or publish the source     **
**  code of this program in any form.  You may incorporate this code in object  **
**  form in derivative works provided such derivative works are (i.) are de-    **
**  signed and intended to work solely with Autodesk, Inc. products, and (ii.)  **
**  contain Autodesk's copyright notice "(C) Copyright 1997 by Autodesk, Inc."  **
**                                                                              **
**  AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  AUTODESK SPE-  **
**  CIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR  **
**  A PARTICULAR USE.  AUTODESK, INC.  DOES NOT WARRANT THAT THE OPERATION OF   **
**  THE PROGRAM WILL BE UNINTERRUPTED OR ERROR FREE.                            **
**                                                                              **
\********************************************************************************/

import java.awt.Rectangle;
import java.awt.Graphics;
import java.awt.Event;
import java.awt.Point;

/******************************************************************************\
**                                                                            **
**  Class: HwVisualUserPlugIn                                                 **
**  Purpose:                                                                  **
**  Base class for user added visual plugins.                                 **
**                                                                            **
\******************************************************************************/

public class HwVisualUserPlugIn extends HwVisualPlugIn
	{
	public boolean piIsVisual()
		{
		return true;
		}

 	/** piEventAboutToShow **
	* Called by the system just before the plug-in is transitioned
	* to the "visible" state.  This occurs when the entire containment chain
	* from the module up to the applet becomes visible.  Note that the
	* notion of "visible" here is purely logical -- the module
	* may not actually be visible due to occlusion, clipping, etc.
	* "why" is an enumerative which describes what is causing the
	* state change.
	*		why = BasicRunPlugIn.E_THIS
	*			This plug-in is being turned on.
	*		why = BasicRunPlugIn.E_ANCESTOR
	*			This plug-in is becoming visible because one its ancestors
	*			which was previously off is being turned on, completing the
	*			visibility requirements for this plug-in.
	*		why = BasicRunPlugIn.E_ROOT
	*			Special case of BasicRunPlugIn.E_ANCESTOR for the root
	*			(usually the applet or window)
	*/
	public void piEventAboutToShow(int why)
			throws HwException
		{}

	/** piEventAboutToHide **
	* Called by the system just before the plug-in is transitioned
	* to the "not visible" state.  This can occur when the module
	* itself is made not visible or when a visual parent container
	* of the module is made not visible.  Note that the
	* notion of "visible" here is purely logical -- the module
	* may not actually be visible due to occlusion, clipping, etc.
	* "why" is an enumerative which describes what is causing the
	* state change.
	*		why = BasicRunPlugIn.E_THIS
	*			This plug-in is being turned off.
	*		why = BasicRunPlugIn.E_ANCESTOR
	*			This plug-in is becoming not visible because one its ancestors
	*			which was previously on is being turned off, breaking the
	*			visibility requirements for this plug-in.
	*		why = BasicRunPlugIn.E_ROOT
	*			Special case of BasicRunPlugIn.E_ANCESTOR for the root
	*			(usually the applet or window)
	*/
	public void piEventAboutToHide(int why) 
			throws HwException
		{}

	/** piEventDragTranslate **
	* Called by the system when the user has moved the mouse with
	* the mouse initially down with the intent of dragging the plug-in.
	* This method is called before the bounding rectangle of the plug-in
	* is translated by the system. The plug-in should update its internal 
	* state accordingly, but not its appearance.
	* The implementation should return a rectangle bounding the area
	* whose appearance has changed (a rectangle with either a zero width
	* or height is legal, but is interpreted as "no change in appearance").
	* Wire messages (if any) initiated by the event will be sent automatically
	* by the system.
	*/
	public Rectangle piEventDragTranslate(int xOffset, int yOffset)
		{
		return null;
		}

	/** piContainsPoint **
	* Return true if aPoint is within the clickable region of 
	* the plug-in. This should take into account things like
	* image transparency and non-rectangular extents
	*/
 	public boolean piContainsPoint(Point aPoint)
		{
		return (piGetVisualRunService().siGetAbsRect().inside(aPoint.x, aPoint.y));
		}

	/** piDraw **
	* Called by the system to draw the plug-in in the graphics
	* context aGraphic with clipping rectangle, aClipRect. The
	* plug-in should use the VisualRunService to get the current
	* absolute bounding rectangle for the plug-in
	*/
	public void piDraw(Graphics aGraphic, Rectangle aClipRect)
			throws HwException
		{
		Rectangle drawRect = piGetVisualRunService().siGetAbsRect();
		}

	/** piGetAbsRectComplete **
	* Returns the bounding rectangle for the plug-in relative
	* only to the surrounding applet, not to any intermediary
	* visual containers. The rectangle is adjusted as
	* appropriate to accommodate selection highlights. The implementation
	* should call siGetAbsRect() to obtain the unadorned bounding
	* rectangle for the plug-in relative to the applet.
	*/
	public Rectangle piGetAbsRectComplete()
		{
		// Return the absolute screen rect adjusted for any ornamentation
		// such as selection highlights
		return (piGetVisualRunService().siGetAbsRect());
		}

	/** piGetVisualRunService **
	* Called by the plug-in to access the visual system services.
	* The plug-in should return (VisualRunService) piGetRunService()
	* which casts the BasicRunService reference to a VisualRunService
	*/
	public VisualRunService piGetVisualRunService()
		{
		return((VisualRunService) piGetRunService());
		}

	/** piMouseEntered **
	* Called by the system the first time the user has moved the mouse with
	* the mouse up within the plug-in's bounding rectangle.
	* The plug-in should update its appearance and internal state 
	* accordingly. Wire messages initiated by the event will be sent 
	* automatically by the system.
	*/
	public void piMouseEntered(Event evt, int x, int y)
			throws HwException
		{}

	/** piMouseLeft **
	* Called by the system when the user has moved the mouse with
	* the mouse up from inside the plug-in's bounding rectangle
	* to outside the rectangle.
	* The plug-in should update its appearance and internal state 
	* accordingly. Wire messages initiated by the event will be sent 
	* automatically by the system.
	*/
	public void piMouseLeft(Event evt, int x, int y)
			throws HwException
		{}

	/** piSetAbsRect **
	* Called by the system to inform the plug-in that its bounding rectangle
	* relative to the applet has changed. The bounding rectangle
	* itself is maintained by the system. This method is primarily for
	* plug-ins which do not rely on piDraw to display themselves
	*/
	public void piSetAbsRect(Rectangle aRect)
			throws HwException
		{}

	/** piIsOccluding **
	* Called by the system to determine whether the plug-in complete obscures
	* the background within its bounding rectangle.  If the plug-in does not
    * completely fill the rectangle or has transparent pixels it should return
    * false.  A value of true enables the system to optimize drawing to save time.
	*/
	public boolean piIsOccluding()
	{
		return false;
	}

	}