Adobe.com
Contents Suites Classes Class Index Member Index

AIMenuSuite Struct Reference
[API Suite List]

This suite provides functions that allow you to add menu items to the Illustrator menu structure. More...

#include <AIMenu.h>

List of all members.

Public Attributes

AIAPI AIErr(* AddMenuItem )(SPPluginRef self, const char *inKeyboardShortDictionaryKey, AIPlatformAddMenuItemDataUS *data, AIMenuItemOption options, AIMenuItemHandle *menuItem)
 Creates and installs a plug-in menu item.
AIAPI AIErr(* AddMenuItemZString )(SPPluginRef self, const char *inKeyboardShortDictionaryKey, const char *groupName, ZRef itemText, AIMenuItemOption options, AIMenuItemHandle *menuItem)
 Creates and installs a plug-in menu item using a ZString display label.
AIAPI AIErr(* GetMenuItemKeyboardShortcutDictionaryKey )(AIMenuItemHandle menuItem, const char **outKey)
 Retrieves the keyboardshortcut dictionary key of a menu item.
AIAPI AIErr(* GetMenuItemOptions )(AIMenuItemHandle menuItem, AIMenuItemOption *options)
 Retrieves the option flags of a menu item.
AIAPI AIErr(* SetMenuItemOptions )(AIMenuItemHandle menuItem, AIMenuItemOption options)
 Set the option flags for a menu item.
AIAPI AIErr(* GetMenuItemPlugin )(AIMenuItemHandle menuItem, SPPluginRef *plugin)
 Retrieves the plug-in that installed a menu item.
AIAPI AIErr(* CountMenuItems )(ai::int32 *count)
 Gets the number of installed menu items.
AIAPI AIErr(* GetNthMenuItem )(ai::int32 n, AIMenuItemHandle *menuItem)
 Retrieves an installed menu item by index position.
AIAPI AIErr(* GetPlatformMenuItem )(AIMenuItemHandle menuItem, AIPlatformMenuItem *platformMenuItem)
 Retrieves the platform-specific menu item reference associated with a menu item.
AIAPI AIErr(* UpdateMenuItemAutomatically )(AIMenuItemHandle menuItem, ai::int32 action, ai::int32 ifObjectIsInArtwork, ai::int32 ifObjectIsNotInArtwork, ai::int32 ifObjectIsSelected, ai::int32 ifObjectIsNotSelected, ai::int32 ifIsTrue, ai::int32 ifIsNotTrue)
 Updates a menu item's appearance automatically when specified conditions are met.
AIAPI AIErr(* GetUpdateFlags )(ai::int32 *inArtwork, ai::int32 *isSelected, ai::int32 *isTrue)
 Retrieves document and artwork state information that you can use to update a menu item�s checked or enabled state.
AIAPI AIErr(* EnableItem )(AIMenuItemHandle menuItem)
 Enables a menu item.
AIAPI AIErr(* DisableItem )(AIMenuItemHandle menuItem)
 Disables (grays out) a menu item.
AIAPI AIErr(* GetItemText )(AIMenuItemHandle menuItem, ai::UnicodeString &itemString)
 Retrieves the localizable display label of a menu item.
AIAPI AIErr(* SetItemText )(AIMenuItemHandle menuItem, const ai::UnicodeString &itemString)
 Sets the localizable display label of a menu item using a Unicode string.
AIAPI AIErr(* SetItemTextZString )(AIMenuItemHandle menuItem, ZRef itemString)
 Sets the localizable display label of a menu item using a ZString.
AIAPI AIErr(* CheckItem )(AIMenuItemHandle menuItem, AIBoolean bCheckIt)
 Sets the checked state of a menu item.
AIAPI AIErr(* GetItemMenuGroup )(AIMenuItemHandle menuItem, AIMenuGroup *group)
 Retrieves the menu group to which a menu item belongs.
AIAPI AIErr(* AddMenuGroup )(const char *name, AIMenuGroupOption options, const char *nearGroup, AIMenuGroup *group)
 Creates a new menu group, to which you can add your plug-in menu items.
