# IShMenuUtilities Struct Reference
[Shell Utilities]

Utilities for handling menus. More...

Inheritance diagram for IShMenuUtilities:

List of all members.

## Public Member Functions
virtual MCCOMErr MCCOMAPI | EnableCheckMenu (int32 anAction, boolean canDo, boolean checkIt)=0
virtual MCCOMErr MCCOMAPI | EnableMenuAction (int32 anAction, boolean canDo)=0
virtual MCCOMErr MCCOMAPI | CreateMenu (TMFMenuInfo &inInfo, IMFMenu **outMenu)=0
virtual MCCOMErr MCCOMAPI | MenuActionToMenuItem (int32 action, int16 &menu, int16 &item)=0
virtual int32 MCCOMAPI | MenuActionFromMenuItem (int16 commandName, int16 item)=0
virtual MCCOMErr MCCOMAPI | DeleteMenuItem (int16 menu, int16 item)=0
virtual MCCOMErr MCCOMAPI | AddMenuItem (int16 menu, TMCString &commandName, int16 after, int32 action)=0
virtual MCCOMErr MCCOMAPI | AddSubMenuItem (int16 menu, TMCString &commandName, int16 submenu, int16 after)=0
virtual int16 MCCOMAPI | GetItemCount (int16 menu)=0
virtual MCCOMErr MCCOMAPI | FindMenuByID (int16 menu, IMFMenu **outMenu)=0
virtual MCCOMErr MCCOMAPI | InvalidateMenus ()=0
virtual MCCOMErr MCCOMAPI | EnableGlobalTool (int32 inToolID, boolean inIsEnabled, boolean inIsPressed)=0
virtual MCCOMErr MCCOMAPI | GetCurrentGlobalTool (int32 &outToolID)=0
virtual MCCOMErr MCCOMAPI | SetCurrentGlobalTool (int32 inToolID, boolean inInvalidate)=0
virtual void MCCOMAPI | RebuildMainMenus ()=0
| Posts a rebuild menus action.

## Detailed Description

Utilities for handling menus.

## Member Function Documentation

virtual MCCOMErr MCCOMAPI IShMenuUtilities::AddMenuItem | ( | int16 | menu,
|  | TMCString & | commandName,
|  | int16 | after,
|  | int32 | action |
| ) |  |  | `[pure virtual]`

Adds a new menu item to the menus.

Parameters:

  | menu | Menu number to which we're adding an item
  | commandName | String to display in the menu for this item
  | after | Item number of the item to follow the one we're inserting. Pass -1 to add to the end of the menu.
  | action | Action number to associate with this menu item

virtual MCCOMErr MCCOMAPI IShMenuUtilities::AddSubMenuItem | ( | int16 | menu,
|  | TMCString & | commandName,
|  | int16 | submenu,
|  | int16 | after |
| ) |  |  | `[pure virtual]`

Adds a sub-menu item to a given menu item. This allows for nested menus, as in Carrara's View->Zoom menu with its various zoom factors as sub-menus.

Parameters:

  | menu | Menu ID number of the parent menu
  | commandName | String to display in the menu for this item
  | submenu | Menu ID number for the menu to create
  | after | Item number of the item to follow the one we're inserting. Pass -1 to add to the end of the menu.

virtual MCCOMErr MCCOMAPI IShMenuUtilities::CreateMenu | ( | TMFMenuInfo & | inInfo,
|  | IMFMenu ** | outMenu |
| ) |  |  | `[pure virtual]`

Creates a menu (which can be either a menu or a menu item).

Parameters:

  | inInfo | the TMFMenuInfo information for the menu to create
  | outMenu | Returns a pointer to the created menu

virtual MCCOMErr MCCOMAPI IShMenuUtilities::DeleteMenuItem | ( | int16 | menu,
|  | int16 | item |
| ) |  |  | `[pure virtual]`

Removes a menu item.

Parameters:

  | menu | Menu number to remove
  | item | Menu item number to remove

