Package totalcross.ui
Class ComboBoxDropDown
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Container
-
- totalcross.ui.Window
-
- totalcross.ui.ComboBoxDropDown
-
public class ComboBoxDropDown extends Window
ComboBoxDropDown is a simple implementation of a PopUp Listbox. Used by the ComboBox class.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description booleandontHideParentSet to true if want to make the control popup below or above always, and not only if WinCEbooleanfullHeightSet to true to make this pop have the screen heightbooleanfullWidthSet to true to make this popup have the screen widthListBoxlbThe assigned ListBox.-
Fields inherited from class totalcross.ui.Window
_controlEvent, _dragEvent, _focus, _keyEvent, _mouseEvent, _multiEvent, _penEvent, androidBorderThickness, beepIfOut, blocking, borderStyle, cancelPenUp, canDrag, dragThreshold, fadeOtherWindows, fadeValue, firstFocus, flickEnabled, focusOnPenUp, footerColor, footerH, gradientTitleEndColor, gradientTitleStartColor, headerColor, highlighted, highResPrepared, HORIZONTAL_GRADIENT, ignoreEventOfType, keyHook, lastShiftY, lastSwappedContainer, mainSwapContainer, menubar, multiTouching, needsPaint, NO_BORDER, ORIENTATION_INVERTED, ORIENTATION_LANDSCAPE, ORIENTATION_PORTRAIT, popped, RECT_BORDER, repaintOnSwap, robot, ROUND_BORDER, rTitle, sameBackgroundColor, shiftH, shiftY, SIP_BOTTOM, SIP_HIDE, SIP_SHOW, SIP_TOP, TAB_BORDER, TAB_ONLY_BORDER, tempTitle, title, titleAlign, titleColor, titleFont, titleGap, topMost, VERTICAL_GRADIENT, zStack
-
Fields inherited from class totalcross.ui.Container
alwaysEraseBackground, BACKGROUND_CYLINDRIC_SHADED, BACKGROUND_SHADED, BACKGROUND_SHADED_INV, BACKGROUND_SOLID, backgroundStyle, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_ROUNDED, BORDER_SIMPLE, BORDER_TOP, borderColor, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, started, tabOrder, tail, TRANSITION_CLOSE, TRANSITION_FADE, TRANSITION_NONE, TRANSITION_OPEN, TRANSITION_TIME, transitionEffect
-
Fields inherited from class totalcross.ui.Control
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, nextTabControl, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
-
-
Constructor Summary
Constructors Constructor Description ComboBoxDropDown()Creates a ComboBoxDropDown with coordinates that will be set later via the setRect method.ComboBoxDropDown(ListBox lb)Creates a ComboBoxDropDown with the given ListBox.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetPreferredHeight()Returns the size of the title if any plus the size of the border.intgetPreferredWidth()Returns the size of the title if any plus the size of the border.protected booleanonClickedOutside(PenEvent event)Close the popup list with a click outside its boundsvoidonEvent(Event event)Called to process key, pen, control and other posted events.protected voidonFontChanged()Sets the font of the controls inside this windowprotected voidonPopup()Placeholder called imediatly before the popup began.protected voidpostUnpop()Placeholder called after the unpop is done and after the repaint of the other window.voidsetRect(int x, int y, int width, int height, Control relative, boolean screenChanged)Sets the absolute rect of the parent's control.-
Methods inherited from class totalcross.ui.Window
_doPaint, _postEvent, destroyZStack, drawHighlight, fillBackground, getBorderStyle, getClientRect, getClientRect, getDefaultDragThreshold, getFocus, getHighlighted, getPopupCount, getSafeAreaInsets, getTitleFont, getTopMost, handleFocusChangeKeys, isScreenShifted, isSipShown, isSipShown4D, isTopMost, isVisible, loadBehind, makeUnmovable, onRobotKey, onUnpop, paintTitle, paintWindowBackground, popup, popupMenuBar, popupNonBlocking, postPopup, postPressedEvent, pumpEvents, removeFocus, repaintActiveWindows, resize, resizeHeight, resizeWidth, screenResized, setBorderStyle, setDeviceTitle, setFocus, setGrabPenEvents, setHighlighted, setMenuBar, setOrientation, setSIP, setTitle, setTitleFont, shiftScreen, swap, swapFocus, unpop, validate
-
Methods inherited from class totalcross.ui.Container
add, add, add, add, add, applyTransitionEffect, broadcastEvent, clear, findChild, findNearestChild, findNextFocusControl, getChildren, getChildrenCount, getFirstChild, getFocusableControls, getInsets, incLastX, incLastY, initUI, isPressed, moveFocusToNextControl, moveFocusToNextEditable, onAddAgain, onColorsChanged, onPaint, onRemove, onSwapFinished, paintChildren, remove, removeAll, setEnabled, setFocusTraversable, setHighlighting, setInsets, setNextTransitionEffect, setPressColor, setPressed, swapToTopmostWindow
-
Methods inherited from class totalcross.ui.Control
_onEvent, addEnabledStateListener, addFocusListener, addGridListener, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addTimer, addTimer, addTimerListener, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isInsideOrNear, isObscured, isVisibleAndInside, onBoundsChanged, onWindowPaintFinished, post, postEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Field Detail
-
lb
public ListBox lb
The assigned ListBox.
-
dontHideParent
public boolean dontHideParent
Set to true if want to make the control popup below or above always, and not only if WinCE
-
fullHeight
public boolean fullHeight
Set to true to make this pop have the screen height
-
fullWidth
public boolean fullWidth
Set to true to make this popup have the screen width
-
-
Constructor Detail
-
ComboBoxDropDown
public ComboBoxDropDown()
Creates a ComboBoxDropDown with coordinates that will be set later via the setRect method.
-
ComboBoxDropDown
public ComboBoxDropDown(ListBox lb)
Creates a ComboBoxDropDown with the given ListBox. You can extend the ListBox to draw the items by yourself and use this constructor so the ComboBoxDropDown will use your class and not the default ListBox one. Note that this constructor forces the ListBox.simpleBorder to true.
-
-
Method Detail
-
onFontChanged
protected void onFontChanged()
Sets the font of the controls inside this window- Overrides:
onFontChangedin classControl
-
setRect
public void setRect(int x, int y, int width, int height, Control relative, boolean screenChanged)Sets the absolute rect of the parent's control. The ComboBoxDropDown rect will be computed based on that rectangle.- Overrides:
setRectin classControl- Parameters:
x- One of the relative positioning constants: LEFT, RIGHT, SAME, BEFORE, AFTER, CENTER, with a small adjustment. You can also use an absolute value, but this is strongly discouraged.y- One of the relative positioning constants: TOP, BOTTOM, SAME, BEFORE, AFTER, CENTER, with a small adjustment. You can also use an absolute value, but this is strongly discouraged.width- One of the relative positioning constants: PREFERRED, FILL, FIT, SAME. You can also use an absolute value, but this is strongly discouraged.height- One of the relative positioning constants: PREFERRED, FILL, FIT, SAME. You can also use an absolute value, but this is strongly discouraged.relative- To whom the position should be relative to; or null to be relative to the last control.screenChanged- Indicates that a screen change (resize, collapse) occured and therepositionmethod is calling this method. Set by the system. If you call this method directly, always pass false to it.- See Also:
Control.LEFT,Control.TOP,Control.RIGHT,Control.BOTTOM,Control.BEFORE,Control.AFTER,Control.CENTER,Control.SAME,Control.FILL,Control.PREFERRED,Control.FIT,Control.CENTER_OF,Control.RIGHT_OF,Control.BOTTOM_OF,Control.SCREENSIZE,Control.SCREENSIZEMIN,Control.SCREENSIZEMAX,Control.PARENTSIZE,Control.PARENTSIZEMIN,Control.PARENTSIZEMAX,Control.FONTSIZE,Container.add(Control, int, int),Container.add(Control, int, int, Control)
-
onClickedOutside
protected boolean onClickedOutside(PenEvent event)
Close the popup list with a click outside its bounds- Overrides:
onClickedOutsidein classWindow
-
onEvent
public void onEvent(Event event)
Description copied from class:ControlCalled to process key, pen, control and other posted events.
-
getPreferredWidth
public int getPreferredWidth()
Description copied from class:WindowReturns the size of the title if any plus the size of the border. Note that the value returned here does not handle the controls inside the window.- Overrides:
getPreferredWidthin classWindow
-
getPreferredHeight
public int getPreferredHeight()
Description copied from class:WindowReturns the size of the title if any plus the size of the border. Note that the value returned here does not handle the controls inside the window.- Overrides:
getPreferredHeightin classWindow
-
onPopup
protected void onPopup()
Description copied from class:WindowPlaceholder called imediatly before the popup began. The default implementation does nothing.
-
-