AIAPI AIErr(* AddMenuGroupAsSubMenu )(const char *name, AIMenuGroupOption options, AIMenuItemHandle menuItem, AIMenuGroup *group)
 Adds a new menu group as a submenu.
AIAPI AIErr(* GetMenuGroupName )(AIMenuGroup group, const char **name)
 Retrieves the unique identifying name of a menu group.
AIAPI AIErr(* GetMenuGroupOptions )(AIMenuGroup group, AIMenuGroupOption *options)
 Retrieves the option flags of a menu group.
AIAPI AIErr(* SetMenuGroupOptions )(AIMenuGroup group, AIMenuGroupOption options)
 Sets the option flags of a menu group.
AIAPI AIErr(* GetMenuGroupRange )(AIMenuGroup group, AIPlatformMenuHandle *theMenu, ai::int16 *firstItem, ai::int16 *numItems)
 Retrieves a reference to the platform-specific menu structure for a menu with the range of items that belong to a menu group.
AIAPI AIErr(* CountMenuGroups )(ai::int32 *count)
 Gets the number of installed menu groups.
AIAPI AIErr(* GetNthMenuGroup )(ai::int32 n, AIMenuGroup *group)
 Retrieves a menu group by position index.
AIAPI AIErr(* GetItemCmd )(AIMenuItemHandle menuItem, ai::int16 *cmdChar, ai::int16 *modifiers)
 Retrieves the command character and modifier keys that act as the keyboard shortcut for a menu item.
AIAPI AIErr(* SetItemCmd )(AIMenuItemHandle menuItem, char cmdChar, ai::int16 modifiers)
 Sets the command character and modifier keys that act as the keyboard shortcut for a menu item.
AIAPI AIErr(* GetItemFunctionKey )(AIMenuItemHandle menuItem, ai::int16 *fkey, ai::int16 *modifiers)
 Retrieves the function key and modifiers associated with a menu item.
AIAPI AIErr(* SetItemFunctionKey )(AIMenuItemHandle menuItem, ai::int16 fkey, ai::int16 modifiers)
 Sets the function key and modifiers associated with a menu item.
AIAPI AIErr(* IsItemEnabled )(AIMenuItemHandle menuItem, ASBoolean *bEnabled)
 Reports whether a menu item is enabled.
AIAPI AIErr(* IsItemChecked )(AIMenuItemHandle menuItem, AIBoolean *bCheckIt)
 Reports whether a menu item is checked.
AIAPI AIErr(* RemoveMenuItem )(AIMenuItemHandle menuItem)
 Deletes a menu item.
AIAPI AIErr(* SetMenuGroupHeader )(AIMenuGroup inGroup, const ai::UnicodeString &inHeader)
 Sets the header for a menu group.
AIAPI AIErr(* InvokeMenuAction )(AICommandID menuCmdID)
 Programmatically invokes a menu action, as if the user had clicked the menu item.

Detailed Description

This suite provides functions that allow you to add menu items to the Illustrator menu structure.

A menu can be a stand alone interface to a plug-in feature, or group a number of features together. Plug-ins of all types can have an associated plug-in menu item. For instance, if you define a palette (non-modal dialog box), you typically add a menu item to the Windows menu to hide and show your window.

This section describes how to install and use plug-in menu items. It discusses the caller, selectors and messages that plug-in menus receive, as well as the functions provided to add menus, set options, and control menu appearance, and to make simple appearance changes automatically based on the changes in artwork.

Menu plug-ins are similar to Filter plug-ins (see the AIFilterSuite), but are different in these ways:

  • Filter plug-ins are added to the Filter menu, while menu plug-ins can add commands to any menu.
  • Filters have automatic repeat and undo, while menu plug-ins must set the Undo menu item text.
  • Menu plug-ins can set command keys and control their appearance.
  • Both plug-in types receive a go selector, but Filters also receive a selector to get parameters.