virtual MCCOMErr MCCOMAPI IShMenuUtilities::EnableCheckMenu | ( | int32 | anAction,
|  | boolean | canDo,
|  | boolean | checkIt |
| ) |  |  | `[pure virtual]`

Enables a menu action, and determines if the menu item should have a check next to it.

Parameters:

  | anAction | ID of the menu action whose menu entry we want to enable/disable and/or checkmark
  | canDo | If true, the menu item will be enabled.
  | checkIt | If true, the menu item will be checked.

virtual MCCOMErr MCCOMAPI IShMenuUtilities::EnableGlobalTool | ( | int32 | inToolID,
|  | boolean | inIsEnabled,
|  | boolean | inIsPressed |
| ) |  |  | `[pure virtual]`

Enables or disables a global tool item.

Parameters:

  | inToolID | ID of the tool to enable/disable
  | inIsEnabled | If true, enables the tool. If false, disables it.
  | inIsPressed | Not currently implemented.

virtual MCCOMErr MCCOMAPI IShMenuUtilities::EnableMenuAction | ( | int32 | anAction,
|  | boolean | canDo |
| ) |  |  | `[pure virtual]`

Enables or disables a menu action

Parameters:

  | anAction | ID of the menu action whose menu entry we want to enable/disable
  | canDo | If true, the menu item will be enabled.

virtual MCCOMErr MCCOMAPI IShMenuUtilities::FindMenuByID | ( | int16 | menu,
|  | IMFMenu ** | outMenu |
| ) |  |  | `[pure virtual]`

Finds a menu item by its menu ID

Parameters:

  | menu | ID of the menu to find
  | outMenu | Returns a pointer to the menu, or NULL if not found.

virtual MCCOMErr MCCOMAPI IShMenuUtilities::GetCurrentGlobalTool | ( | int32 & | outToolID | ) | `[pure virtual]`

Returns the ID of the current active global tool.

Parameters:

  | outToolID | Returns the active tool ID

virtual int16 MCCOMAPI IShMenuUtilities::GetItemCount | ( | int16 | menu | ) | `[pure virtual]`

Gets the number of items in a given menu.

Parameters:

  | menu | Menu ID number to query

Returns:
  The count of menu items in this menu.

virtual MCCOMErr MCCOMAPI IShMenuUtilities::InvalidateMenus | ( |  | ) | `[pure virtual]`

Invalidates menus so that SelfPrepareMenus will be called throughout the application at the next event loop. Call this if the context has changed, and menus should be updated (for example, if you do something like changing the selection in a SelfMouseDown() but do not post any actions).

virtual int32 MCCOMAPI IShMenuUtilities::MenuActionFromMenuItem | ( | int16 | commandName,
|  | int16 | item |
| ) |  |  | `[pure virtual]`

Given a menu number and item number, returns the corresponding menu action ID.

Parameters:

  | commandName | Menu number to query
  | item | Item number to query

Returns:
  The menu action ID corresponding to commandName and item

virtual MCCOMErr MCCOMAPI IShMenuUtilities::MenuActionToMenuItem | ( | int32 | action,
|  | int16 & | menu,
|  | int16 & | item |
| ) |  |  | `[pure virtual]`

Given a menu action number, returns the corresponding menu and item index

Parameters:

  | action | ID of the menu action whose menu entry we're looking for
  | menu | Returns the menu number
  | item | Returns the menu item number

virtual void MCCOMAPI IShMenuUtilities::RebuildMainMenus | ( |  | ) | `[pure virtual]`

Posts a rebuild menus action.

virtual MCCOMErr MCCOMAPI IShMenuUtilities::SetCurrentGlobalTool | ( | int32 | inToolID,
|  | boolean | inInvalidate |
| ) |  |  | `[pure virtual]`

Sets the current active global tool.

Parameters:

  | inToolID | ID of the tool to make active
  | inInvalidate | If true, notifies listeners that the tool has changed, causing appropriate redraws

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

- IShUtilities.h