|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjcontrol.ui.wombat.Component
jcontrol.ui.wombat.AbstractFocusComponent
jcontrol.ui.wombat.menu.Menu
jcontrol.ui.wombat.menu.MultiImageMenu
public class MultiImageMenu
The class MultiImageMenu implements a menu with several images. Menu items can be specified as Strings or Resource objects of type JCIF.
If an item is selected an ActionEvent of type ActionEvent.ITEM_SELECTED is fired. If an already selected item is touched again (or if the "select"-key on an optional keyboard is pressed) an ActionEvent of type ActionEvent.MENU_ACTION is fired.
(C) DOMOLOGIC Home Automation GmbH 2005 - 2007
| Field Summary | |
|---|---|
static int |
STYLE_NONE
|
static int |
STYLE_SHOW_BORDER
|
| Fields inherited from class jcontrol.ui.wombat.menu.Menu |
|---|
m_inactives, m_items, m_scrollValue, m_selectedIndex |
| Fields inherited from class jcontrol.ui.wombat.AbstractFocusComponent |
|---|
BORDER_WIDTH, listener |
| Fields inherited from interface jcontrol.ui.wombat.IFocusable |
|---|
TRANSFER_FOCUS_BACKWARD, TRANSFER_FOCUS_FORWARD |
| Fields inherited from interface jcontrol.ui.wombat.event.TouchListener |
|---|
RESULT_ACCEPTED, RESULT_EXECUTED, RESULT_NONE |
| Constructor Summary | |
|---|---|
MultiImageMenu(int x,
int y,
int width,
int height,
int horizontalCount,
int verticalCount,
int style)
Constructor for MultiImageMenu. |
|
| Method Summary | |
|---|---|
int |
addMenuItem(String item)
Adds a new Menu item at the first free position. |
int |
getFirstFreeIndex()
Returns the first free position in this menu or -1 if all items are set. |
int |
insertMenuItem(String item,
int index)
Inserts a menu item at the specified position. |
KeyEvent |
onKeyEvent(KeyEvent e)
If a KeyEvent accurs, this method is called. |
int |
onTouchEvent(TouchEvent e)
Every time a touch event is fired, this method will be called. |
void |
paint(XGraphics g)
Paints the menu. |
boolean |
removeMenuItem(int index)
Removes the item at the specified index if the is none. |
protected boolean |
selectNextOrPrev(boolean updown)
Selects the next or previous menu item in this menu. |
void |
setImageItems(Resource[] imageItems)
Set the given list of image resource items to this menu. |
void |
setSelectionVisible(boolean visible)
Turns the selection border on or off. |
void |
setTextItems(String[] textItems)
Set the given list of string items to this menu. |
void |
setTouchMargin(int margin)
Sets the space between the menu items that is not touch sensitive. |
void |
setTransparent(boolean transparent)
Sets the transparent state of the background. |
| Methods inherited from class jcontrol.ui.wombat.menu.Menu |
|---|
getIndex, getItem, getItemCount, getSelectedIndex, setEnabled, setSelection |
| Methods inherited from class jcontrol.ui.wombat.AbstractFocusComponent |
|---|
clearCorners, drawBevelRect, drawButton, drawDottedRect, drawFocusRect, getActionListener, onActionEvent, requestFocus, setActionListener, setEnabled, setVisible |
| Methods inherited from class jcontrol.ui.wombat.Component |
|---|
drawDisabledImage, getFrame, isEnabled, isVisible, isVisibleInternal, redrawInternalAndParent, repaint, repaintAll, safeExec, setBackgroundColor, setBackgroundColorInternal, setBounds, setDirty, setFont, setForegroundColor, setForegroundColorInternal, setParametersInternal, setRedraw, setTransparentColor, unsafeExec, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, notifyAll, toString, wait |
| Field Detail |
|---|
public static final int STYLE_NONE
public static final int STYLE_SHOW_BORDER
| Constructor Detail |
|---|
public MultiImageMenu(int x,
int y,
int width,
int height,
int horizontalCount,
int verticalCount,
int style)
x - the x coordinatey - the y coordinatewidth - the widthheight - the heightmaxVisibleItems - the number of visible menu items, images will be clipped to the same size to fit into the menu's bounds.| Method Detail |
|---|
public void setTransparent(boolean transparent)
transparent - the transparent statepublic void setSelectionVisible(boolean visible)
visible - the visible state of the selection borderpublic void setTextItems(String[] textItems)
textItems - a list of strings.public void setTouchMargin(int margin)
margin - space between the menu itemspublic void setImageItems(Resource[] imageItems)
imageItems - a list of strings.public int addMenuItem(String item)
addMenuItem in class Menuitem - the name of the menu item, can even specify an image name
Menu.insertMenuItem(String, int)public int getFirstFreeIndex()
public int insertMenuItem(String item,
int index)
insertMenuItem in class Menuitem - the name of the menu item, can even specify an image nameindex - the position
Menu.addMenuItem(String)public boolean removeMenuItem(int index)
removeMenuItem in class Menuindex - the index to remove
true if the item has been removed successfully,
false otherwiseMenu.setEnabled(int, boolean)public void paint(XGraphics g)
paint in class Componentg - the application's graphics object.Component.paint(XGraphics)public KeyEvent onKeyEvent(KeyEvent e)
onKeyEvent in interface KeyListeneronKeyEvent in class AbstractFocusComponente - the KeyEvent.
null if the KeyEvent has been consumed by the KeyListener,protected boolean selectNextOrPrev(boolean updown)
Menu
selectNextOrPrev in class Menuupdown - if true, select the next item, the previous otherwise
public int onTouchEvent(TouchEvent e)
TouchListener
onTouchEvent in interface TouchListeneronTouchEvent in class AbstractFocusComponente - The touch event.
RESULT_ACCEPTED if the TouchEvent has been consumed by the TouchListener,RESULT_EXECUTED if the TouchEvent has been consumed by the TouchListener and some important action has been performed, e.g. an action event has been invoked,RESULT_NONE if the TouchEvent should be passed on to the next TouchListener.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||