
Adobe Acrobat SDK
Creating Menus and Menu Commands
Developing Plug-ins and Applications
About AVmenubar typedefs 89
About AVmenubar typedefs
An
AVmenubar
typedef represents the menu bar located within Adobe Reader or Acrobat and contains a
list of all menus. A plug-in can only have one
AVmenubar
object. You can add new menus to the menu bar,
remove menus from the menu bar, or hide the menu bar by using the Acrobat core API.
About AVMenu typedefs
An
AVMenu
typedef represents a menu in the Adobe Reader or Acrobat menu bar. You can create new
menus, add menu commands to a menu, and remove menu items. Deleting an
AVMenu
removes it from
the menu bar (if it was attached) and deletes all the menu items it contains.
Submenus (also called pull right menus) are
AVMenu
objects that are attached to an
AVMenuItem
object
instead of to the menu bar.
Each menu has a title and a language-independent name. The title is the string that appears in the user
interface, while the language-independent name is the same regardless of the language used in the user
interface. Language-independent names enable a plug-in to locate a specific menu, such as the File menu,
without knowing, for example, that it is called Fichier in French.
You are strongly encouraged to begin your language-independent menu names with the plug-in name
(separated by a colon) to avoid name collisions when more than one plug-in is present. For example, if a
plug-in is named myPlug, it might add a menu whose name is
myPlug:Options
. For information, see
“Using plug-in prefixes” on page 31
.
About AVMenuItem typedefs
An
AVMenuItem
is a menu command within a menu. It contains the following attributes:
●
A name
●
A keyboard shortcut
●
A callback function to execute when the menu item is selected
●
A callback function to compute whether the menu item is enabled
●
A callback function to compute whether the menu item is checkmarked, and whether it has a submenu
An
AVMenuItem
object can also serve as a separators between menu commands. You are encouraged to
position your plug-in menu commands relative to a separator. This helps ensure that if a block of menu
commands is moved in a future version of Acrobat, your plug-in menu commands also are moved.
A plug-in can simulate a user selecting a menu command by invoking the
AVMenuItemExecute
method. If
the menu command is disabled, the
AVMenuItemExecute
method returns without performing a task. The
AVMenuItemExecute
method works even when the menu item is not displayed (for example, if it has not
been attached to a menu or if the menu bar is not visible). You can set the attributes of all menu commands
that you create; however, do not modify the
Execute
procedure of the Acrobat built-in menu commands.
Your plug-in can specify menu command names using either the names seen by a user, or
language-independent names. The latter allows your plug-in to locate a specific menu command without
knowing, for example, that it is called Imprimer in French.
You are strongly encouraged to avoid name collisions when naming menu commands by using your
plug-in name and a colon. For example, if a plug-in is named
myPlug
, you can name a menu command
myPlug:Open
or
myPlug:Find
. For information, see
“Using plug-in prefixes” on page 31
.