Parts of the API
Extension-Specific Functions and Procedures
Each kind of extension (object, behavior, and so on) has its own procedures and functions, some required and some optional. Some of these functions are called automatically and need be defined only in the extension file. The first thing you'll need to know about creating any extension is how to work with its required functions and procedures. In this book, we'll cover that information for each extension type as we come to it.
Custom Dreamweaver Objects
In addition to these custom functions, the API includes several custom objects, providing hundreds of methods and properties. Usually, these must be explicitly called on and can be used with any extension type. (The Extending Dreamweaver manual devotes 300 of its 500 pages to a dictionary reference of these objects.) The most generally useful of these objects are the dreamweaver object, the site object, and the object representing the current document's DOM. Other objects include the MMHttp object (for working with Web servers), the DWFile object (for working with file input and output operations), the MMNotes object (for working with design notes), and the FWLaunch object (for working with Fireworks). Some sample methods will give you the idea of what these objects can accomplish :
dw.quitApplication() dw.openDocument() dw.setUpFindReplace() site.checkLinks() site.recreateCache() site.defineSites() dom.loadTracingImage() dom.setRulerUnits() dom.setSelection()
If you examine the source code for any of the files in the Configuration folder, you'll see these and other object methods used extensively to control the program.
Custom Form Input Tags
All user input, whether through dialog boxes, inspectors, or floating panels, is handled by HTML forms. In addition to the standard form input tags (text, button, checkbox, and so on), the Dreamweaver API includes two custom input types: a color control button and a tree control structure. Color control is provided through the <mmcolorbutton> tag, which creates a color swatch and pop-up color palette like that seen in various inspectors and dialog boxes throughout Dreamweaver (see Figure 1.2). Tree structures are provided through <mm:treecontrol> , <mm:treecolumn> , and <mm:treenode> tags, and create an expandable data hierarchy such as that found in the Edit: Keyboard Shortcuts dialog box and the Tag Inspector's tree view (see Figure 1.3). We'll be using both of these custom input elements in the course of the exercises in this book.
Figure 1.2. The Property inspector, showing the color button and popup color swatches palette.
Figure 1.3. The Tag Inspector and Keyboard Shortcut Editor, both of which use tree control structures.
Working with the API