This suite is cross-platform (although the functions closely parallel the Mac OS toolbox functions for changing menu appearance). If you must manipulate a menu item directly, use GetPlatformMenuItem() to obtain a platform-specific menu reference.

Menu Selectors

The caller for menu plug-ins is kCallerAIMenu. Check for the caller and these selectors in the plug-in's main function:
kSelectorAIGoMenuItem
kSelectorAIUpdateMenuItem

The message data for both selectors is passed in an AIMenuMessage.

Menu Notifiers

The notifier kAIMenuChangedNotifier is sent when a menu is modified.

Notifiers are available before and after menu commmands are executed.

  • The pre- and post-menu notifiers for Illustrator commands do not have predefined constants. Instead, the notification identification string is generated dynamically, in the following format:

    "AI Command Notifier: Before " + menu identifier text
    "AI Command Notifier: After " + menu identifier text

    The menu identifiers are defined in AIMenuCommandNotifiers.h.

Menu Groups

Plug-in menu items are added to menu groups, which are predefined locations within Illustrator�s menu structure. The complete list of groups is found in the AIMenuGroups.h. Some examples of menu groups are:

kOpenMenuGroup
kArrangeMoveMenuGroup
kTypeSizeMenuGroup

The names describe the menu location. A utilities group is located at the top to a menu group; for instance, the "Type Size Utilities" menu group is at the top of the "Type Size" submenu.

You can create new menu groups, to which your plug-in or other plug-ins can add menu items. As a plug-in developer, you are responsible for documenting any menu groups you add.

Plug-in Menu Groups

To use a menu group added by a plug-in (rather than the application), your plug-in should explicitly add the group, using AddMenuGroup(). If is safe to add a menu group twice; the second call returns the existing group reference. The following predefined groups are added by plug-ins:

kDocInfoMenuGroup
kObjectRasterMenuGroup
kArrangeTransformMultipleMenuGroup
kATMMenuGroupNearGroup
kObjectPathsPopoutPluginMenuGroup
kOPPPMenuGroupNearGroup
kDocumentSupportMenuGroup
kAssetMgmtMenuGroup
kWorkgroupMenuGroup
kScriptsMenuGroup
kWorkspacesMenuGroup
kWorkspacesPresetsMenuGroup
kWorkspacesCustomMenuGroup

Note:
The kFilterUtilities menu is implemented using an internal plug-in. To use it, you must acquire the AIFilterSuite.

Member Data Documentation

AIAPI AIErr(* AIMenuSuite::AddMenuGroup)(const char *name, AIMenuGroupOption options, const char *nearGroup, AIMenuGroup *group)

Creates a new menu group, to which you can add your plug-in menu items.

If the group already exists, returns the group reference. See Menu Groups.

Parameters:
name The unique identifying name, which can be passed to AddMenuItem().
options Flags that control the behavior of the menu group, a logical OR of AIMenuGroupOption values.
nearGroup An existing menu group for relative placement of this group. The new group is added below this one, unless the options include kMenuGroupAddAboveNearGroup, in which case it is added above this one.

If this is a submenu created by AddMenuGroupAsSubMenu(), the new menu group becomes part of that submenu, and is added above or below other menu items or groups that were previously added to the submenu, depending on the options.

Parameters:
group [out] A buffer in which to return the menu group object.
Returns:
The error kBadParameterErr if the relative group does not yet exist. The loading order of plug-ins is indeterminate; if the relative group is one that might be created by a different plug-in, your plug-in should check for an error and either create the group or add near a different group. It is all right to add the same group multiple times.
AIAPI AIErr(* AIMenuSuite::AddMenuGroupAsSubMenu)(const char *name, AIMenuGroupOption options, AIMenuItemHandle menuItem, AIMenuGroup *group)

Adds a new menu group as a submenu.

A submenu can be updated programmatically or automatically, like a top-level menu. Nested submenus are allowed.

