ScummVM API documentation
Graphics::MacMenu Class Reference
Inheritance diagram for Graphics::MacMenu:
Graphics::BaseMacWindow Graphics::MacWidget Graphics::MacPopUp

Public Member Functions

 MacMenu (int id, const Common::Rect &bounds, MacWindowManager *wm)
 
ManagedSurfacegetBorderSurface () override
 
const Common::RectgetInnerDimensions () override
 
bool isDirty () override
 
void setAlignment (Graphics::TextAlign align)
 
void setCommandsCallback (void(*callback)(int, Common::String &, void *), void *data)
 
void setCommandsCallback (void(*callback)(int, Common::U32String &, void *), void *data)
 
void addStaticMenus (const MacMenuData *data)
 
void calcDimensions ()
 
int numberOfMenus ()
 
int numberOfMenuItems (MacMenuItem *menu)
 
MacMenuItemgetMenuItem (int menuId)
 
MacMenuItemgetMenuItem (const Common::String &menuId)
 
MacMenuItemgetSubMenuItem (MacMenuItem *menu, int itemId)
 
MacMenuItemgetSubMenuItem (MacMenuItem *menu, const Common::String &itemId)
 
MacMenuSubMenuaddSubMenu (MacMenuSubMenu *submenu, int index=-1)
 
int addMenuItem (MacMenuSubMenu *submenu, const Common::String &text, int action=-1, int style=0, char shortcut=0, bool enabled=true, bool checked=false)
 
int addMenuItem (MacMenuSubMenu *submenu, const Common::U32String &text, int action=0, int style=0, char shortcut=0, bool enabled=true, bool checked=false)
 
void insertMenuItem (MacMenuSubMenu *submenu, const Common::String &text, uint pos, int action=-1, int style=0, char shortcut=0, bool enabled=true, bool checked=false)
 
void insertMenuItem (MacMenuSubMenu *submenu, const Common::U32String &text, uint pos, int action=0, int style=0, char shortcut=0, bool enabled=true, bool checked=false)
 
void removeMenuItem (MacMenuSubMenu *submenu, uint pos)
 
void loadMenuResource (Common::MacResManager *resFork, uint16 id)
 
void loadMenuBarResource (Common::MacResManager *resFork, uint16 id)
 
void createSubMenuFromString (int id, const char *string, int commandId)
 
void clearSubMenu (int id)
 
MacMenuSubMenugetSubmenu (MacMenuSubMenu *submenu, int index)
 
bool draw (ManagedSurface *g, bool forceRedraw=false) override
 
void eventLoop ()
 
bool mouseClick (int x, int y)
 
bool draw (bool forceRedraw=false) override
 
void blit (ManagedSurface *g, Common::Rect &dest) override
 
bool processEvent (Common::Event &event) override
 
void enableCommand (int menunum, int action, bool state)
 
void enableCommand (const char *menuitem, const char *menuaction, bool state)
 
void enableCommand (const Common::U32String &menuitem, const Common::U32String &menuaction, bool state)
 
void enableAllMenus ()
 
void disableAllMenus ()
 
bool isVisible ()
 
void setVisible (bool visible, bool silent=false) override
 
void printMenu (int level=0, MacMenuSubMenu *submenu=nullptr)
 
virtual void closeMenu ()
 
bool checkIntersects (Common::Rect &rect)
 
void setCheckMark (MacMenuItem *menuItem, bool checkMark)
 
bool getCheckMark (MacMenuItem *menuItem)
 
void setEnabled (MacMenuItem *menuItem, bool enabled)
 
bool getEnabled (MacMenuItem *menuItem)
 
void setName (MacMenuItem *menuItem, const Common::String &name)
 
Common::String getName (MacMenuItem *menuItem)
 
void setAction (MacMenuItem *menuItem, int actionId)
 
int getAction (MacMenuItem *menuItem)
 
int getLastSelectedMenuItem ()
 
int getLastSelectedSubmenuItem ()
 
void renderSubmenu (MacMenuSubMenu *menu, bool recursive=true)
 
int getScrollDirection ()
 
int getDropdownItemHeight ()
 
- Public Member Functions inherited from Graphics::BaseMacWindow
 BaseMacWindow (int id, bool editable, MacWindowManager *wm)
 
int getId ()
 
WindowType getType ()
 
bool isEditable ()
 
bool isVisible ()
 
ManagedSurfacegetWindowSurface ()
 
void setCallback (bool(*callback)(WindowClick, Common::Event &, void *), void *data)
 
