home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Id: palette_button.java,v 1.10 1996/10/03 19:45:17 hudson Exp $
- * $Author: hudson $
- */
-
- package sub_arctic.lib;
-
- import sub_arctic.input.event;
- import sub_arctic.input.callback_object;
- import sub_arctic.input.inout_draggable;
- import sub_arctic.input.pressable;
-
- import sub_arctic.output.color_pair;
- import sub_arctic.output.loaded_image;
- import sub_arctic.output.drawable;
-
- import java.awt.Point;
- import java.awt.Dimension;
- import java.awt.Image;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Color;
-
- /**
- * A button which acts on the downward mouse button press. This is suitable
- * for a situation such as a palette where you need to create an object and
- * drag it away from the point of first interaction in one motion.
- *
- * @author Scott Hudson
- */
- public class palette_button extends multi_button
- implements inout_draggable, pressable {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Full constructor. The two image sets provided give normal appearance
- * for each state of the button, and a transition appearance out of each
- * state of the button. The transition set may be coded as null in which
- * case the next state image is used when a transition is needed. Otherwise
- * the two image sets must be the same size. For this subclass the transition
- * appearance will never show up since we just straight to the new state on
- * mouse down.
- *
- * @param int x x position of the interactor.
- * @param int y y position of the interactor.
- * @param loaded_image[] st_looks images for normal look of button in
- * various states.
- * @param loaded_image[] trans_looks images for looks during transitions
- * between states (typically null since
- * transition appearance does not show up
- * in this subclass).
- * @param callback_object call_obj the callback object that gets notified
- * when this button changes state.
- */
- public palette_button(
- int x,
- int y,
- loaded_image[] st_looks,
- loaded_image[] trans_looks,
- callback_object call_obj)
- {
- super(x,y,st_looks,trans_looks,call_obj);
- }
-
- //had:
- //* @exception bad_value if the image arrays are not the same
- //* size.
- //* @exception general
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Handle mouse presses in our bounds. For a palette button we act on the
- * press itself (so the button is still down and we can immediately take
- * up a drag action). To do that we fake the end of the inout_drag
- * that a multi_button normally does and let the superclass do the
- * normal end of input actions.
- *
- * @param event evt the mouse down event.
- * @param Object user_info information associated with this object at
- * pick time.
- */
- public boolean press(event evt, Object user_info)
- {
- /* fake end of inout_drag with cursor inside object */
- return inout_drag_end(evt, true, user_info);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-