
Adobe Acrobat SDK
Creating Handlers
Developing Plug-ins and Applications
Tool callbacks 147
For a complete list of the callbacks in a selection server, see the description of
AVDocSelectionServer
in the
Acrobat and PDF Library API Reference
.
Note:
The SelectionServer sample plug-in that is located in the Acrobat SDK shows an example of a
selection server.
Tool callbacks
To add a new tool, you must provide a set of callbacks, specify them in the
AVTool
data structure, and
register them using
AVAppRegisterTool
. By using tool callbacks, you can perform the following tasks:
●
Activate the tool when the tool is selected by using the
ActivateProcType
callback method.
●
Deactivate the tool when another tool is selected by using the
DeactivateProcType
callback
method.
●
Handle mouse clicks by using the
DoClickProcType
callback method.
●
Handle key presses by using the
DoKeyDownProcType
callback method.
●
Control the cursor shape by using the
AdjustCursorProcType
callback method.
●
Return the tool’s name by using the
GetTypeProcType
callback method.
●
Indicate whether the tool stays active after it is used by using the
IsPersistentProcType
callback
method.
●
Determine whether the tool is enabled by using the
AVComputeEnabledProc
callback method. For
example, if a tool is meant to be used within documents, but there are no documents open, it does not
make sense to activate the tool.
Note:
For a complete list of callbacks, see the description of
AVTool
in the
Acrobat and PDF Library API
Reference
.
Window handlers
When a plug-in creates a window, it can register the window, so that it behaves like other windows in
Acrobat; for example, when Adobe Reader or Acrobat is minimized or hidden. For each window that a
plug-in provides, a window handler must be provided. Window handlers are used only in the Mac OS
version of Adobe Reader or Acrobat. Windows and UNIX versions of Acrobat instead use the platform’s
native window handling mechanisms. For information, see
“Opening a PDF document in an external
window” on page 74
.
To define a window handler, you must provide a set of callbacks, specify them in an
AVWindowHandler
structure, and pass the structure to
AVWindowNew
or
AVWindowNewFromPlatformThing
. The window
handler’s callbacks are automatically called by Acrobat. Default behavior is used for any missing callbacks.
By using a window handler, you can perform the following tasks:
●
Handle mouse clicks in the window by using the
AVWindowMouseDownProc
callback method.
●
Handle keystrokes in the window by using the
AVWindowKeyDownProc
callback method.
●
Draw the window’s contents by using the
AVWindowDrawProc
callback method.
●
Permit or prevent closing of the window by using the
AVWindowWillCloseProc
callback method.
●
Clean up after the window has been closed by using the
AVWindowDidCloseProc
callback method.