home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / M2V11-1.LHA / modula / amiga / WorkBench.def < prev    next >
Encoding:
Text File  |  1994-07-31  |  6.8 KB  |  213 lines

  1. DEFINITION FOR LIBRARY MODULE Workbench ;
  2.  
  3. FROM SYSTEM    IMPORT ADDRESS, STRING, LONGSET, BADDRESS ;
  4. FROM Exec    IMPORT Message, MsgPortPtr, List, LibraryPtr ;
  5. FROM Intuition    IMPORT NewWindow, Gadget, WindowPtr, ScreenPtr ;
  6. FROM Utility    IMPORT TagItemPtr ;
  7. FROM Dos    IMPORT FileLockPtr ;
  8.  
  9. TYPE
  10.   OldDrawerDataPtr = POINTER TO OldDrawerData    ;
  11.   DrawerDataPtr    = POINTER TO DrawerData    ;
  12.   DiskObjectPtr       = POINTER TO DiskObject    ;
  13.   FreeListPtr       = POINTER TO FreeList    ;
  14.   AppMessagePtr    = POINTER TO AppMessage    ;
  15.   AppWindowPtr       = POINTER TO AppWindow    ;
  16.   AppIconPtr       = POINTER TO AppIcon        ;
  17.   AppMenuItemPtr   = POINTER TO AppMenuItem    ;
  18.   WBStartupPtr        = POINTER TO WBStartup    ;
  19.   ToolTypeArrayPtr = POINTER TO ARRAY OF STRING ;
  20.  
  21. CONST
  22.   WBDISK    = 1 ;
  23.   WBDRAWER  = 2 ;
  24.   WBTOOL    = 3 ;
  25.   WBPROJECT = 4 ;
  26.   WBGARBAGE = 5 ;
  27.   WBDEVICE  = 6 ;
  28.   WBKICK    = 7 ;
  29.   WBAPPICON = 8 ;
  30.  
  31. TYPE
  32.   OldDrawerData = RECORD (* pre V36 definition *)
  33.     dd_NewWindow : NewWindow ;      (* args to open window        *)
  34.     dd_CurrentX  : LONGINT ;      (* current x coordinate of origin *)
  35.     dd_CurrentY  : LONGINT ;      (* current y coordinate of origin *)
  36.   END ;
  37.  
  38. (* the amount of DrawerData actually written to disk *)
  39.  
  40. CONST
  41.   OLDDRAWERDATAFILESIZE    = SIZE( OldDrawerData ) ;
  42.  
  43. TYPE
  44.   DrawerData = RECORD
  45.     dd_NewWindow : NewWindow ;      (* args to open window        *)
  46.     dd_CurrentX  : LONGINT ;      (* current x coordinate of origin *)
  47.     dd_CurrentY     : LONGINT ;      (* current y coordinate of origin *)
  48.     dd_Flags     : LONGSET ;      (* flags for drawer            *)
  49.     dd_ViewModes : BITSET  ;      (* view mode for drawer        *)
  50.   END ;
  51.  
  52. (* the amount of DrawerData actually written to disk *)
  53. CONST
  54.   DRAWERDATAFILESIZE = SIZE( DrawerData ) ;
  55.  
  56. TYPE
  57.   DiskObject = RECORD
  58.     do_Magic       : CARDINAL ; (* a magic number at the start of the file *)
  59.     do_Version       : CARDINAL ; (* a version number, so we can change it   *)
  60.     do_Gadget       : Gadget ;    (* a copy of in core gadget           *)
  61.     do_Type       : SHORTINT ;
  62.     do_DefaultTool : STRING ;
  63.     do_ToolTypes   : ToolTypeArrayPtr ;
  64.     do_CurrentX    : LONGINT ;
  65.     do_CurrentY    : LONGINT ;
  66.     do_DrawerData  : DrawerDataPtr ;
  67.     do_ToolWindow  : STRING ;    (* only applies to tools *)
  68.     do_StackSize   : LONGINT ;    (* only applies to tools *)
  69.   END ;
  70.  
  71. CONST
  72.   WB_DISKMAGIC        = 0E310H ; (* a magic number, not easily impersonated *)
  73.   WB_DISKVERSION    = 1 ;       (* our current version number          *)
  74.   WB_DISKREVISION    = 1 ;       (* our current revision number          *)
  75. (* I only use the lower 8 bits of Gadget.UserData for the revision # *)
  76.   WB_DISKREVISIONMASK    = 255 ;
  77.  
  78. TYPE
  79.   FreeList = RECORD
  80.     fl_NumFree : INTEGER ;
  81.     fl_MemList : List     ;
  82.   END ;
  83.  
  84. (* workbench does different complement modes for its gadgets.             *)
  85. (* It supports separate images, complement mode, and backfill mode.         *)
  86. (* The first 2 are identical to intuitions GFLG_GADGIMAGE and GFLG_GADGHCOMP *)
  87. (* backfill is similar to GFLG_GADGHCOMP, but the region outside of the         *)
  88. (* image (which normally would be color three when complemented)         *)
  89. (* is flood-filled to color zero.                         *)
  90.  
  91. CONST
  92.   GFLG_GADGBACKFILL = 00001H ;
  93.   GADGBACKFILL        = 00001H ; (* an old synonym *)
  94.  
  95. (* if an icon does not really live anywhere, set its current position to here *)
  96.  
  97.   NO_ICON_POSITION = 080000000H ;
  98.  
  99. (* workbench now is a library.    this is it's name *)
  100.   WORKBENCH_NAME   = "workbench.library" ;
  101.  
  102. (* If you find am_Version >= AM_VERSION, you know this structure has *)
  103. (* at least the fields defined in this version of the include file   *)
  104.  
  105.   AM_VERSION       = 1 ;
  106.  
  107. TYPE
  108.  
  109.   WBArg = RECORD
  110.     wa_Lock : FileLockPtr ;    (* a lock descriptor            *)
  111.     wa_Name : STRING ;        (* a string relative to that lock    *)
  112.   END ;
  113.  
  114.   WBArgPtr = POINTER TO ARRAY OF WBArg ;
  115.  
  116.   AppMessage = RECORD
  117.     am_Message    : Message  ;    (* standard message structure    *)
  118.     am_Type    : CARDINAL ;    (* message type            *)
  119.     am_UserData : LONGINT  ;    (* application specific        *)
  120.     am_ID    : LONGINT  ;    (* application definable ID    *)
  121.     am_NumArgs    : LONGINT  ;    (* # of elements in arglist    *)
  122.     am_ArgList    : WBArgPtr ;    (* the arguements themselves    *)
  123.     am_Version    : CARDINAL ;    (* will be AM_VERSION        *)
  124.     am_Class    : CARDINAL ;    (* message class        *)
  125.     am_MouseX    : INTEGER  ;    (* mouse x position of event    *)
  126.     am_MouseY    : INTEGER  ;    (* mouse y position of event    *)
  127.     am_Seconds    : LONGINT  ;    (* current system clock time    *)
  128.     am_Micros    : LONGINT  ;    (* current system clock time    *)
  129.     am_Reserved : ARRAY [0..7] OF LONGINT ;
  130.                     (* avoid recompilation        *)
  131.   END ;
  132.  
  133. CONST
  134. (* types of app messages *)
  135.   AMTYPE_APPWINDOW   = 7 ; (* app window message     *)
  136.   AMTYPE_APPICON     = 8 ; (* app icon message         *)
  137.   AMTYPE_APPMENUITEM = 9 ; (* app menu item message     *)
  138.  
  139.  
  140. (* The following structures are private.  These are just stub    *)
  141. (* structures for code compatibility...                *)
  142.  
  143. TYPE
  144.   AppWindow    = RECORD aw_PRIVATE  : ADDRESS END ;
  145.   AppIcon    = RECORD ai_PRIVATE  : ADDRESS END ;
  146.   AppMenuItem    = RECORD ami_PRIVATE : ADDRESS END ;
  147.  
  148.   WBStartup = RECORD
  149.     sm_Message      : Message    ; (* a standard message structure    *)
  150.     sm_Process      : MsgPortPtr ; (* the process descriptor for you    *)
  151.     sm_Segment      : BADDRESS   ; (* a descriptor for your code        *)
  152.     sm_NumArgs      : LONGINT    ; (* the number of elements in ArgList    *)
  153.     sm_ToolWindow : STRING     ; (* description of window        *)
  154.     sm_ArgList      : WBArgPtr   ; (* the arguments themselves        *)
  155.   END ;
  156.  
  157. VAR
  158.   WBMsg        : WBStartupPtr ;
  159.   WorkbenchBase : LibraryPtr   ;
  160.  
  161. PROCEDURE AddAppWindowA( id      : LONGINT ;
  162.              userdata : LONGINT ;
  163.              window      : WindowPtr ;
  164.              msgport  : MsgPortPtr ;
  165.              taglist  : TagItemPtr ) : AppWindowPtr ;
  166.  
  167. PROCEDURE AddAppWindow( id     : LONGINT ;
  168.             userdata : LONGINT ;
  169.             window     : WindowPtr ;
  170.             msgport  : MsgPortPtr ;
  171.             tag1     : LONGINT ; .. ) : AppWindowPtr ;
  172.  
  173. PROCEDURE RemoveAppWindow( appWindow : AppWindowPtr ) : BOOLEAN ;
  174.  
  175. PROCEDURE AddAppIconA( id    : LONGINT ;
  176.                userdata    : LONGINT ;
  177.                text    : STRING ;
  178.                msgport    : MsgPortPtr ;
  179.                lock    : FileLockPtr ;
  180.                diskobj    : DiskObjectPtr ;
  181.                taglist    : TagItemPtr ) : AppIconPtr ;
  182.  
  183. PROCEDURE AddAppIcon( id    : LONGINT ;
  184.               userdata    : LONGINT ;
  185.               text    : STRING ;
  186.               msgport    : MsgPortPtr ;
  187.               lock    : FileLockPtr ;
  188.               diskobj    : DiskObjectPtr ;
  189.               tag1    : LONGINT ; .. ) : AppIconPtr ;
  190.  
  191. PROCEDURE RemoveAppIcon( appIcon : AppIconPtr ) : BOOLEAN ;
  192.  
  193. PROCEDURE AddAppMenuItemA( id        : LONGINT ;
  194.                userdata : LONGINT ;
  195.                text        : STRING ;
  196.                msgport  : MsgPortPtr ;
  197.                taglist  : TagItemPtr ) : AppMenuItemPtr ;
  198.  
  199. PROCEDURE AddAppMenuItem( id       : LONGINT ;
  200.               userdata : LONGINT ;
  201.               text       : STRING ;
  202.               msgport  : MsgPortPtr ;
  203.               tag1     : LONGINT ; .. ) : AppMenuItemPtr ;
  204.  
  205. PROCEDURE RemoveAppMenuItem( appMenuItem : AppMenuItemPtr ) : BOOLEAN ;
  206.  
  207. (*--- functions in V39 or higher (Release 3) ---*)
  208.  
  209. PROCEDURE WBInfo( lock : FileLockPtr ; name : STRING ; screen : ScreenPtr ) ;
  210.  
  211. END Workbench.
  212.  
  213.