Conforms to GlyphsToolAuxiliaryDrawing
Declared in GlyphsToolEventProtocol.h

Overview

Protocol for the Event handling parts of the tool API.

All plugins should conform to this protocol. Additionaly it could conform the GlyphsToolDraw it it needs to draw.

The tool can implement all methods that are defined by NSResponder

Properties

draggStart

The position where the dragging action started.

@property (nonatomic) NSPoint draggStart

dragging

Set to YES while the mouse is down and dragging.

@property (nonatomic) BOOL dragging

Discussion

The setter should initialise the drag action. (set dragStart)

groupID

The group ID defines the position of the tool in the toolbar.

@property (nonatomic, readonly) NSUInteger groupID

Discussion

  • selection tools (select, text): 10
  • editTools (draw): 20
  • navigationTools (hand, zoom): 30

interfaceVersion

The interface version.

@property (nonatomic, readonly) NSUInteger interfaceVersion

tempTrigger

The trigger (key mask) to select the tool temporarily

@property (nonatomic, readonly) NSInteger tempTrigger

Discussion

The select tool is selected with the cmd key. It returns NSCommandKeyMask.

title

The descrition/name of the plugin.

@property (nonatomic, readonly) NSString *title

toolBarIcon

The icon displayed in the toolbar.

@property (nonatomic, readonly) NSImage *toolBarIcon

trigger

The default keyboard shortcut to select the tool.

@property (nonatomic, readonly) NSString *trigger

Instance Methods

activeLayers

returns all layers that arecurrently active. That is mostly used for the ‘Select All Layers’ tool.

- (NSArray *)activeLayers

Return Value

an array of layers

addMenuItemsForEvent:toMenu:

Callback to allow to add something to the contect menu

- (void)addMenuItemsForEvent:(NSEvent *)theEvent toMenu:(NSMenu *)theMenu

Parameters

theEvent

the current event

theMenu

the context menu to add to

canShowInfoForSelection

return true if the current selection state might show a “Info for Selction” dialog.

- (BOOL)canShowInfoForSelection

copy:

Copy'n'Past Support

- (void)copy:(id)sender

drawSelection

Draws the active selection. The default is a colored dragg rect.

- (void)drawSelection

extraInspectorViewControllers

returns the view to place on the left of the normal inspector

- (NSArray *)extraInspectorViewControllers

inspectorViewControllers

returns the view to place in the inspector

- (NSArray *)inspectorViewControllers

modifierChanged:

Informs the receiver that the user has pressed or released a modifier key (Shift, Control, and so on).

- (void)modifierChanged:(NSEvent *)anEvent

Parameters

anEvent

An object encapsulating information about the modifier-key event.

paste:

Copy'n'Past Support

- (void)paste:(id)sender

selectNextSubTool:

if the tool has several sub groups, this is called to swithch to the next tool

- (void)selectNextSubTool:(id)sender

Parameters

sender

the object calling the command

showInfoForSelection

actually show the info for Selection dialog

- (void)showInfoForSelection

Discussion

is only called if canShowInfoForSelection returned YES.

toolbarMenu

Return a NSMenu object that should be displayed if the user presses/holdes the mouse on the icon

- (NSMenu *)toolbarMenu

Return Value

A NSMenu object

willActivate

Is called when the tool is activated.

- (void)willActivate

Discussion

This might happen when the user selects the tool or when the document becomes active

See Also

willDeactivate

Is called when the tool is deactivated.

- (void)willDeactivate

Discussion

This might happen when the user deselects the tool or when the document becomes inactive

See Also

willSelectTempTool:

A callback to let the tool know that a temp tool will be selected (by pressing a modifier key). You can return NO to prevent that.

- (BOOL)willSelectTempTool:(id)tempTool

Parameters

tempTool

the temp tool that is about to become active

Return Value

if you allow it or not