Creating Menu Callback Functions - Adobe ACROBAT SDK 8.1 Manual

Developing plug-ins and applications
Table of Contents

Advertisement

Adobe Acrobat SDK
Developing Plug-ins and Applications
//Attach the menu item to the menu and the menu to
//the menu bar
AVMenuAddMenuItem (NewMenu, NewMenuCommand, 0);
AVMenubarAddMenu (Themenubar, NewMenu, APPEND_MENU);
//Release the typedef instances
AVMenuItemRelease(NewMenuCommand);
AVMenuRelease(NewMenu);
Note:
If you plan to add a submenu to a menu command, you must create the submenu before creating
the menu command.

Creating menu callback functions

When creating menus, you must create menu callback functions that are invoked by Adobe Reader or
Acrobat. Three types of callback functions can be created:
Execute: Invoked by Adobe Reader or Acrobat in response to a user selecting a menu command. This
callback is required.
Compute-enabled: This optional callback is invoked by Adobe Reader or Acrobat when determining
whether or not to enable the menu command.
Compute-marked: This optional callback is invoked by Adobe Reader or Acrobat when determining
whether or not the menu command should be checked.
For the purpose of this discussion, a simplistic user-defined function named
This method displays a message box by invoking the
shows the body of the
ACCB1 void ACCB2 ShowMessage (void* data)
{
AVAlertNote ("A menu command was selected.");
}
The data parameter (for this and the other callbacks) can be used to maintain private data for the menu
command. Notice that this user-defined function is declared using the
information, see
For each callback that you create, you declare pointers to callbacks that are defined in the Acrobat core
API:
AVExecuteProc ExecProcPtr = NULL;
AVComputeEnabledProc CompEnabledProcPtr = NULL;
AVComputeMarkedProc CompMarkedProcPtr = NULL;
AVExecuteProc
selects a menu item.
Reader or Acrobat when determining whether or not to enable the menu command.
AVComputeMarkedProc
when determining whether or not the menu command should be checked.
function.
ShowMessage
"Using callback functions" on page
is a callback that you can create that is invoked by Acrobat or Adobe Reader when a user
AVComputeEnabledProc
is a callback that you can create that is invoked by Adobe Reader or Acrobat
Creating Menus and Menu Commands
method. The following code example
AVAlertNote
ACCB1
30.
is a callback that you can create that is invoked by Adobe
Creating menu callback functions
is introduced.
ShowMessage
and
macros. For
ACCB2
93

Advertisement

Table of Contents
loading

Table of Contents