ScummVM API documentation
Ultima::Ultima4::Menu Class Reference

#include <menu.h>

Inheritance diagram for Ultima::Ultima4::Menu:
Ultima::Ultima4::Observable< Menu *, MenuEvent &>

Public Types

typedef Common::List< MenuItem * > MenuItemList
 

Public Member Functions

void removeAll ()
 
void add (int id, Common::String text, short x, short y, int shortcutKey=-1)
 
MenuItemadd (int id, MenuItem *item)
 
void addShortcutKey (int id, int shortcutKey)
 
void setClosesMenu (int id)
 
MenuItemList::iterator getCurrent ()
 
void setCurrent (MenuItemList::iterator i)
 
void setCurrent (int id)
 
void show (TextView *view)
 
bool isVisible ()
 
void next ()
 
void prev ()
 
void highlight (MenuItem *item)
 
MenuItemList::iterator begin ()
 
MenuItemList::iterator end ()
 
MenuItemList::iterator begin_visible ()
 
void reset (bool highlightFirst=true)
 
MenuItemList::iterator getById (int id)
 
MenuItemgetItemById (int id)
 
void activateItemAtPos (TextView *view, const Common::Point &pt)
 
void activateItem (int id, MenuEvent::Type action)
 
bool activateItemByShortcut (int key, MenuEvent::Type action)
 
bool getClosed () const
 
void setClosed (bool closed)
 
void setTitle (const Common::String &text, int x, int y)
 
- Public Member Functions inherited from Ultima::Ultima4::Observable< Menu *, MenuEvent &>
void addObserver (Observer< Menu *, MenuEvent & > *o)
 
int countObservers () const
 
void deleteObserver (Observer< Menu *, MenuEvent & > *o)
 
void deleteObservers ()
 
bool hasChanged () const
 
void notifyObservers (MenuEvent & arg)
 

Additional Inherited Members

- Protected Member Functions inherited from Ultima::Ultima4::Observable< Menu *, MenuEvent &>
void clearChanged ()
 
void setChanged ()
 

Detailed Description

Menu class definition

Member Function Documentation

◆ add()

void Ultima::Ultima4::Menu::add ( int  id,
Common::String  text,
short  x,
short  y,
int  shortcutKey = -1 
)

Adds an item to the menu list and returns the menu

◆ getCurrent()

MenuItemList::iterator Ultima::Ultima4::Menu::getCurrent ( )

Returns the menu item that is currently selected/highlighted

◆ setCurrent()

void Ultima::Ultima4::Menu::setCurrent ( MenuItemList::iterator  i)

Sets the current menu item to the one indicated by the iterator

◆ isVisible()

bool Ultima::Ultima4::Menu::isVisible ( )

Checks the menu to ensure that there is at least 1 visible item in the list. Returns true if there is at least 1 visible item, false if nothing is visible.

◆ next()

void Ultima::Ultima4::Menu::next ( )

Sets the selected iterator to the next visible menu item and highlights it

◆ prev()

void Ultima::Ultima4::Menu::prev ( )

Sets the selected iterator to the previous visible menu item and highlights it

◆ highlight()

void Ultima::Ultima4::Menu::highlight ( MenuItem item)

Highlights a single menu item, un-highlighting any others

◆ begin()

MenuItemList::iterator Ultima::Ultima4::Menu::begin ( )

Returns an iterator pointing to the first menu item

◆ end()

MenuItemList::iterator Ultima::Ultima4::Menu::end ( )

Returns an iterator pointing just past the last menu item

◆ begin_visible()

MenuItemList::iterator Ultima::Ultima4::Menu::begin_visible ( )

Returns an iterator pointing to the first visible menu item

◆ reset()

void Ultima::Ultima4::Menu::reset ( bool  highlightFirst = true)

'Resets' the menu. This does the following:

  • un-highlights all menu items
  • highlights the first menu item
  • selects the first visible menu item

◆ getById()

MenuItemList::iterator Ultima::Ultima4::Menu::getById ( int  id)

Returns an iterator pointing to the item associated with the given 'id'

◆ getItemById()

MenuItem* Ultima::Ultima4::Menu::getItemById ( int  id)

Returns the menu item associated with the given 'id'

◆ activateItemAtPos()

void Ultima::Ultima4::Menu::activateItemAtPos ( TextView view,
const Common::Point pt 
)

Activates any menu item at a given position

◆ activateItem()

void Ultima::Ultima4::Menu::activateItem ( int  id,
MenuEvent::Type  action 
)

Activates the menu item given by 'id', using 'action' to activate it. If the menu item cannot be activated using 'action', then it is not activated. This also un-highlights the menu item given by 'menu' and highlights the new menu item that was found for 'id'.

◆ activateItemByShortcut()

bool Ultima::Ultima4::Menu::activateItemByShortcut ( int  key,
MenuEvent::Type  action 
)

Activates a menu item by it's shortcut key. True is returned if a menu item get activated, false otherwise.

◆ getClosed()

bool Ultima::Ultima4::Menu::getClosed ( ) const

Returns true if the menu has been closed.

◆ setClosed()

void Ultima::Ultima4::Menu::setClosed ( bool  closed)

Update whether the menu has been closed.


The documentation for this class was generated from the following file: