conga.gui
Class AbstractPopupMenu

java.lang.Object
  |
  +--marimba.gui.Widget
        |
        +--marimba.gui.ContainerWidget
              |
              +--marimba.gui.GroupWidget
                    |
                    +--conga.gui.AbstractPopupMenu
All Implemented Interfaces:
java.awt.image.ImageObserver, PropertyObject, TimerClient, WidgetConstants
Direct Known Subclasses:
WidgetMenu

public abstract class AbstractPopupMenu
extends GroupWidget

An abstract implementation of a popup menu. This class provides all necessary functionality to enable lightweight popup menus for widgets, except for the actual item manipulation.

Version:
2.00, 06/19/1998
Author:
Klaas Waslander

Fields inherited from class marimba.gui.GroupWidget
editing, fillMode, fillOptions, lineMode, lineOptions, patsrc, pattern, prevtx, prevty
 
Fields inherited from class marimba.gui.ContainerWidget
content
 
Fields inherited from class marimba.gui.Widget
adapter, background, clazz, defaultBackground, defaultFont, defaultForeground, defaultHilite, directGraphics, disabled, east, editor, focus, font, foreground, height, hilite, layoutMgr, name, north, nwidgets, parent, script, south, tip, transparent, tx, ty, valid, visible, wBackground, west, wFont, wForeground, wHilite, widgets, width, wScript, wTip, x, y
 
Fields inherited from interface marimba.gui.WidgetConstants
ALWAYS, ANYWHERE, APPLET, ASCENDING, BLINK, BLUE, BONGO_EVENT, BOTH, BOTTOM, BOXED, BUTTON, CENTER, CHAR, CHECK, COLLAPSE_EVENT, CONTENT, DESCENDING, DETACHED, DIAGONAL, DOWN, DRAG, EXCLUSIVE, EXPAND_EVENT, FILL, FILLED, GREEN, HORIZONTAL, INSIDE, INVISIBLE, JAVA_VERSION, JAVAOS, JDK10, JDK11, LAYERS, LEFT, LOWERED, MAC, MULTIPLE, NETCASTER, NETSCAPE, NEVER, NONE, NT, OPTIONAL, OS_ARCH, OS_NAME, OS_VERSION, OUTLINE, PAGE_DOWN, PAGE_EVENT, PAGE_UP, PATTERN, PC, PICTURE, PLAIN, PROPORTIONAL, RADIO, RAISED, RED, REST_EVENT, RIGHT, ROUNDED, SCALE, SCROLLBAR, SCROLLING, SOLID, SQUARE, TEXT_CHANGED_EVENT, TOP, TOPLEFT, TRUNCATE, UNDERLINE, UNIX, UP, VERTICAL, WAKE_EVENT, WIN95, WINDOWS, WORD
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AbstractPopupMenu()
          Create a new popup menu.
 
Method Summary
 boolean focusInterest()
          A widget popup menu is interested in the focus, if it is not disabled.
 int getInitialPopupHeight()
          The initial height of the popup menu, influenced by the maximum number of visible items.
 int getMaxVisible()
          Get the maximum number of visible items.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of this abstract popup menu, based on the preferred size of the items inside the menu.
 boolean handleEvent(java.awt.Event evt)
          Handles the necessary key and mouse events, that manipulates menu item in a generic way.
 boolean hasInheritedFont()
          Check whether the font of this menu has been explicitly set, or whether it is inherited.
 boolean isPoppedUp()
          Check whether this menu is currently popped up.
 void layout()
          Layout the contents of the popup menu.
 void paint(java.awt.Graphics g, int cx, int cy, int cw, int ch)
          Paint the background of the popupmenu.
 void popdown()
          Hides this widget popupmenu; it will make sure that the widget that had the focus (before this menu was popped up) re-gains the focus.
 void popup(Widget parent, int x, int y)
          Shows the popup menu at the x, y position relative to the given parent widget, the menu will have the preferred width after popping up.
 void popup(Widget parent, int x, int y, int width)
          Shows the popup menu at the x, y position relative to the given parent widget, with the given fixed width.
 void popupDirected(Widget parent, int direction, int alignment)
          Popup this popup menu in the given direction, with the given alignment.
 void setMaxVisible(int maxVisible)
          Set the maximum number of visible items.
 
Methods inherited from class marimba.gui.GroupWidget
getEditing, getEditor, getFillMode, getFillOptions, getLineMode, getLineOptions, getPattern, getPatternSource, getProperties, init, paramString, setEditing, setFillMode, setLineMode, setPattern, setProperties, update, updateArea, waitForPattern
 
Methods inherited from class marimba.gui.ContainerWidget
findInFocus, findWidget, firstInFocus, getChildProperties, getContent, newContent, nextInFocus, previousInFocus
 
