|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.jgamegrid.ToolBar
public class ToolBar
Class to represent a linear bar of item. The items are standard JGameGrid actors. A tool bar is used to show or modify the state of a game (e.g. to select/show the trump suit). Mouse touch events are reported by a registered tool bar listener. The actors may have several sprite image that may be changed by calling Actor.show(spriteId). Because in JGameGrid the paint order is determined per class (when the first actor of a class is s added to the game grid), the tool bar items are shown on top of card actors if the tool bar is shown first. The paint order may be changed by calling setOnTop() or setOnBottom resp.
Constructor Summary | |
---|---|
ToolBar(GameGrid gameGrid)
|
Method Summary | |
---|---|
void |
addItem(ToolBarItem... item)
Add the next item(s) into the tool bar in the order they are passed. |
void |
addToolBarListener(ToolBarListener listener)
Registers a tool bar listener to get event notifications when an item is touched. |
ToolBarItem |
getItem(int itemIndex)
Returns the tool bar item actor at the specified index of the item list. |
void |
removeAllItems()
Removes all currently displayed items from the card game window and empties the item list. |
void |
setAllSpriteIds(int spriteId)
Sets the sprite id of all items to given value. |
void |
setLocation(Location barLocation)
Moves the current tool bar at the specified location. |
void |
setOnBottom(java.lang.Class clazz)
Puts the given class prior to the ToolBarItem class in the paint order, so that actors from the given class are painted on top of tool bar item images. |
void |
setOnTop(java.lang.Class clazz)
Puts the ToolBarItem class prior to the given class in the paint order, so that the tool bar item images are painted on top of actors from the given class. |
void |
setSpriteId(int itemIndex,
int spriteId)
Sets the sprite id of the item at given index to given value. |
void |
show(Location barLocation)
Adds the tool bar item actors to the card game window at the given location (upper left corner of first item). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ToolBar(GameGrid gameGrid)
Method Detail |
---|
public void show(Location barLocation)
barLocation
- the location of the upper left corner of the first itempublic void removeAllItems()
public void addItem(ToolBarItem... item)
item
- the item(s) or array of items to be addedpublic void setSpriteId(int itemIndex, int spriteId)
itemIndex
- the index of the item in the item list
(in the range 0..nbItems-1, nothing happens if outside)spriteId
- the new sprite id of the item actorpublic void setAllSpriteIds(int spriteId)
spriteId
- the new sprite id of all item actorspublic ToolBarItem getItem(int itemIndex)
itemIndex
- the index of the item in the item list
(in the range 0..nbItems-1)
public void setOnTop(java.lang.Class clazz)
public void setOnBottom(java.lang.Class clazz)
public void setLocation(Location barLocation)
barLocation
- the new location of the tool barpublic void addToolBarListener(ToolBarListener listener)
listener
- the ToolBarListener to register
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |