Download Amiga Rom Kernel Reference Manual - tele

Transcript
Wbstartup drawer), and DONOTWAIT (tells Workbench not to wait for the return of a program started via an icon
in the Wbstartup drawer). In addition to the reserved Tool Types, which applications should not use, there are
standard Tool Types, which applications should use only in the standard way. For a list of standard Tool Types
refer to the Amiga User Interface Style Guide.
Two routines are provided to help you deal with the Tool Types array. FindToolType() returns the value of a Tool
Type element. Using the above example, if you are looking for FILETYPE, the string "PaintProgram|ILBM" will be
returned. MatchToolValue() returns nonzero if the specified string is in the reference value string. This routine
knows how to parse vertical bars. For example, using the reference value strings of "PaintProgram" or "ILBM",
MatchToolValue() will return TRUE for "ILBM" and "PaintProgram" and FALSE for everything else.
354 Amiga ROM Kernel Reference Manual: Libraries
Example of Reading Icons and Parsing Tool Types
The follwoing example demonstrates icon creation, icon reading and Tool Type parsing in the Workbench
environment. When called from the Shell, the example creats a small data file in RAM: and creates or updates a
project icon for the data file. The created project icon points to this example as its default tool. When the new
project icon is double-clicked, Workbench will invoke the default tool (this example) as a Workbench process, and
pass it a description of the project data file as a Workbench argument (WBArg) in WBStartup message.
;/* iconexample.c - Execute me to compile me with SAS C 5.10
LC -b1 -cfistq -v -y -j73 iconexample.c
Blink FROM LIB:c.o,iconexample.o TO iconexample LIBRARY LIB:LC.lib,LIB:Amiga.lib
quit
**
** The following example demonstrates icon creation, icon reading and
** Tool Type parsing in the Workbench environment. When called from the
** Shell, the example creates a small data file in RAM: and creates or
** updates a project icon for the data file. The created project icon
** points to this example as its default tool. When the new project
** icon is double-clicked, Workbench will invoke the default tool (this
** example) as a Workbench process, and pass it a description of the
** project data file as a Workbench argument (WBArg) in the WBStartup
** message.
**
** iconexample.c - Workbench icon startup, creation, and parsing example
*/
#include
#include
#include
#include
<exec/types.h>
<libraries/dos.h>
<workbench/workbench.h>
<workbench/startup.h>
#include
#include
#include
#include
#include
#include
#include
<clib/alib_protos.h>
<clib/exec_protos.h>
<clib/dos_protos.h>
<clib/icon_protos.h>
<stdlib.h>
<stdio.h>
<string.h>
#ifdef LATTICE
int CXBRK(void) { return(0); }
/* Disable SAS Lattice CTRL/C handling */
int chkabort(void) { return(0); }/* really */
#endif
/* our functions */
void cleanexit(UBYTE *,LONG);
void cleanup(void);
void message(UBYTE *);
BOOL makeIcon(UBYTE *, char **, char *);
BOOL showToolTypes(struct WBArg *);
UBYTE *projname
UBYTE *conwinname
= "RAM:Example_Project";
= "CON:10/10/620/180/iconexample";
UBYTE deftoolname[] = {"iconexample"};