Parameters:
name The unique identifying name, which can be passed to AddMenuItem().
options Flags that control the behavior of the menu group, a logical OR of AIMenuGroupOption values.
menuItem The menu item that invokes this submenu.
group [out] A buffer in which to return the menu group object.
AIAPI AIErr(* AIMenuSuite::AddMenuItem)(SPPluginRef self, const char *inKeyboardShortDictionaryKey, AIPlatformAddMenuItemDataUS *data, AIMenuItemOption options, AIMenuItemHandle *menuItem)

Creates and installs a plug-in menu item.

Parameters:
self This plug-in.
inKeyboardShortDictionaryKey A unique identifying name for this item in the keyboardshortcut dictionary, or NULL if the item is dynamic or has no shortcut.
data The menu group to which the item is added, and the display label for the item as a Unicode string.
options Flags that control the item's behavior, a logical OR of AIMenuItemOption values.
menuItem [out] A buffer in which to return the menu item object. If your plug-in installs multiple items, store this in globals to compare when receiving a notification or selector. May be NULL.
AIAPI AIErr(* AIMenuSuite::AddMenuItemZString)(SPPluginRef self, const char *inKeyboardShortDictionaryKey, const char *groupName, ZRef itemText, AIMenuItemOption options, AIMenuItemHandle *menuItem)

Creates and installs a plug-in menu item using a ZString display label.

Parameters:
self This plug-in.
inKeyboardShortDictionaryKey A unique identifying name for this item in the keyboardshortcut dictionary, or NULL if the item is dynamic or has no shortcut.
groupName The menu group to which the item is added.
data The ZString display label for the item.
options Flags that control the item's behavior, a logical OR of AIMenuItemOption values.
menuItem [out] A buffer in which to return the menu item object. If your plug-in installs multiple items, store this in globals to compare when receiving a notification or selector.

Sets the checked state of a menu item.

Parameters:
menuItem The menu item object.
bCheckIt True to check the item, false to uncheck it.
AIAPI AIErr(* AIMenuSuite::CountMenuGroups)(ai::int32 *count)

Gets the number of installed menu groups.

Use with GetNthMenuGroup() to iterate through all menu groups.

Parameters:
count [out] A buffer in which to return the number of groups.
AIAPI AIErr(* AIMenuSuite::CountMenuItems)(ai::int32 *count)

Gets the number of installed menu items.

Use with GetNthMenuItem() to iterate through items.

Parameters:
count [out] A buffer in which to return the number of items. May be NULL.

Disables (grays out) a menu item.

Parameters:
menuItem The menu item object.

Enables a menu item.

Parameters:
menuItem The menu item object.
AIAPI AIErr(* AIMenuSuite::GetItemCmd)(AIMenuItemHandle menuItem, ai::int16 *cmdChar, ai::int16 *modifiers)

Retrieves the command character and modifier keys that act as the keyboard shortcut for a menu item.

Parameters:
menuItem The menu item object.
cmdChar [out] A buffer in which to return the command character (keyboard shortcut).
modifiers [out] A buffer in which to return the command character modifiers, a logical OR of AIMenuItemModifier constants.
Note:
Submenus created by plug-ins do not support modified command keys.
AIAPI AIErr(* AIMenuSuite::GetItemFunctionKey)(AIMenuItemHandle menuItem, ai::int16 *fkey, ai::int16 *modifiers)

Retrieves the function key and modifiers associated with a menu item.

Parameters:
menuItem The menu item object.
fkey [out] A buffer in which to return the function key.
modifiers [out] A buffer in which to return the function key modifiers, a logical OR of AIMenuItemModifier constants.

Retrieves the menu group to which a menu item belongs.

Parameters:
menuItem The menu item object.
group [out] A buffer in which to return the menu group.

Retrieves the localizable display label of a menu item.

This is different from the unique identifying name returned by GetMenuItemKeyboardShortcutDictionaryKey().

Parameters:
menuItem The menu item object.
itemString [out] A buffer in which to return the label string.
AIAPI AIErr(* AIMenuSuite::GetMenuGroupName)(AIMenuGroup group, const char **name)

Retrieves the unique identifying name of a menu group.

