com.threerings.opengl.gui
Class PopupMenu
java.lang.Object
com.threerings.opengl.gui.Component
com.threerings.opengl.gui.Container
com.threerings.opengl.gui.Window
com.threerings.opengl.gui.PopupWindow
com.threerings.opengl.gui.PopupMenu
- All Implemented Interfaces:
- ConfigUpdateListener<ManagedConfig>, Comparable<Window>
- Direct Known Subclasses:
- ComboBox.ComboPopupMenu
public class PopupMenu
- extends PopupWindow
Displays a popup menu of items, one of which can be selected.
| Fields inherited from class com.threerings.opengl.gui.Component |
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES |
|
Method Summary |
void |
addMenuItem(MenuItem item)
Adds the supplied item to this menu. |
boolean |
dispatchEvent(Event event)
Instructs this component to process the supplied event. |
protected String |
getDefaultStyleConfig()
Returns the name of the default config to be used for all instances of this component. |
protected Container |
getItemContainer()
Returns a reference to the container holding the menu items. |
protected void |
itemSelected(MenuItem item,
long when,
int modifiers)
Called by any child MenuItems when they are selected. |
protected void |
packAndFit(int x,
int y,
boolean above)
Called after we have been added to the display hierarchy to pack and
position this popup window. |
void |
setPreferredDimensions(int rows,
int columns)
Sets the preferred number of rows and columns. |
| Methods inherited from class com.threerings.opengl.gui.Window |
center, compareTo, dismiss, getLayer, getParentWindow, getRoot, gotFocus, invalidate, isAdded, isModal, isOverlay, pack, pack, requestFocus, setBounds, setLayer, setModal, setParent, setParentWindow, setRoot |
| Methods inherited from class com.threerings.opengl.gui.Container |
add, add, add, add, applyOperation, computePreferredSize, getComponent, getComponentCount, getComponentIndex, getFirstDescendantFocus, getHitComponent, getLastDescendantFocus, getLayoutManager, getNextFocus, getPreviousFocus, layout, remove, remove, removeAll, renderComponent, replace, setAlpha, setEnabled, setHoverable, setLayoutManager, validate, wasAdded, wasRemoved |
| Methods inherited from class com.threerings.opengl.gui.Component |
acceptsFocus, addListener, boundsToString, changeCursor, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, createTooltipComponent, emitEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getFallbackState, getFocusTarget, getHeight, getInsets, getNextFocus, getParent, getPreferredSize, getPreviousFocus, getProperty, getState, getStateCount, getStatePseudoClass, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getWindow, getX, getY, hasFocus, intersectScissor, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, renderBackground, renderBorder, requestFocus, scrollRectToVisible, scrollRectToVisible, setBackground, setCursor, setLocation, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible, stateDidChange, updateCursor, updateFromStyleConfig, updateFromStyleConfig |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_rows
protected int _rows
_columns
protected int _columns
PopupMenu
public PopupMenu(GlContext ctx,
Window parent)
PopupMenu
public PopupMenu(GlContext ctx,
Window parent,
boolean horizontal)
PopupMenu
public PopupMenu(GlContext ctx,
Window parent,
int rows,
int columns)
addMenuItem
public void addMenuItem(MenuItem item)
- Adds the supplied item to this menu.
setPreferredDimensions
public void setPreferredDimensions(int rows,
int columns)
- Sets the preferred number of rows and columns. Will relayout the existing menu items into
the preferred number of columns, but may add more columns if the menu will not fit in
the vertical space.
- Parameters:
rows - the number of rows to display at one time, or zero if unlimited.columns - the number of columns to display.
dispatchEvent
public boolean dispatchEvent(Event event)
- Description copied from class:
Component
- Instructs this component to process the supplied event. If the event is not processed, it
will be passed up to its parent component for processing. Derived classes should thus only
call
super.dispatchEvent for events that they did not "consume".
- Overrides:
dispatchEvent in class Component
- Returns:
- true if this event was consumed, false if not.
getDefaultStyleConfig
protected String getDefaultStyleConfig()
- Description copied from class:
Component
- Returns the name of the default config to be used for all instances of this component.
Derived classes will likely want to override this method and set up a default config for
their type of component.
- Overrides:
getDefaultStyleConfig in class PopupWindow
packAndFit
protected void packAndFit(int x,
int y,
boolean above)
- Description copied from class:
PopupWindow
- Called after we have been added to the display hierarchy to pack and
position this popup window.
- Overrides:
packAndFit in class PopupWindow
getItemContainer
protected Container getItemContainer()
- Returns a reference to the container holding the menu items.
itemSelected
protected void itemSelected(MenuItem item,
long when,
int modifiers)
- Called by any child
MenuItems when they are selected.