Creating Menu Callback Functions; Example 6.3 - Adobe ACROBAT SDK 8.1 Manual

Developing plug-ins and applications
Table of Contents

Advertisement

Adobe Acrobat SDK
Developing Plug-ins and Applications
After you create a pointer, such as a pointer that points to
ASCallbackCreateProto
function to an Acrobat callback function. For example, you can invoke
convert
ShowMessage
following arguments:
The callback type. For example, you can pass
The address of the user-defined function to convert to a callback function.
The
ASCallbackCreateProto
user-defined function whose address was passed as the second argument. The following code example
shows the
AVExecuteProc
AVExecuteProc ExecProcPtr = NULL;
ExecProcPtr = ASCallbackCreateProto(AVExecuteProc, &ShowMessage);
After you create an
associate a menu command with a callback. That is, when a user selects a specific menu command,
Acrobat or Adobe Reader will invoke the user-defined function whose address was passed to the
ASCallbackCreateProto
parameters:
An
AVMenuItem
An
AVExecuteProc
The address of a user-defined data structure that can be passed to the user-defined function.
When you are done with a menu callback, you can invoke the
memory that it consumes. The following code example creates callback functions for menu commands.

Example 6.3

/* Display a message box */
ACCB1 void ACCB2 ShowMessage (void* data)
{
AVAlertNote ("A menu command was selected.");
}
ACCB1 ASBool ACCB2 ComputeMarkedProc (void* data)
{
ASBool expressionorcondition = true;
if (expressionorcondition)
return true;
else return false;
}
ACCB1 ASBool ACCB2 ComputeEnabledProc (void* data)
{
if (AVAppGetNumDocs() > 0)
return true;
else return false;
}
ACCB1 ASBool ACCB2 PluginInit (void)
{
//Declare menu callbacks
AVExecuteProc ExecProcPtr = NULL;
macro that is defined in the Acrobat core API to convert a user-defined
to a callback function. The
macro returns a callback of the specified type that invokes the
ASCallbackCreateProto
callback.
AVExecuteProc
macro. The
instance that represents the menu command.
that represents the callback function.

Creating menu callback functions

AVExecuteProc
ASCallbackCreateProto
AVExecuteProc
macro converting the
callback, invoke the
AVMenuItemSetExecuteProc
AVMenuItemSetExecuteProc
Creating Menus and Menu Commands
Creating menu callback functions
, you can invoke the
ASCallbackCreateProto
macro requires the
.
user-defined function to a
ShowMessage
method requires the following
ASCallbackDestroy
94
to
method to
method to release

Advertisement

Table of Contents
loading

Table of Contents