|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwaba.ui.Control
waba.ui.Container
ControlListBox
A ListBox-like container which allows adding of
arbitrary non-homogenous controls (instead of text strings).
ControlListBox is 'yet another' implementation
of a scrollable container, this time in the
spirit of a ListBox which allows the addition
of arbitrary controls.
As the name 'listbox' implies, the intention is that
items get stacked vertically. It's meant to look
and feel a bit like a listbox, except that it allows
virtually any Control or subclass to be added.
So far, there is no support for horizontal scrolling,
which puts the onus on the programmer to ensure that
the added items' width does not exceed this control's
width.
Scrollbar is initially invisible, and becomes visible
only when needed.
Scrolling strategy is pixel-oriented, not item-oriented.
But you can invoke setScrollLineAmount to change the
step scroll amount.
This is a work in progress - no support exists yet
for highlighting, finding or removing items.
You should have received a file called 'Test.java'
along with this file. Test.java provides a very
clear demonstration.
The anatomy of this control is an outer container holding
a viewport container and a scrollbar. The viewport container
holds an inner content container, to which the child widgets
are added.
| Field Summary | |
protected waba.util.Vector |
childControls
|
waba.ui.Container |
content
|
protected int |
hContent
|
protected int |
numChildControls
|
waba.ui.ScrollBar |
scrollbar
|
protected boolean |
scrollbarShowing
|
protected int |
scrollLineAmount
|
waba.ui.Container |
viewport
|
protected int |
wContent
|
protected int |
wScrollbar
|
protected int |
xContent
|
protected int |
yContent
|
| Fields inherited from class waba.ui.Container |
BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_SIMPLE, children, lastH, lastW, lastX, lastY, parentWindow, started, tabOrder, tail |
| Fields inherited from class waba.ui.Control |
AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, focusTraversable, font, foreColor, foreDis, height, isHighlighting, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2 |
| Constructor Summary | |
ControlListBox()
Creates a ControlListBox widget After creating this widget, you should setRect() it |
|
| Method Summary | |
void |
add(waba.ui.Control ctrl)
Add a single control to this widget, sizing the control to its preferred width/height If you really want to enforce a size for the control, use the addSized() method instead. |
void |
add(waba.ui.Control ctrl,
int x,
int y)
Dummy override that just passes to add(Control) Both arguments will be ignored. |
void |
addSized(waba.ui.Control ctrl,
int w,
int h)
add a Control to this widget, explicitly setting its width and height |
void |
debugPopup()
|
int |
find(waba.ui.Control c)
Search for child control c, returning its index if it is in fact a child control, or -1 if it is not present on this widget |
void |
insert(int idx,
waba.ui.Control c)
|
void |
insert(int idx,
waba.ui.Control c,
int height)
Inserts a control into this widget at given index |
void |
onEvent(waba.ui.Event e)
Called by system, to handle scrollbar events |
void |
remove(waba.ui.Control c)
Remove a control from this widget |
void |
remove(int idx)
Remove the control at the given index |
void |
resizeChild(int idx,
int newHeight)
changes the height of a child control |
void |
resizeControl(waba.ui.Control c,
int newHeight)
changes the height of a child control |
void |
scroll(int dy)
Scroll the viewable area by a given number of pixels. |
void |
scrollDownFully()
Scroll all the way to the bottom |
void |
scrollDownLine()
Scroll down one line (using the parameter given in the last call to setScrollLineAmount) |
void |
scrollDownPage()
Scroll down one page (less a line's worth) |
void |
scrollUpFully()
Scroll all the way to the top |
void |
scrollUpLine()
Scroll up one line (using the parameter given in the last call to setScrollLineAmount) |
void |
scrollUpPage()
Scroll up one page (less a line's worth) |
void |
setRect(int x,
int y,
int w,
int h)
Adjusts size and placement of this widget, and updates the inner structure as needed |
void |
setRect(waba.fx.Rect r)
Adjusts size and placement of this widget, and updates the inner structure as needed |
void |
setScrollLineAmount(int numPixels)
Set the number of pixels by which the control should line-scroll. |
protected void |
shiftContents(int idx,
int dy)
|
protected void |
updatePanes()
shows or hides the scrollbar, ensuring that if the scrollbar is displayed, it is updated |
protected void |
updateScrollbar()
Update scrollbar state if required |
| Methods inherited from class waba.ui.Container |
add, broadcastEvent, findChild, getChildren, getClientRect, getClientRect, onAdd, onColorsChanged, onPaint, onRemove, onStart, paintChildren, setBorderStyle, setEnabled, setHighlighting |
| Methods inherited from class waba.ui.Control |
addTimer, changeHighlighted, contains, createGraphics, drawHighlight, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getPreferredHeight, getPreferredWidth, getRect, getSize, isDisplayed, isEnabled, isVisible, onBoundsChanged, onFontChanged, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setVisible, translateFromOrigin, uiStyleChanged |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public waba.ui.Container viewport
public waba.ui.Container content
protected int xContent
protected int yContent
protected int wContent
protected int hContent
public waba.ui.ScrollBar scrollbar
protected int wScrollbar
protected boolean scrollbarShowing
protected int scrollLineAmount
protected waba.util.Vector childControls
protected int numChildControls
| Constructor Detail |
public ControlListBox()
| Method Detail |
public void setRect(int x,
int y,
int w,
int h)
public void setRect(waba.fx.Rect r)
public void add(waba.ui.Control ctrl,
int x,
int y)
public void add(waba.ui.Control ctrl)
ctrl - almost any widget object with Control in its pedigree
public void addSized(waba.ui.Control ctrl,
int w,
int h)
ctrl - the control to addw - width to set for the controlh - height to set for the controlpublic int find(waba.ui.Control c)
public void remove(int idx)
idx - the integer index at which this control was addedpublic void remove(waba.ui.Control c)
public void insert(int idx,
waba.ui.Control c,
int height)
public void insert(int idx,
waba.ui.Control c)
public void resizeControl(waba.ui.Control c,
int newHeight)
public void resizeChild(int idx,
int newHeight)
protected void shiftContents(int idx,
int dy)
public void scroll(int dy)
dy - Number of pixels to scrollpublic void scrollUpFully()
public void scrollUpPage()
public void scrollUpLine()
public void scrollDownLine()
public void scrollDownPage()
public void scrollDownFully()
public void setScrollLineAmount(int numPixels)
numPixels - the number of pixels per line, will be set
to 1 if <= 0protected void updatePanes()
protected void updateScrollbar()
public void onEvent(waba.ui.Event e)
public void debugPopup()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||