Parameters:
group The menu group object.
name [out] A buffer in which to return the name string. Do not modify.

Retrieves the option flags of a menu group.

Parameters:
group The menu group object.
options [out] A buffer in which to return the options, a logical OR of AIMenuGroupOption values.
AIAPI AIErr(* AIMenuSuite::GetMenuGroupRange)(AIMenuGroup group, AIPlatformMenuHandle *theMenu, ai::int16 *firstItem, ai::int16 *numItems)

Retrieves a reference to the platform-specific menu structure for a menu with the range of items that belong to a menu group.

Parameters:
group The menu group object.
theMenu [out] A buffer in which to return the platform-specific menu information. The menu handle is a MenuInfo structure in Mac OS, a WinMenu structure in Windows.
firstItem [out] A buffer in which to return the index of the first item in the group.
numItems [out] A buffer in which to return the number of items in the group.

Retrieves the keyboardshortcut dictionary key of a menu item.

Parameters:
menuItem The menu item object.
outKey [out] A buffer in which to return the key string. Do not modify.

Retrieves the option flags of a menu item.

Parameters:
menuItem The menu item object.
options [out] A buffer in which to return the options, a logical OR of AIMenuItemOption values.

Retrieves the plug-in that installed a menu item.

Parameters:
menuItem The menu item object.
options [out] A buffer in which to return the plug-in object.
AIAPI AIErr(* AIMenuSuite::GetNthMenuGroup)(ai::int32 n, AIMenuGroup *group)

Retrieves a menu group by position index.

Use with CountMenuGroups() to iterate through all menu groups.

Parameters:
n The position index, in the range [0..numGroups-1].
group [out] A buffer in which to return the menu group object.
AIAPI AIErr(* AIMenuSuite::GetNthMenuItem)(ai::int32 n, AIMenuItemHandle *menuItem)

Retrieves an installed menu item by index position.

Use with CountMenuItems() to iterate through items.

Parameters:
n The position index, in the range [0..numItems-1].
menuItem [out] A buffer in which to return the menu item object.

Retrieves the platform-specific menu item reference associated with a menu item.

Parameters:
menuItem The menu item object.
platformMenuItem [out] A buffer in which to return the platform-specific object. The menu handle is a MenuInfo structure in Mac OS, a WinMenu structure in Windows.
AIAPI AIErr(* AIMenuSuite::GetUpdateFlags)(ai::int32 *inArtwork, ai::int32 *isSelected, ai::int32 *isTrue)

Retrieves document and artwork state information that you can use to update a menu item�s checked or enabled state.

This is faster than scanning the artwork tree or getting specific art, as Illustrator has already computed the information for automatic menu updates.

Call this only when the kSelectorAIUpdateMenuItem selector is received. The information is invalid if the call is made at any other time. The kMenuItemWantsUpdateOption option must be set for the plug-in to receive this selector.

Parameters:
inArtwork [out] A buffer in which to return a set of flags for types of art that are contained in the current document's artwork tree. A logical OR of AIAutoMenuUpdateObjectCriteria values.
isSelected [out] A buffer in which to return a set of flags for types of art that are contained in the current document's selection. A logical OR of AIAutoMenuUpdateObjectCriteria values.
isTrue [out] A buffer in which to return a set of flags for document properties that are true for the current document. A logical OR of AIAutoMenuUpdatePropertyCriteria values.

Programmatically invokes a menu action, as if the user had clicked the menu item.

Parameters:
menuCmdID The command ID for the menu item.

Reports whether a menu item is checked.

Parameters:
menuItem The menu item object.
bCheckIt [out] A buffer in which to return true if the item is checked, false if it is unchecked.

Reports whether a menu item is enabled.

Parameters:
menuItem The menu item object.
bEnables [out] A buffer in which to return true if the item is enabled, false if it is disabled (grayed).

Deletes a menu item.

Parameters:
menuItem The menu item object. After the call, this reference is invalid.
AIAPI AIErr(* AIMenuSuite::SetItemCmd)(AIMenuItemHandle menuItem, char cmdChar, ai::int16 modifiers)

