InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ITool Class Referenceabstract

#include <ITool.h>

Inheritance diagram for ITool:
IPMUnknownCToolSawWaveToolSineWaveToolSnapTool

Public Types

enum  { kDefaultIID = IID_ITOOL }
 
enum  ToolType {
  kNone = 0, kLayoutSelectionTool = 1, kTextSelectionTool = 2, kTableSelectionTool = 4,
  kLayoutManipulationTool = 8, kTextManipulationTool = 16, kTableManipulationTool = 32, kLayoutCreationTool = 64,
  kTextCreationTool = 128, kTableCreationTool = 256, kPathManipulationTool = 512, kViewModificationTool = 1024,
  kJGridTool = 2048, kPageSelectionTool = 4096
}
 

Public Member Functions

virtual void Init (RsrcID iconID, const PluginID &pluginID)=0
 
virtual void Select ()=0
 
virtual void Deselect ()=0
 
virtual bool IsSelected ()=0
 
virtual ICursorProviderGetCursorProvider () const =0
 
virtual void SetCursorProvider (ICursorProvider *newProvider)=0
 
virtual const PMStringGetName () const =0
 
virtual void SetName (const PMString &newName)=0
 
virtual const PMStringGetToolHint () const =0
 
virtual void SetToolHint (const PMString &newHint)=0
 
virtual const IDFileGetToolIconFile () const =0
 
virtual ActionID GetActionID () const =0
 
virtual void SetActionID (ActionID actionID)=0
 
virtual const ClassIDGetToolType () const =0
 
virtual void SetToolType (const ClassID &newToolType)=0
 
virtual void DisplayOptions ()=0
 
virtual void DisplayAltOptions ()=0
 
virtual bool16 IsCreationTool () const =0
 
virtual bool16 IsSelectionTool () const =0
 
virtual bool16 IsTextTool () const =0
 
virtual bool16 IsToolOfType (ITool::ToolType type) const =0
 
virtual ScriptID GetScriptID () const =0
 
virtual bool16 IsToolNone () const =0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

Basic tool interface. Provides methods to get/set information about a tool, as well as displaying options, selecting and deselecting.

Member Enumeration Documentation

These are the types a tool will support.

A tool can be one of more of the following types depending on what the tool does This is not to be confused with the tool type which is a ClassID as to what group the tool is in

Member Function Documentation

virtual void ITool::Deselect ()
pure virtual

Called when tool is deselected.

Implemented in CTool.

virtual void ITool::DisplayAltOptions ()
pure virtual

Called to display alternate tool options(usually a dialog or nothing)

Implemented in CTool.

virtual void ITool::DisplayOptions ()
pure virtual

Called to display tool options(usually a dialog or nothing)

Implemented in CTool, and SnapTool.

virtual ActionID ITool::GetActionID () const
pure virtual

GetActionID for selecting tool

Returns
action identifier for selecting tool

Implemented in CTool.

virtual ICursorProvider* ITool::GetCursorProvider () const
pure virtual

Get cursor provider for this tool.

Returns
this tool's cursor provider

Implemented in CTool.

virtual const PMString& ITool::GetName () const
pure virtual

Mutator for name of tool.

Returns
name of tool

Implemented in CTool.

virtual ScriptID ITool::GetScriptID () const
pure virtual
        Returns the ScriptID associated with this particular tool such that

        scripts can ask the toolBox for the ScriptID of the current tool. The

        list of ScriptIDs for the toolbox tools are defined by en_ToolBoxTools 

        (kToolBoxEnumScriptElement). That is, when adding a new to to the Tool Box,

        you must first define a new ScriptID and then add it to kToolBoxEnumScriptElement. For

        example, to add scripting support for the pumpkin tool:

        1. Define a ScriptID to represent the tool.

            en_PumpkinTool =                'pmpk',

        2. Add the new constant to the kToolBoxEnumScriptElement by adding the following to your

           plugin's ScriptInfo.fr file.

             resource VersionedScriptElementInfo( 10 )

             {

Contexts { kCS5ScriptVersion, kCoreScriptManagerBoss, kInDesignAllLanguagesFS, k_Wild, } Elements { Enumerator { kToolBoxEnumScriptElement, { en_PumpkinTool, "pumpkin tool", "The pumpkin tool", } } } } ;

  1. Return 'en_PumpkingTool' from the GetScriptID method of the ITool implementation for the pumpkin tool.
