public class ToolBar
extends java.lang.Object
Constructor and Description |
---|
ToolBar(GameGrid gameGrid)
Creates a toolbar instance belonging to the given game grid.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Location barLocation)
Adds the tool bar item actors to the card game window at the
given location (upper left corner of first item).
|
void |
addItem(ToolBarItem... item)
Add the next item(s) into the tool bar in the order they are passed.
|
void |
addNoRefresh(Location barLocation)
Same as add(Location barLocation), but does not refresh the game grid.
|
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.
|
int |
getWidth()
Returns the total real width of the tool bar.
|
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 real 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.
|
public ToolBar(GameGrid gameGrid)
gameGrid
- the GameGrid instance where the toolbar is usedpublic void add(Location barLocation)
barLocation
- the real location of the upper left corner of the first itempublic void addNoRefresh(Location barLocation)
public 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 real location of the tool barpublic void addToolBarListener(ToolBarListener listener)
listener
- the ToolBarListener to registerpublic int getWidth()