Sets the command character and modifier keys that act as the keyboard shortcut for a menu item.

Parameters:
menuItem The menu item object.
cmdChar The command character (keyboard shortcut).
modifiers The command character modifiers, a logical OR of AIMenuItemModifier constants.
Note:
Submenus created by plug-ins do not support modified command keys.
AIAPI AIErr(* AIMenuSuite::SetItemFunctionKey)(AIMenuItemHandle menuItem, ai::int16 fkey, ai::int16 modifiers)

Sets the function key and modifiers associated with a menu item.

Parameters:
menuItem The menu item object.
fkey The function key, in the range [1..15].
modifiers The function key modifiers, a logical OR of AIMenuItemModifier constants.
AIAPI AIErr(* AIMenuSuite::SetItemText)(AIMenuItemHandle menuItem, const ai::UnicodeString &itemString)

Sets the localizable display label of a menu item using a Unicode string.

Parameters:
menuItem The menu item object.
itemString The new label string.

Sets the localizable display label of a menu item using a ZString.

Parameters:
menuItem The menu item object.
itemString The new label ZString.

Sets the header for a menu group.

When a menu has a header, the kMenuGroupHasHeader option flag is set for the group, and the menu contains a non-selectable item for which the kMenuItemIsGroupHeader option flag is set. All other items in the group are shown below and indented from the header text.

Parameters:
inGroup The menu group object.
inHeader The header string, or an empty string to remove the group header.

Sets the option flags of a menu group.

Parameters:
group The menu group object.
options The new options, a logical OR of AIMenuGroupOption values.

Set the option flags for a menu item.

Parameters:
menuItem The menu item object.
options The options, a logical OR of AIMenuItemOption values.
AIAPI AIErr(* AIMenuSuite::UpdateMenuItemAutomatically)(AIMenuItemHandle menuItem, ai::int32 action, ai::int32 ifObjectIsInArtwork, ai::int32 ifObjectIsNotInArtwork, ai::int32 ifObjectIsSelected, ai::int32 ifObjectIsNotSelected, ai::int32 ifIsTrue, ai::int32 ifIsNotTrue)

Updates a menu item's appearance automatically when specified conditions are met.

You can either enable/disable, or check/uncheck the item with one call; you cannot perform both types of update at once.

All criteria are evaluated and the results combined with a logical AND to decide whether to make the specified appearance modification.

  • The results of the positive criteria are combined to produce a positive result, which is true if any of the positive criteria are true.
  • The results of the negative criteria are combined to produce a negative result, which is true if none of the negative criteria are true.
  • The combined result used to perform the update action is true if both the positive and negative results are true--that is, if any of the desired properties are present and none of the undesired properties are present.
Parameters:
menuItem The menu item object.
action The action to take when criteria are satisfied. An AIAutoMenuUpdateAction value.
ifObjectIsInArtwork Update if any object matching any specified type appears in the current document's artwork tree. A logical OR of AIAutoMenuUpdateObjectCriteria values.
ifObjectIsNotInArtwork Update if no object matching any specified type appears in the current document's artwork tree. A logical OR of AIAutoMenuUpdateObjectCriteria values.
ifObjectIsSelected Update if any object matching any specified type appears in the current document's selection. A logical OR of AIAutoMenuUpdateObjectCriteria values.
ifObjectIsNotSelected Update if no object matching any specified type appears in the current document's selection. A logical OR of AIAutoMenuUpdateObjectCriteria values.
ifIsTrue Update if any of the specified document properties are true for the current document. A logical OR of AIAutoMenuUpdatePropertyCriteria values.
ifIsNotTrue Update if none of the specified document properties are true for the current document. A logical OR of AIAutoMenuUpdatePropertyCriteria values.

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


Contents Suites Classes Class Index Member Index
Adobe Solutions Network
 
Copyright © 2014 Adobe Systems Incorporated. All rights reserved.
Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks