Summary
Proto
protoDrawTool
myToolTemplate := {
_proto : protoDrawTool, class : classSymbol, // this tool's symbol icon : pixFamily, //icon for tool bar createByTapping : Boolean , //create object with pen tap? createByDragging : Boolean , //create object by dragging bounds? dragARectangle: Boolean , //create object by dragging a rectangle? MakeObject:
//make a new object func(left, top, right, bottom, style) ...
SetAttribute://set an attribute func(shape, attribute, newValue) ...
MakeDragObject:// make an object to show user when dragging a new obj.
func(left, top, right, bottom, style) ...
AdjustBounds: // contrain the bounding rect a user drags func(shape, style, left, top, right, bottom, constrain) ...
ScaleShape: // scale an object
func(shape, oldBounds, newBounds) ...
CanvasClickScript : // called when user touches canvas w/your tool
func(unit)...
ToolClickScript : // called when user taps your tool in the tool bar
func(unit) ...
ToolBegin: // called before ToolCickScript to set up too
func() ... ToolEnd: // called when anothertool is selected, to clean up
func() ... ... }
Data Structures
The Canvas
canvasView := {
currentDrawStyle : AddShape : func(shape, style, nil) ... //add a shape to the canvas AddShapeToSelection : func(shape) ... //selects a shape ClearSelection : func() ... //clears selected shapes SelectAll : func() ... // selects all shapes on the canvas GetSelectedShapes : func(makeCopy) ... //returns selected shapes DirtyShape : func(shape) ... //marks as dirty area under a shape EditGroup : func() ... //groups selection EditUnGroup : func() ... //ungroups selection EditCopy : func() ... //copies selection EditCut : func() ... //cuts selection EditPaste : func() ... //pastes clipboard contents EditDelete : func() ... //deletes selection EditDuplicate : func() ... //duplicates selection EditUndo : func() ... //undos last undoable action ... }
Draw Application viewDef
drawApplicationViewDef := {
GetCanvas : func() ... //returns canvas view GetContents : func() ... //returns contents of canvas SetContents : func(newShapes) ... //sets contents of canvas RegPatterns : func(sym, arrayOfPatterns) ... //registers new patterns UnRegPatterns : func(sym) ... //unregisters new patterns RegStamps : func(sym, arrayOfStamps) ... //registers new stamps UnRegStamps : func(sym) ... //unregisters new stamps RegTool : func(sym, toolTemplate) ... //registers new tool UnRegTool : func(sym) ... //unregisters new tool ... }
Subtopics
- Proto
- protoDrawTool
- Data Structures
- The Canvas
- Draw Application viewDef
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help