Methods inherited from class marimba.gui.Widget
action, action, add, add, adjustFont, adjustFont, applyProperties, audioLoop, audioLoop, audioPlay, audioPlay, audioStop, audioStop, bounds, clearFocus, clearPopups, clone, contains, contains, createImage, createImage, currentFocus, destroy, disable, disable, enable, firstFocus, getAudioClip, getAudioClipAt, getBackground, getBounds, getCancelButton, getCursor, getDefaultButton, getDescription, getEncoding, getFocusColor, getFont, getFontMetrics, getForeground, getHilite, getImage, getKey, getKey, getKey, getLayoutMgr, getLocale, getLocation, getName, getParent, getPlayerFrame, getPlayerPanel, getPresentation, getSelBackground, getSelFocusColor, getSelForeground, getSize, getText, getText, getTip, getTip, getTipFont, getValue, getValue, getWidget, getWidgetAt, getWidgetAt, getWidgetClass, getWidgetsAt, getWidgetsAt, getWidgetsAt, gotFocus, gotoPage, gotoPage, hasFocus, hide, imageUpdate, inheritFont, inside, inside, invalidate, isDisabled, isShowing, isTransparent, isVisible, keyDown, keyUp, list, list, locateWidget, locateWidgets, locateWidgets, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, overlap, paint, paintAll, postEvent, previousFocus, remove, remove, remove, removeAll, repaint, repaint, repaint, repaint, repaintParent, replace, replace, replace, requestFocus, resetCursor, reshape, reshape, resize, resize, rmove, rscroll, scroll, setAttach, setBackground, setBounds, setBounds, setCursor, setDisabled, setEditor, setEncoding, setFont, setForeground, setHilite, setLayoutMgr, setLocale, setLocation, setName, setSize, setSize, setText, setText, setTip, setTipFont, setTransparent, setValue, setValue, setVisible, show, show, size, start, stop, sync, tick, toBack, toBack, toFront, toFront, toString, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPopupMenu

public AbstractPopupMenu()
Create a new popup menu.
Method Detail

getMaxVisible

public int getMaxVisible()
Get the maximum number of visible items. If there are more items in the menu than this number, a scrollbar is used. If this number is zero or smaller the max number of visible items is determined by the size of the menu.
See Also:
setMaxVisible(int)

setMaxVisible

public void setMaxVisible(int maxVisible)
Set the maximum number of visible items.
See Also:
getMaxVisible()

getInitialPopupHeight

public int getInitialPopupHeight()
The initial height of the popup menu, influenced by the maximum number of visible items.
See Also:
getMaxVisible(), popup(marimba.gui.Widget, int, int)

popup

public void popup(Widget parent,
                  int x,
                  int y)
Shows the popup menu at the x, y position relative to the given parent widget, the menu will have the preferred width after popping up.
Parameters:
parent - the widget which defines the coordinate space
x - the x coordinate position to popup the menu
y - the y coordinate position to popup the menu
See Also:
popupDirected(marimba.gui.Widget, int, int)

popup

public void popup(Widget parent,
                  int x,
                  int y,
                  int width)
Shows the popup menu at the x, y position relative to the given parent widget, with the given fixed width.
Parameters:
parent - the widget which defines the coordinate space
x - the x coordinate position to popup the menu
y - the y coordinate position to popup the menu
width - the fixed width that the popup menu will have after popping up
See Also:
popupDirected(marimba.gui.Widget, int, int)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size of this abstract popup menu, based on the preferred size of the items inside the menu.
Overrides:
getPreferredSize in class ContainerWidget

popdown

public void popdown()
Hides this widget popupmenu; it will make sure that the widget that had the focus (before this menu was popped up) re-gains the focus.
See Also:
popup(marimba.gui.Widget, int, int)

isPoppedUp

public boolean isPoppedUp()
Check whether this menu is currently popped up.

hasInheritedFont

public boolean hasInheritedFont()
Check whether the font of this menu has been explicitly set, or whether it is inherited.

popupDirected

public void popupDirected(Widget parent,
                          int direction,
                          int alignment)
Popup this popup menu in the given direction, with the given alignment. Both direction and alignment apply relative to the parent of this popup menu.
Parameters:
direction - UP, DOWN, LEFT or RIGHT
alignment - LEFT, CENTER or RIGHT
See Also:
popup(marimba.gui.Widget, int, int)

layout

public void layout()
Layout the contents of the popup menu.
Overrides:
layout in class ContainerWidget

paint

public void paint(java.awt.Graphics g,
                  int cx,
                  int cy,
                  int cw,
                  int ch)
Paint the background of the popupmenu.
Overrides:
paint in class GroupWidget

handleEvent

public boolean handleEvent(java.awt.Event evt)
Handles the necessary key and mouse events, that manipulates menu item in a generic way. Subclasses might want to add more keyboard interaction here.
Overrides:
handleEvent in class Widget
Following copied from class: marimba.gui.Widget
Parameters:
evt - the event that needs to be handled by the widget
See Also:
Widget.postEvent(java.awt.Event)

focusInterest

public boolean focusInterest()
A widget popup menu is interested in the focus, if it is not disabled.
Overrides:
focusInterest in class Widget
Following copied from class: marimba.gui.Widget
See Also:
Widget.focus, Widget.requestFocus()