- Public Member Functions inherited from Graphics::MacWidget
 MacWidget (MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, bool focusable, uint16 border=0, uint16 gutter=0, uint16 shadow=0, uint32 fgcolor=0, uint32 bgcolor=0xff)
 
const Common::RectgetDimensions ()
 
virtual void setActive (bool active)
 
void setDirty (bool dirty)
 
virtual bool needsRedraw ()
 
virtual bool hasAllFocus ()
 
virtual void setColors (uint32 fg, uint32 bg)
 
virtual void setDimensions (const Common::Rect &r)
 
Common::Point getAbsolutePos ()
 
MacWidgetfindEventHandler (Common::Event &event, int dx, int dy)
 
void removeWidget (MacWidget *child, bool del=true)
 
Graphics::ManagedSurfacegetSurface ()
 

Static Public Member Functions

static Common::StringArrayreadMenuFromResource (Common::SeekableReadStream *res)
 
static MacMenucreateMenuFromPEexe (Common::PEResources *exe, MacWindowManager *wm)
 

Public Attributes

Common::Array< MacMenuSubMenu * > _menustack
 
- Public Attributes inherited from Graphics::MacWidget
bool _focusable
 
bool _active
 
bool _editable
 
uint _priority
 
Common::Rect _dims
 
MacWindowManager_wm
 
MacWidget_parent
 
Common::Array< MacWidget * > _children
 

Protected Member Functions

void calcSubMenuBounds (MacMenuSubMenu *menu, int x, int y)
 

Protected Attributes

Common::Rect _bbox
 
ManagedSurface _screen
 
ItemArray _items
 
bool _isVisible
 
bool _dimensionsDirty
 
int _menuDropdownItemHeight
 
int _activeItem
 
int _activeSubItem
 
bool _isModal
 
- Protected Attributes inherited from Graphics::BaseMacWindow
int _id
 
WindowType _type
 
bool _editable
 
bool(* _callback )(WindowClick, Common::Event &, void *)
 
void * _dataPtr
 
bool _visible
 
bool _draggable
 
- Protected Attributes inherited from Graphics::MacWidget
uint16 _border
 
uint16 _gutter
 
uint16 _shadow
 
uint32 _fgcolor
 
uint32 _bgcolor
 
Graphics::ManagedSurface_composeSurface
 
bool _contentIsDirty
 

Member Function Documentation

◆ getBorderSurface()

ManagedSurface* Graphics::MacMenu::getBorderSurface ( )
inlineoverridevirtual

Method to access the border surface of the window.

Returns
A pointer to the border surface of the window.

Implements Graphics::BaseMacWindow.

◆ getInnerDimensions()

const Common::Rect& Graphics::MacMenu::getInnerDimensions ( )
inlineoverridevirtual

Accessor to retrieve the dimensions of the inner surface of the window (i.e. without taking borders into account). Note that the returned dimensions' position is relative to the WM's screen, just like in getDimensions().

Returns
The inner dimensions of the window.

Implements Graphics::BaseMacWindow.

◆ isDirty()

bool Graphics::MacMenu::isDirty ( )
inlineoverridevirtual

Method that checks if the window is needs redrawing.

Implements Graphics::BaseMacWindow.

◆ draw() [1/2]

bool Graphics::MacMenu::draw ( ManagedSurface g,
bool  forceRedraw = false 
)
overridevirtual

Method called to draw the window into the target surface. This method is most often called by the WM, and relies on the window being marked as dirty unless otherwise specified.

Parameters
gSurface on which to draw the window.
forceRedrawIt's behavior depends on the subclass.

Implements Graphics::BaseMacWindow.

Reimplemented in Graphics::MacPopUp.

◆ draw() [2/2]

bool Graphics::MacMenu::draw ( bool  forceRedraw = false)
inlineoverridevirtual

Method called to internally draw the window. This relies on the window being marked as dirty unless otherwise specified.

Parameters
forceRedrawIts behavior depends on the subclass.

Implements Graphics::BaseMacWindow.

◆ processEvent()

bool Graphics::MacMenu::processEvent ( Common::Event event)
overridevirtual

Method called by the WM when there is an event concerning the window. Note that depending on the subclass of the window, it might not be called if the window is not active.

Parameters
eventEvent to be processed.
Returns
true If the event was successfully consumed and processed.

Implements Graphics::BaseMacWindow.

◆ setVisible()

void Graphics::MacMenu::setVisible ( bool  visible,
bool  silent = false 
)
inlineoverridevirtual

Mutator to change the visible state of the window.

Parameters
visibleTarget state.

Reimplemented from Graphics::BaseMacWindow.


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