bluegammon.gui.menu
Interface MenuListener

All Known Implementing Classes:
MenuCanvas

public interface MenuListener

This interface is used by applications which need to receive high-level events concerning a Menu. An instance of MenuListener is specified to a Menu using the setListener method in Menu.

Author:
Peter Andersson

Method Summary
 void actionCalled(MenuPage page, PageItem item, ItemAction action)
          Called when an ItemAction is invoked.
 void itemSelected(MenuPage page, PageItem oldItem, PageItem newItem)
          Called when a item is selected in a page.
 void newPage(MenuPage fromPage, MenuPage toPage, boolean back)
          Called when a new page is shown.
 void transitionStarted(MenuPage fromPage, MenuPage toPage, long delay, int frames, boolean back)
          Called when a transition is started on a new page selection.
 void transitionStopped(MenuPage fromPage, MenuPage toPage)
          Called when a transition is finished.
 

Method Detail

newPage

public void newPage(MenuPage fromPage,
                    MenuPage toPage,
                    boolean back)
Called when a new page is shown.

Parameters:
fromPage - Old page or null.
toPage - New page.
back - true if user steps back, false if active choice forwards.

itemSelected

public void itemSelected(MenuPage page,
                         PageItem oldItem,
                         PageItem newItem)
Called when a item is selected in a page.

Parameters:
page - The page in which the item is selected.
oldItem - The item that is deselected or null if no such item.
newItem - The item that is selected.

actionCalled

public void actionCalled(MenuPage page,
                         PageItem item,
                         ItemAction action)
Called when an ItemAction is invoked.

Parameters:
page - The page in which the action was invoked.
item - The item the action belongs to.
action - The action.

transitionStarted

public void transitionStarted(MenuPage fromPage,
                              MenuPage toPage,
                              long delay,
                              int frames,
                              boolean back)
Called when a transition is started on a new page selection.

Parameters:
fromPage - Old page or null.
toPage - New page.
delay - Delay between each transition frame in milliseconds.
frames - Number of frames in this transition.
back - True if this is transition back to a previous page.

transitionStopped

public void transitionStopped(MenuPage fromPage,
                              MenuPage toPage)
Called when a transition is finished.

Parameters:
fromPage - Old page or null.
toPage - New page.