|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.ui.ControlBase
ewe.ui.Control
ewe.ui.PhoneMenu
A Phone Menu is a non-scrolling menu displayed normally full screen. A maximum of 9 items can be displayed on the screen at one time, and a digit from 1-9 is associated with each one. If there is not enough space on the screen to display all the items then up to 8 are displayed and the 9 button is used to indicate "More..." items.
| Field Summary | |
IImage |
backgroundImage
If this is not null and scaleBackgroundImage is null, then this will be used as the background image. |
protected static IImage |
bigMoreImage
|
protected IconAndText |
display
This is an IconAndText that you can use when painting individual items. |
boolean |
dontScaleIcons
Set this true if you do not want the icons to be scaled to 16x16 or 32x32 |
boolean |
dontShowNumbers
Set this true if you do not want the phone digits to be displayed. |
protected int |
firstItem
|
int |
itemHeight
|
Vector |
items
Items are added to this as Strings or MenuItem objects. |
protected static String[] |
keys
These are the phone keys from '1' to '9' - you can use them in paintItemAt(). |
protected static IImage |
moreImage
|
protected static int |
PAINT_FLASH_OFF
|
protected static int |
PAINT_FLASH_ON
|
protected static int |
PAINT_IS_MORE_ITEM
|
protected static int |
PAINT_SELECTED
|
IImage |
scaleBackgroundImage
If this is not null, this will be scaled to fit the entire menu. |
protected int |
selectedScreenIndex
|
boolean |
useGrid
If this is true the controls will be laid out in a 2x3 grid. |
| Fields inherited from class ewe.ui.Control |
_debug, backGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, DoPaintMethod, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, foreGround, haveNativePaint, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, MyClass, name, next, np, parent, penStatus, popupSound, popupSoundClip, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, standardBorder, standardEdge, startDragResolution, tags, tail, text, toolTip, width, x, y |
| Fields inherited from class ewe.ui.ControlBase |
clipItems, clipObject, clipOwner, curPoint, currentPenEvent, debugControl, debugFlag, DidHoldDown, doubleBuffer, doubleClickTime, firstPress, globalDrawFlat, globalEditable, globalEnabled, globalPalmStyle, globalSmallControls, GotPenDown, PenIsOn, pressPoint, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamed, useNativeTextInput |
| Fields inherited from interface ewe.ui.UIConstants |
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, 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_SUNKEN |
| Fields inherited from interface ewe.ui.CellConstants |
BORDER, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, FIXEDSIZE, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST |
| Fields inherited from interface ewe.ui.ControlConstants |
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, Disabled, DisablePopupMenu, DisplayOnly, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpKeyEvents, SendUpPenEvents, ShowSIP, ShrinkToNothing, SmallControl, SpecialBackground, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown |
| Fields inherited from interface ewe.fx.ImageRefresher |
KEEP_VISIBLE |
| Constructor Summary | |
PhoneMenu()
|
|
| Method Summary | |
MenuItem |
addItem(IImage icon,
String text)
Add an item and return the MenuItem created for it. |
MenuItem |
addItem(String iconName,
Object maskOrColor,
String text)
Add an item and return the MenuItem created for it. |
int |
countItems()
Return the number of items. |
void |
doAction(int itemIndex)
|
void |
doBackground(Graphics g)
|
void |
doPaint(Graphics g,
Rect where)
|
protected int |
getDataItemsOnScreen()
Get the total number of data items on the current dispay (items not including the "More..." item) up to a maximum of 9. |
protected int |
getDataItemsOnScreen(int startingFrom)
Get the total number of data items on the dispay (items not including the "More..." item) up to a maximum of 9, assuming that startingFrom indicates the index of the first item to display. |
int |
getIndexOnScreen(int anItem)
|
MenuItem |
getItemAtIndex(int index)
Get the item at the specified index as a MenuItem. |
Rect |
getItemRect(int anItem,
Rect destination)
Override this to get the area on the screen for a particular item. |
protected int |
getMoreIndex()
|
Rect |
getMoreItemRect(Rect destination)
Override this to get the area on the screen for the "More..." item. |
int |
getSelectedItem()
Get which item is selected. |
protected int |
getTotalItemsOnScreen()
Get the total number of items on the dispay - up to a maximum of 9. |
protected boolean |
isShowingMoreItem()
|
MenuItem |
makeItem(IImage icon,
String text)
Create a MenuItem given an Icon and a label, possibly scaling the icon if necessary. |
boolean |
makeVisible(int itemIndex)
Make an item visible, repainting if necessary. |
protected boolean |
moreIsSelected()
|
protected boolean |
nextItem(boolean forwards,
boolean horizontally)
|
protected boolean |
nextPage(boolean forwards)
|
void |
onKeyEvent(KeyEvent ev)
|
protected void |
paintItem(Graphics gr,
int indexOnScreen)
|
protected void |
paintItemAt(Graphics g,
int itemIndex,
MenuItem item,
int itemWidth,
int itemHeight,
int options)
This method should paint the specified item at the location (0,0) in the specified Graphics. |
void |
refresh(IImage image,
int options)
The default version of this method simpy repaints the control - however for controls which may display multiple images a better refresh scheme would be needed. |
void |
repaintItem(int whichItem)
|
protected void |
repaintItem(int whichItem,
Graphics gr)
|
void |
resizeTo(int newWidth,
int newHeight)
This will change the width and height values. |
void |
setSelectedItem(int newSelectedItem)
|
void |
setSelectedItem(int newSelectedItem,
boolean makeVisible)
|
protected void |
setSelectedScreenIndex(int newSelected)
Change the index selected on screen, repainting if necessary. |
protected void |
sizeChanged()
This gets called when the size of the PhoneMenu has now changed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode |
| Field Detail |
public int itemHeight
protected int firstItem
protected int selectedScreenIndex
public boolean useGrid
public boolean dontShowNumbers
public boolean dontScaleIcons
public IImage backgroundImage
public IImage scaleBackgroundImage
protected static IImage moreImage
protected static IImage bigMoreImage
public Vector items
protected IconAndText display
protected static String[] keys
protected static final int PAINT_IS_MORE_ITEM
protected static final int PAINT_SELECTED
protected static final int PAINT_FLASH_ON
protected static final int PAINT_FLASH_OFF
| Constructor Detail |
public PhoneMenu()
| Method Detail |
public Rect getItemRect(int anItem,
Rect destination)
anItem - The index of a particular data item.destination - The destination Rect or null to create and return a new one.
public Rect getMoreItemRect(Rect destination)
destination - The destination Rect or null to create and return a new one.
protected int getTotalItemsOnScreen()
protected void sizeChanged()
public MenuItem makeItem(IImage icon,
String text)
public MenuItem addItem(IImage icon,
String text)
public MenuItem addItem(String iconName,
Object maskOrColor,
String text)
public int getSelectedItem()
public boolean makeVisible(int itemIndex)
public int getIndexOnScreen(int anItem)
public void doAction(int itemIndex)
doAction in class Controlprotected void setSelectedScreenIndex(int newSelected)
public void setSelectedItem(int newSelectedItem,
boolean makeVisible)
public void setSelectedItem(int newSelectedItem)
public void resizeTo(int newWidth,
int newHeight)
Control
resizeTo in class Controlpublic int countItems()
public MenuItem getItemAtIndex(int index)
index - the item index.
protected int getDataItemsOnScreen(int startingFrom)
protected int getDataItemsOnScreen()
protected boolean isShowingMoreItem()
protected int getMoreIndex()
protected boolean moreIsSelected()
protected boolean nextItem(boolean forwards,
boolean horizontally)
protected boolean nextPage(boolean forwards)
public void onKeyEvent(KeyEvent ev)
onKeyEvent in class Control
protected void paintItemAt(Graphics g,
int itemIndex,
MenuItem item,
int itemWidth,
int itemHeight,
int options)
g - The target Graphics. This would have already been translated so that
the item should be painted at location (0,0). The background for the image would
also have already been painted, but if the item is selected, no special selected item
painting is done - you will have to check if the PAINT_IS_SELECTED flag is set in the
options.itemIndex - the index of the item. If PAINT_IS_MORE_ITEM is set in the options
then this value will be -1.item - The MenuItem holding the item as returned by getItemAtIndex().itemWidth - The width of the area allocated to the item.itemHeight - The height of the area allocated to the item.options - any of the PAINT_XXX values ORed together.
protected void paintItem(Graphics gr,
int indexOnScreen)
public void repaintItem(int whichItem)
protected void repaintItem(int whichItem,
Graphics gr)
public void doBackground(Graphics g)
doBackground in class Control
public void doPaint(Graphics g,
Rect where)
doPaint in class Control
public void refresh(IImage image,
int options)
Control
refresh in interface ImageRefresherrefresh in class Controlimage - the image to refresh.options -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||