public class Menu extends ChoiceControl implements ScrollClient
| Modifier and Type | Field and Description |
|---|---|
boolean |
autoSelectFirst
If this is true then when the menu is first displayed, the first item will be selected.
|
static int |
border3D |
static Color |
defaultBackground |
static int |
defaultUseScrollBarSize |
boolean |
dontInheritFont
If this is true then the menu will not inherit the font from
the parent menu.
|
boolean |
dontSearchForKeys
If this is true then when you press a key, each item will not be searched to see if the key
relates to that item.
|
boolean |
exitOnLeft
If this is set true then the left cursor key on the top-level menu will cause the
menu to abort.
|
MenuFilterInput |
filter |
boolean |
followPen |
boolean |
keepFrame
If this is true then the same Frame will be used for the Menu everytime it is shown.
|
protected CarrierFrame |
myFrame |
protected MenuBar |
parentBar |
protected Menu |
parentMenu |
PopupController |
popupController |
protected int |
pressedItem |
static boolean |
use3DPopup |
int |
useScrollBarSize
If this value is -1, then the defaultUseScrollBarSize will be used, if it is zero then scroll bars will
never be used and if it is greater than zero it specifies how many items required to switch from up/down
button scrolling to using a full scroll bar.
|
protected boolean |
wasSelected |
blockColor, blockSelected, calculateWidth, clipBuffer, container, dimRect, displayRows, dontAutoScroll, dropButtonWidth, dropDownButton, dummyItem, firstItem, indentDropItems, innerRect, isAList, isSingleLine, itemHeight, items, mouseOverItem, mouseOverItemColor, newClip, noItems, notifyDataChangeOnSelect, notPopupBlockColor, noWrapAround, selectedIndex, shortenItems, spacing, unselectedItem, useMenuItems, xOffset, xShiftbackGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, curFont, debugModify, debugRepaintNow, disabledBackground, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, fontChange, fontFrom, foreGround, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, lockPaint, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, name, next, parent, penStatus, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, startDragResolution, tags, tail, text, toolTip, width, x, yclipItems, clipObject, clipOwner, debugControl, debugFlag, doubleBuffer, doubleClickTime, doubleSizedFontHeight, firstPress, globalEditable, globalEnabled, PEN_STATUS_DID_HOLD_DOWN, PEN_STATUS_GOT_PEN_DOWN, PEN_STATUS_PEN_IS_ON, pressPoint, TAG_BOOLEAN_KEEP_BELOW_SIP, TAG_HOVER_TIME_INT, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamedGoHigher, GoLower, Horizontal, OPTION_INDICATOR_ONLY, PageHigher, PageLower, ScrollHigher, ScrollLower, TrackTo, VerticalBDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_ABUT_ANY, BF_ABUT_BOTTOM, BF_ABUT_LEFT, BF_ABUT_RIGHT, BF_ABUT_TOP, BF_BOTTOM, BF_BOTTOMLEFT, BF_BOTTOMRIGHT, BF_BUTTON, BF_DIAGONAL, BF_DIAGONAL_ENDBOTTOMLEFT, BF_DIAGONAL_ENDBOTTOMRIGHT, BF_DIAGONAL_ENDTOPLEFT, BF_DIAGONAL_ENDTOPRIGHT, BF_EXACT, BF_FLAT, BF_LEFT, BF_MIDDLE, BF_MONO, BF_PALM, BF_RECT, BF_RIGHT, BF_SOFT, BF_SQUARE, BF_TOP, BF_TOPLEFT, BF_TOPRIGHT, EDGE_BUMP, EDGE_ETCHED, EDGE_RAISED, EDGE_SUNKENALWAYS_STRETCHABLE, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_HIDDEN, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TAG_BACKGROUND_IMAGE, TAG_BUSY_DISPLAY, TAG_COLORS, TAG_CONTROL_PAINTER, TAG_EXPOSE_GROUP, TAG_FIXEDSIZE, TAG_GRAY_BACKGROUND, TAG_HIDE_CONTROL_OBJECT, TAG_HIDE_PARENT, TAG_INNER_TEXT_INSETS, TAG_INPUT_STACK_PARENT, TAG_INSETS, TAG_MAKE_VISIBLE, TAG_MAXIMUMSIZE, TAG_MINIMUMSIZE, TAG_PAINT_CONTROL_LIST, TAG_PREFERRED_TEXT_SIZE, TAG_PREFERRED_TEXT_SIZE_HEIGHT, TAG_PREFERRED_TEXT_SIZE_WIDTH, TAG_PREFERREDSIZE, TAG_RECT, TAG_SHADOW_INSETS, TAG_SPAN, TAG_SWIPER, TAG_TEMPORARY_ERROR, TAG_TEXT_INSETS, TAG_TEXTSIZE, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WESTAll, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, ContainerDontPaintChildren, Disabled, DisablePopupMenu, DisplayOnly, DontBuffer, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, ModifiersInheritedFromWindow, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpUIEvents, ShowSIP, ShrinkToNothing, SmallControl, TakeChildUIEvents, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDownKEEP_VISIBLE| Constructor and Description |
|---|
Menu() |
Menu(Menu other)
Create a Menu that is a copy of the other menu.
|
Menu(MenuItem[] items,
String title) |
Menu(String[] items,
String title) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
allowNotOnMeSelection() |
boolean |
canGo(int orientation,
int direction,
int position)
This method should return whether the ScrollClient can actually scroll in a particular
direction, given a starting position in units.
|
protected boolean |
canScreenScroll() |
void |
close() |
void |
doActionKey(int key)
This will call doAction(ByKeyboard) and then call notifyAction()
|
protected boolean |
doDropMenu(Menu who) |
protected boolean |
doDropMenu(Menu who,
Point penPoint) |
boolean |
doMenu(Point p)
This is a request to display a menu based on the pen being held or the mouse being right clicked on
the Control.
|
void |
doScroll(int which,
int action,
int value)
This is called by the ScrolledServer to indicate that the user has requested
a scroll.
|
void |
exec(Control owner,
Point where,
EventListener listener) |
int |
getActual(int which)
Get the full number of units either vertically or horizontally that the ScrollClient
contains.
|
CarrierFrame |
getCarrierFrame(Control owner,
int maxWidth,
int maxHeight,
boolean shrinkWidth,
boolean shrinkHeight,
Frame parent) |
CarrierFrame |
getCarrierFrame(Control owner,
int maxWidth,
int maxHeight,
boolean shrinkWidth,
boolean shrinkHeight,
Frame parent,
String title) |
CarrierFrame |
getCarrierFrame(Control owner,
Object titleOrTopControl,
int maxWidth,
int maxHeight,
boolean shrinkWidth,
boolean shrinkHeight,
Frame parent) |
int |
getCurrent(int which)
This should return which unit is currently being displayed.
|
Rect |
getItemRect(int idx,
Rect dest) |
protected int |
getMenuWidth() |
Rect |
getTextRect(int idx,
Rect dest) |
int |
getVisible(int which,
int forSize)
Given a display size, this method should return the number of units that can be fully
displayed within the display size for the specified dimension.
|
void |
modifyActionItems(String[] itemActionNames,
boolean condition,
int flagsToSet,
int flagsToClear) |
void |
modifyActionItems(String itemActionNames,
boolean condition,
int flagsToSet,
int flagsToClear) |
protected void |
mouseNowOverItem(int newItem) |
boolean |
needScrollBar(int which,
int forSize)
This method should return whether a ScrollBar (or some other form of scrolling
user control) is necessary for the specified dimension.
|
protected void |
noMenu() |
void |
onEvent(Event ev) |
void |
onKeyEvent(KeyEvent ev) |
void |
onPenEvent(PenEvent ev) |
void |
penPressed(Point p)
Called when the Pen or Mouse button is pressed on the control.
|
void |
penReleased(Point p)
Called when the Pen or Mouse button is released on the control.
|
void |
postEvent(Event ev)
Send a newly generated Event up the chain of Controls, starting from this one.
|
void |
postEventNormally(Event ev) |
protected boolean |
prepareForDisplay()
This is called just before the Menu is displayed.
|
protected void |
pressedNewSelected(int oldSel) |
protected void |
pressedNewSelected(int oldSel,
Point where) |
void |
resetCachedProperties() |
protected void |
selectNewItem(Point p) |
void |
setMouseOverColor(Color c) |
String |
toString()
Return a String representation of this object.
|
boolean |
trySubMenu() |
void |
updateItems()
This updates the control to new choices added and then refreshes it on screen.
|
protected int |
whichItem(int x,
int y) |
addItem, addItems, addItems, addSection, blocked, calculateSizes, centerItem, centerSelected, changeItem, changeModifiers, checkOnlyOne, deleteItem, doBorder, doPaint, doPaintData, findItem, findKeyed, getBlockColor, getDataRect, getDisplayRows, getDisplayString, getDropButtonWidth, getInt, getItemAt, getItemHeight, getItemsHaveIcons, getItemToAdd, getMenuHeight, getMenuItemAt, getMenuWidth, getScreenRows, getSelectedItem, getText, indexOf, insertItemAt, isSelected, itemIsVisible, itemsSize, make, makeItemVisible, makeVisible, modifyItems, notifySelection, paintBox, paintItem, paintItem, refresh, removeAll, repaintItem, select, select, selectItem, selectItem, selectItems, selectNext, selectOrUnselect, selectPrev, setData, setInt, setText, trySelectItemacceptsData, activate, addListener, amOnTopFrame, applyFontChange, baseOnPenEvent, bufferGraphics, bufferGraphics, bufferGraphics, bufferGraphics, bufferGraphics, cache, calculatedSizes, calculateTextSize, calculateTextSize, calculateTextSize, cancelHoldDown, cancelPenPress, canEdit, change, changeDimension, changeTag, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkParentInterceptsUIEvent, checkPenTransparent, childrenPainted, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createNewMenu, dataAccepted, dataBeingRemoved, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, dataTransferCancelled, deactivate, defaultTo, deferInWindowThread, doAction, doBackground, doHotKey, dontAcceptDrop, doPaintChildren, doPaintData, doShowMenu, dragged, draw, draw, draw, exitEntry, fillBackground, fillBackgroundNotInFrame, findTagInParents, fontChanged, formClosing, free, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getAncestor, getAncestor, getAncestorProperty, getBackground, getCached, getCachedChildren, getCachedDim, getCachedDim, getCachedRect, getCachedRect, getCachedSubControls, getChildAnchor, getChildren, getChildren, getChildrenBackwards, getClipboardMenu, getClipObject, getContentsInsets, getContentsInsets, getContentsRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFieldTransfer, getFont, getFontMetrics, getFontMetrics, getFontMetricsForSizeCalculations, getForeground, getFrame, getFrameOrContainer, getGraphics, getGraphics, getHeight, getHideParent, getImage, getLastSelected, getLocation, getLock, getMaximumSize, getMenu, getMinimumSize, getModifiedBorderFlags, getModifiers, getNext, getNextKeyFocus, getPaintParameters, getParent, getParent, getParent, getParentOrListener, getPasswordCharacter, getPosInFrame, getPosInFrame, getPosInParent, getPosInParent, getPreferredSize, getPreferredSizeByParent, getPreferredTextSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getSubControls, getSubControls, getTag, getToolTip, getWidth, getWindow, getWindowGraphics, gotFocus, hasModifier, hasPopupFormAttached, hasTag, hide, inheritModifiers, insetToContents, interceptChildUIEvent, isChildOf, isDirectChildOfWindow, isHidden, isModal, isOnMe, isOnMe, isOnMe, isSomeonesHotKey, lostFocus, makeFrameTopMost, makeHot, makeHot, makeInvisible, makeVisible, markAsTemporaryError, menuIsActive, menuStateChanged, modify, modifyAll, modifyAll, modifyFlags, mouseHover, newEventThread, notifyAction, notifyDataChange, notifyDataChange, notifyMenuItemSelected, notifyStructureChanged, onControlEvent, onLabelPenEvent, paintBackground, paintWithControlPainter, pauseEventThread, penClicked, penDoubleClicked, penHeld, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, postInWindowThread, postUIEvent, putInside, queueKeyEvent, queuePenEvent, readLock, recalculatePreferredSize, redisplay, releaseBufferedGraphics, removed, removeListener, repaint, repaint, repaintDataNow, repaintInWindowThread, repaintInWindowThread, repaintNow, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetAllCachedProperties, resetRect, resizeTo, restore, restoreBorderModifiers, restoreFlags, resumeEventThread, scrollAndRepaint, sendToListeners, set, setAllFonts, setBackgroundImage, setBorder, setBorderModifiers, setCell, setChildAnchor, setClipObject, setControl, setCursor, setFieldTransfer, setFixedSize, setFont, setFontChange, setFreeDragging, setHidden, setHiddenParent, setHotKey, setHotKey, setLocation, setMaximumSize, setMenu, setMinimumSize, setPreferredSize, setPreferredTextSize, setPreferredTextSize, setPromptControl, setRect, setRect, setScaledBackgroundImage, setServer, setShadow, setSwiping, setTag, setTags, setTextSize, setTiledBackgroundImage, setToolTip, showHoldDownIndicator, shown, simulateClickOn, simulateKeyPresses, simulateKeyType, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, startDragging, stopDragging, takeData, takeFocus, takeFromClipboard, takePromptControl, testInWindowThread, ticked, tipIsDisplayed, toClipboard, toField, toField, toIDString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryGetGraphics, tryNext, tryStartMenu, unhide, unlock, updateData, updateDCDuringDD, updateFrom, updateTo, verifyWantDrag, verifyWantHoldDown, waitEventThread, willAcceptDrop, willShowFrame, windowHasFloatingControls, writeLockdoubleSizeIt, getGuiTextHeight, isDoubleSized, isDoubleSizedFont, loadImage, tryLoadImageclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetServer, setServerpublic static boolean use3DPopup
public static int border3D
protected Menu parentMenu
protected MenuBar parentBar
public boolean followPen
public PopupController popupController
public static int defaultUseScrollBarSize
public static Color defaultBackground
public MenuFilterInput filter
public boolean autoSelectFirst
public boolean dontSearchForKeys
public int useScrollBarSize
public boolean exitOnLeft
public boolean dontInheritFont
protected int pressedItem
protected boolean wasSelected
public boolean keepFrame
protected CarrierFrame myFrame
public Menu()
public Menu(Menu other)
other - The other menuprotected int getMenuWidth()
getMenuWidth in class ChoiceControlpublic void setMouseOverColor(Color c)
protected int whichItem(int x,
int y)
protected boolean allowNotOnMeSelection()
protected void selectNewItem(Point p)
protected final void pressedNewSelected(int oldSel)
protected void pressedNewSelected(int oldSel,
Point where)
public void penPressed(Point p)
ControlWithin this method you can use the Control.Gui.currentPenPress() value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.
penPressed in class Controlp - The point on the Control where the pen was pressed.protected void mouseNowOverItem(int newItem)
public void onPenEvent(PenEvent ev)
onPenEvent in class Controlpublic void penReleased(Point p)
ControlWithin this method you can use the Control.Gui.currentPenPress() value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.
penReleased in class Controlp - The point on the Control where the pen was released.public void onKeyEvent(KeyEvent ev)
onKeyEvent in class Controlpublic boolean trySubMenu()
public void doActionKey(int key)
ControldoActionKey in class ChoiceControlpublic CarrierFrame getCarrierFrame(Control owner, int maxWidth, int maxHeight, boolean shrinkWidth, boolean shrinkHeight, Frame parent)
protected boolean prepareForDisplay()
public CarrierFrame getCarrierFrame(Control owner, int maxWidth, int maxHeight, boolean shrinkWidth, boolean shrinkHeight, Frame parent, String title)
public CarrierFrame getCarrierFrame(Control owner, Object titleOrTopControl, int maxWidth, int maxHeight, boolean shrinkWidth, boolean shrinkHeight, Frame parent)
protected final boolean doDropMenu(Menu who)
public void postEvent(Event ev)
Controlpublic void postEventNormally(Event ev)
public void resetCachedProperties()
resetCachedProperties in class ChoiceControlprotected void noMenu()
public String toString()
Objectprotected boolean canScreenScroll()
public void doScroll(int which,
int action,
int value)
ScrollClientdoScroll in interface ScrollClientwhich - either Horizontal or Verticalaction - one of PageHigher, PageLower, ScrollHigher, ScrollLower, TrackTovalue - this is used for the TrackTo action and indicates the position to
track to.public int getActual(int which)
ScrollClientgetActual in interface ScrollClientwhich - either Horizontal or Vertical.public int getVisible(int which,
int forSize)
ScrollClientgetVisible in interface ScrollClientwhich - either Horizontal or Vertical.forSize - the size (usually in pixels) allowed to be displayed on screen.public int getCurrent(int which)
ScrollClientgetCurrent in interface ScrollClientwhich - either Horizontal or Vertical.public boolean needScrollBar(int which,
int forSize)
ScrollClientHowever a ScrollClient can return true always if it always wishes a ScrollBar to be present, or false always if it never wishes a ScrollBar to be present.
needScrollBar in interface ScrollClientwhich - either Horizontal or Vertical.forSize - the size (usually in pixels) allowed to be displayed on screen.public boolean canGo(int orientation,
int direction,
int position)
ScrollClientcanGo in interface ScrollClientorientation - either Horizontal or Vertical.direction - either GoHigher or GoLower.position - a starting position in units.public void updateItems()
ChoiceControlupdateItems in class ChoiceControlpublic boolean doMenu(Point p)
Controlpublic void exec(Control owner, Point where, EventListener listener)
public void close()
public void modifyActionItems(String itemActionNames, boolean condition, int flagsToSet, int flagsToClear)
public void modifyActionItems(String[] itemActionNames, boolean condition, int flagsToSet, int flagsToClear)