InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CTool Class Reference

#include <CTool.h>

Inheritance diagram for CTool:
IToolIPMUnknownSawWaveToolSineWaveToolSnapTool

Public Member Functions

 CTool (IPMUnknown *boss)
 
 CTool (IPMUnknown *boss, int32 toolInfo, bool16 isCreation, bool16 isSelection)
 
virtual void ReadWrite (IPMStream *s, ImplementationID prop)
 
virtual void Init (RsrcID iconID, const PluginID &pluginID)
 
virtual void InitWidget (const WidgetID &widgetId, RsrcID iconID, const PluginID &pluginID, PMRect toolRect=kStandardToolRect)
 
virtual void Select ()
 
virtual void Deselect ()
 
virtual bool IsSelected ()
 
virtual ICursorProviderGetCursorProvider () const
 
virtual void SetCursorProvider (ICursorProvider *newProvider)
 
virtual bool16 IsCreationTool () const
 
virtual bool16 IsSelectionTool () const
 
virtual bool16 IsTextTool () const
 
virtual const PMStringGetName () const
 
virtual void SetName (const PMString &newName)
 
virtual const PMStringGetToolHint () const
 
virtual void SetToolHint (const PMString &newHint)
 
virtual const IDFileGetToolIconFile () const
 
virtual const ClassIDGetToolType () const
 
virtual void SetToolType (const ClassID &newToolType)
 
virtual ActionID GetActionID () const
 
virtual void SetActionID (ActionID action)
 
virtual void DisplayOptions ()
 
virtual void DisplayAltOptions ()
 
virtual bool16 IsToolOfType (ITool::ToolType toolInformation) const
 
virtual ScriptID GetScriptID () const
 
virtual bool16 IsToolNone () const
 

Protected Member Functions

virtual PMString BuildHintString (PMString &theDescriptionString, PMString &theShiftHint, PMString &theCommandCtrlHint, PMString &theOptionAltHint, PMString &theArrowsHint, PMString &extrasString)
 
virtual PMString BuildHintString (PMString &theDescriptionString, PMString &theShiftHint, PMString &theCommandCtrlHint, PMString &theOptionAltHint, PMString &theArrowsHint, K2Vector< PMString > &theExtraModifiersHint, PMString &extrasString)
 

Protected Attributes

ICursorProviderfCursorProvider
 
bool16 fIsCreation
 
bool16 fIsSelection
 
ClassID fToolType
 
int32 fToolInformation
 
bool fSelected
 

Additional Inherited Members

- Public Types inherited from ITool
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
}
 

Detailed Description

Base implementation for tools. Clients implementing a new tool typically subclass CTool and override just the methods they need to. Most tool implementations only override a few methods: Init, sometimes DisplayOptions.

Member Function Documentation

virtual void CTool::Deselect ()
virtual

Subclasses which override this method should call this Deselect before doing anything – it notifies the selection that the tool is changing

Implements ITool.

virtual void CTool::DisplayAltOptions ()
virtual

Display some UI for users to choose additional tool options. CTool does not implement. Subclasses that have a second set of options they'd like to display typically implement this method to invoke some sort of options dialog.

Implements ITool.

virtual void CTool::DisplayOptions ()
virtual

Display some UI for users to choose tool options. CTool does not implement. Subclasses that have options they'd like to display typically implement this method to invoke some sort of options dialog.

Implements ITool.

Reimplemented in SnapTool.

virtual ActionID CTool::GetActionID () const
virtual

Get action for shortcut for selecting tool. This method is fully implemented by CTool. Subclasses usually have no need to override.

Implements ITool.

virtual ICursorProvider* CTool::GetCursorProvider () const
virtual

Get the cursor provider for this tool. CTool fully implements this. Usually subclasses don't need to override this.

Implements ITool.

virtual const PMString& CTool::GetName () const
virtual

Get the name of the tool. Fully implemented by CTool. Subclasses usually have no need to override.

Implements ITool.

virtual ScriptID CTool::GetScriptID () const
inlinevirtual

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).

Returns
the ScriptID associated with this tool in the en_ToolBoxTools enumeration

Implements ITool.

Reimplemented in SnapTool, SineWaveTool, and SawWaveTool.

virtual const PMString& CTool::GetToolHint () const
virtual

Get the tool hint of the tool.

Implements ITool.

virtual const IDFile& CTool::GetToolIconFile () const
virtual

Get the current tool's toolbox icon resource file.

Implements ITool.

virtual const ClassID& CTool::GetToolType () const
virtual

Get tool type. This type determines which tools are mutually exclusive. The ClassID for the tool type is defined to be the ClassID of the default tool for that type. Traditional tools in the toolbox have a tooltype of kPointerToolBoss. This method is fully implemented by CTool. Subclasses usually have no need to override.

Implements ITool.

virtual void CTool::Init (RsrcID iconID,
const PluginIDpluginID 
)
virtual

CTool does nothing in Init. Custom tool impls typically override this method and call SetName("My Tool") and InitWidget(kMyToolWidgetId, iconID, pluginID);

Implements ITool.

Reimplemented in SnapTool, SineWaveTool, and SawWaveTool.

virtual void CTool::InitWidget (const WidgetIDwidgetId,
RsrcID iconID,
const PluginIDpluginID,
PMRect toolRect = kStandardToolRect 
)
virtual

CTool implements this to initialize the associated control view with the passed in WidgetID & icon/PNG.

virtual bool16 CTool::IsCreationTool () const
virtual

Check if this tool is a creation tool. Subclasses can specify this in the constructor call to CTool, so CTool is able to implement this fully.

Implements ITool.

virtual bool CTool::IsSelected ()
virtual

Returns true if the tool is selected, false otherwise

Implements ITool.

virtual bool16 CTool::IsSelectionTool () const
virtual

Check if this tool is a creation tool. Subclasses can specify this in the constructor call to CTool, so CTool is able to implement this fully.

Implements ITool.

virtual bool16 CTool::IsTextTool () const
virtual

Check if this tool is a text tool. CTool returns kFalse. Subclasses that are text tools need to override this to return kTrue.

Implements ITool.

virtual bool16 CTool::IsToolNone () const
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

Implements ITool.

virtual bool16 CTool::IsToolOfType (ITool::ToolType toolInformation) const
virtual

Check if this tool matches the desired type. Implemented by CTool, based on the toolInformation bitfield passed into the constructor by subclasses.

Implements ITool.

virtual void CTool::Select ()
virtual

Subclasses which override this method should call this Select before doing anything – it notifies the selection that the tool is changing

Implements ITool.

virtual void CTool::SetActionID (ActionID action)
virtual

Set action for shortcut for selecting tool. This method is fully implemented by CTool. Subclasses usually have no need to override.

Implements ITool.

virtual void CTool::SetCursorProvider (ICursorProvidernewProvider)
virtual

Set the cursor provider for this tool. CTool fully implements this. Usually subclasses don't need to override this.

Implements ITool.

virtual void CTool::SetName (const PMStringnewName)
virtual

Set the name of the tool. Fully implemented by CTool. Subclasses usually have no need to override.

Implements ITool.

virtual void CTool::SetToolHint (const PMStringnewHint)
virtual

Set the tool hint of the tool.

Implements ITool.

virtual void CTool::SetToolType (const ClassIDnewToolType)
virtual

Set tool type. This type determines which tools are mutually exclusive. The ClassID for the tool type is defined to be the ClassID of the default tool for that type. Traditional tools in the toolbox have a tooltype of kPointerToolBoss. This method is fully implemented by CTool. Subclasses usually have no need to override.

Implements ITool.