Returns
the ScriptID associated with this tool in the en_ToolBoxTools enumeration

Implemented in CTool, SnapTool, SineWaveTool, and SawWaveTool.

virtual const PMString& ITool::GetToolHint () const
pure virtual

Mutator for hint text of tool.

Returns
hint text of tool

Implemented in CTool.

virtual const IDFile& ITool::GetToolIconFile () const
pure virtual

Get the current tool's toolbox icon resource file.

Implemented in CTool.

virtual const ClassID& ITool::GetToolType () const
pure virtual

Get tool type. This type determines which tools are mutually exclusive

Returns
ClassID of tool

Implemented in CTool.

virtual void ITool::Init (RsrcID iconID,
const PluginIDpluginID 
)
pure virtual

Called to initialize tool. Tool should set the icon for it's view, and do any other needed initialization.

Parameters
iconIDresource ID for the icon associated with the tool's view
pluginIDplugin that contains this resource

Implemented in CTool, SnapTool, SineWaveTool, and SawWaveTool.

virtual bool16 ITool::IsCreationTool () const
pure virtual

Does this tool create items?

Parameters
kTrueif items are created, kFalse otherwise

Implemented in CTool.

virtual bool ITool::IsSelected ()
pure virtual

Returns true if the tool is selected, false otherwise

Implemented in CTool.

virtual bool16 ITool::IsSelectionTool () const
pure virtual

Does this tool select items? (i.e. kPointerToolBoss, kDirectSelectToolBoss, kCropToolBoss).

Parameters
kTrueif tool selects items, kFalse otherwise

Implemented in CTool.

virtual bool16 ITool::IsTextTool () const
pure virtual

Does this tool select text? This function could be more accurately be called DoesToolDeactivateTextEditor. For example, in addition to the kIBeamToolBoss, the kZoomToolBoss, kGradientToolBoss, kGrabberHandToolBoss also return kTrue for this function. Use IsToolOfType in conjuction with kTextSelectionTool for traditional "text" tools that select text.

Implemented in CTool.

virtual bool16 ITool::IsToolNone () const
pure virtual
 Returns bool16 whether the tool is this none tool i.e. ITool::kNone

Returns
kTrue if the given tool is of type ITool::kNone

Implemented in CTool.

virtual bool16 ITool::IsToolOfType (ITool::ToolType type) const
pure virtual

Returns bool16 whether the tool is this type of tool

Parameters
typespecifies type to compare this tool against
Returns
kTrue if the given 'type' is the same type as this tool

Implemented in CTool.

virtual void ITool::Select ()
pure virtual

Called when tool is selected.

Implemented in CTool.

virtual void ITool::SetActionID (ActionID actionID)
pure virtual

Set ActionID for selecting tool

Parameters
actionIDnew action identifier

Implemented in CTool.

virtual void ITool::SetCursorProvider (ICursorProvidernewProvider)
pure virtual

Set cursor provider for this tool

Parameters
newProviderspecifies ICursorProvider for the tool

Implemented in CTool.

virtual void ITool::SetName (const PMStringnewName)
pure virtual

Accessor for name

Parameters
newName

Implemented in CTool.

virtual void ITool::SetToolHint (const PMStringnewHint)
pure virtual

Accessor for tool hint

Parameters
newHint

Implemented in CTool.

virtual void ITool::SetToolType (const ClassIDnewToolType)
pure virtual

Set tool type. This type determines which tools are mutually exclusive

Parameters
newToolTypenew ClassID for tool

Implemented in CTool.