totalcross.ui
Class ComboBoxDropDown

totalcross.lang.Object
  extended by totalcross.ui.gfx.GfxSurface
      extended by totalcross.ui.Control
          extended by totalcross.ui.Container
              extended by totalcross.ui.Window
                  extended by totalcross.ui.ComboBoxDropDown

public class ComboBoxDropDown
extends Window

ComboBoxDropDown is a simple implementation of a PopUp Listbox. Used by the ComboBox class.


Field Summary
 boolean dontHideParent
          Set to true if want to make the control popup below or above always, and not only if WinCE
 boolean fullHeight
          Set to true to make this pop have the screen height
 boolean fullWidth
          Set to true to make this popup have the screen width
 ListBox lb
          The assigned ListBox.
 
Fields inherited from class totalcross.ui.Window
_controlEvent, _dragEvent, _draggingEvent, _focus, _keyEvent, _penEvent, beepIfOut, blocking, borderStyle, cancelPenUp, canDrag, dragEventTime, dragThreshold, fadeOtherWindows, fadeValue, firstFocus, flickEnabled, flickHighSpeedDecay, flickInitialInverval, flickLowSpeedDecay, flickPixelThresholdHoriz, flickPixelThresholdVert, flickSpeedLowBound, flickStartThreshold, flickTimer, gradientTitleEndColor, gradientTitleStartColor, highlighted, highResPrepared, HORIZONTAL_GRADIENT, ignoreEventOfType, isFlicking, lastSwappedContainer, mainSwapContainer, menubar, needsPaint, NO_BORDER, popped, RECT_BORDER, ROUND_BORDER, rTitle, SIP_BOTTOM, SIP_DISABLE_NUMERICPAD, SIP_ENABLE_NUMERICPAD, SIP_HIDE, SIP_SHOW, SIP_TOP, TAB_BORDER, TAB_ONLY_BORDER, title, titleColor, titleFont, topMost, triggeredFlickDirection, VERTICAL_GRADIENT, zStack
 
Fields inherited from class totalcross.ui.Container
alwaysEraseBackground, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_SIMPLE, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, nextTransitionEffect, started, tabOrder, tail, TRANSITION_CLOSE, TRANSITION_NONE, TRANSITION_OPEN, transitionEffect
 
Fields inherited from class totalcross.ui.Control
AFTER, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, CENTER, CENTER_OF, clearValueInt, clearValueStr, enabled, enableUpdateScreen, FILL, FIT, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, foreColor, height, isHighlighting, KEEP, LEFT, onEventFirst, parent, PREFERRED, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, setFont, setH, setRel, setW, setX, setY, TOP, transparentBackground, uiCE, uiFlat, uiPalm, uiVista, visible, width, WILL_RESIZE, x, y
 
Constructor Summary
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
 int getPreferredHeight()
          Returns the size of the title if any plus the size of the border.
 int getPreferredWidth()
          Returns the size of the title if any plus the size of the border.
protected  boolean onClickedOutside(PenEvent event)
          Close the popup list with a click outside its bounds
 void onEvent(Event event)
          Called to process key, pen, control and other posted events.
protected  void onFontChanged()
          Sets the font of the controls inside this window
protected  void onPopup()
          Placeholder called imediatly before the popup began.
protected  void postUnpop()
          Placeholder called after the unpop is done and after the repaint of the other window.
 void setRect(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, getBorderStyle, getClientRect, getClientRect, getFocus, getHighlighted, getTitleFont, getTopMost, handleFocusChangeKeys, isFlickEnabled, isFlicking, isTopMost, isVisible, loadBehind, makeUnmovable, onUnpop, paintTitle, popup, popupMenuBar, popupNonBlocking, postPopup, postPressedEvent, pumpEvents, releaseFlickTimer, removeFocus, repaintActiveWindows, resize, resizeHeight, resizeWidth, screenResized, setBorderStyle, setDeviceTitle, setFlickEnabled, setFocus, setGrabPenEvents, setHighlighted, setMenuBar, setSIP, setTitle, setTitleFont, swap, swapFocus, unpop, validate
 
Methods inherited from class totalcross.ui.Container
add, add, add, add, add, broadcastEvent, clear, findChild, findNearestChild, findNextFocusControl, getChildren, getFocusableControls, getInsets, incLastX, incLastY, initUI, onAddAgain, onColorsChanged, onPaint, onRemove, paintChildren, remove, removeAll, setEnabled, setHighlighting, setInsets, swapToTopmostWindow
 
Methods inherited from class totalcross.ui.Control
_onEvent, addFocusListener, addGridListener, addHighlightListener, addKeyListener, addPenListener, addPressListener, addTimer, addTimer, addTimerListener, addWindowListener, changeHighlighted, contains, getAbsoluteRect, getBackColor, getEventListeners, getFont, getForeColor, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getWidth, getX, getX2, getY, getY2, handleGeographicalFocusChangeKeys, isDisplayed, isEnabled, isInsideOrNear, isVisibleAndInside, onBoundsChanged, onWindowPaintFinished, postEvent, removeFocusListener, removeGridListener, removeHighlightListener, removeKeyListener, removePenListener, removePressListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, requestFocus, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary
 
Methods inherited from class totalcross.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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:
onFontChanged in class Control

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:
setRect in class Control
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 the reposition method 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, 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:
onClickedOutside in class Window

onEvent

public void onEvent(Event event)
Description copied from class: Control
Called to process key, pen, control and other posted events.

Overrides:
onEvent in class Control
Parameters:
event - the event to process
See Also:
Event, KeyEvent, PenEvent

getPreferredWidth

public int getPreferredWidth()
Description copied from class: Window
Returns 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:
getPreferredWidth in class Window

getPreferredHeight

public int getPreferredHeight()
Description copied from class: Window
Returns 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:
getPreferredHeight in class Window

onPopup

protected void onPopup()
Description copied from class: Window
Placeholder called imediatly before the popup began. The default implementation does nothing.

Overrides:
onPopup in class Window

postUnpop

protected void postUnpop()
Description copied from class: Window
Placeholder called after the unpop is done and after the repaint of the other window. The default implementation does nothing.

Overrides:
postUnpop in class Window