home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / utilities / zap / !Zap / Docs / E-Menu < prev    next >
Encoding:
Text File  |  1994-01-18  |  3.5 KB  |  95 lines

  1. *************************************************************************
  2. * >E-Menu    Documents zaps internal menu format            *
  3. *************************************************************************
  4.  
  5. If you are writing your own mode then you may add your own menu to appear off
  6. the the mode menu. The current modes have a writable icon of the form 'text
  7. width' for example.
  8.  
  9. You are asked to give an offset to a 'zap menu structure' at offset e_menu in
  10. the mode table. This file documents the format of this structure. It is of
  11. the form:
  12.  
  13.     #&00    Menu name (12) (zero terminated)
  14.     #&0C    Menu width (os coords)
  15.     #&10    Module offset of 'update menu code' (see below)
  16.     #&14    Menu entries (x n)
  17.         -1 to terminate list of entries
  18.         
  19. Each menu entry is of the form:
  20.  
  21.     #&00    Flags:    b0-b7    Menu flags as for wimp. ie,
  22.             b0    Display tick to left of item
  23.             b1    Dotted line follows
  24.             b2    item writable
  25.             b3    generate warning message (see below)
  26.             b7    ignored
  27.             b8-b15    Minimum buffer size for this menu entry.
  28.                 (eg writable icon).
  29.             b16-b23    Internal use : save menu start in a memory
  30.             b24-b31    Icon colours / 0 for default
  31.     #&04    Submenu pointer:
  32.         If the submenu warning bit is clear then:
  33.             0=none
  34.             1-15=internal use : get from memory 1-15
  35.             >16 offset in module of submenu (same structure)
  36.         If the submenu warning bit is set then this gives the module
  37.         offset of the code to be called to open the submenu (see
  38.         below).
  39.     #&08    Index word. This is a 'handle' for this menu entry which is
  40.         passed to the interpret code.
  41.     #&0C    Module offset of the interpret code to call when menu 
  42.         clicked on.
  43.     #&10    Text for this entry (0 terminated string of any length)
  44.     ALIGN before next entry.
  45.     
  46. This structure is relocatable and thus can be stored directly in your mode
  47. extension module. When Zap is run, it converts it into a standard wimp menu
  48. with all menu entries being indirected strings. The other values are stored
  49. at negative offsets from the standard wimp structure:
  50.  
  51.     menu pointer
  52.     #-4    = address of update menu sub
  53.     
  54.     menu entry string buffer pointer
  55.     #-12    = sub to handle submenu creation (if warning bit set)
  56.     #-8    = index word
  57.     #-4    = address of the interpret code to be called when clicked on
  58.     
  59. The update menu sub is called when the menu is created to update the 'ticks'
  60. etc. This is called when a menu is created/recreated. The entry/exit
  61. conditions are:
  62.  
  63.     \E    R0=offset of this menu in previous menu
  64.         R6=w_format value (opt_format if R8=0)
  65.         R7=w_flags value (opt_flags if R8=0)
  66.         R8/R9=window (or 0 if called from iconbar menu)
  67.         R10=address of the start of the wimp menu structure
  68.         R11<>your workspace
  69.     \X    You may corrupt R0-R11 VS on error etc
  70.     
  71. The interpret code is called when the menu is clicked on. Adjust clicks etc
  72. are handled automatically. Perform the menu action. The update code will be
  73. called again if the menu is recreated. The entry/exit conditions are:
  74.  
  75.     \E    R0=offset in menu (=R11!-4)
  76.         R1=index word (=R10!-8)
  77.         R2=address of menu item start
  78.         R3=address of previous menu item start
  79.         R6=w_format value (opt_format if R8=0)
  80.         R7=w_flags value (opt_flags if R8=0)
  81.         R8/R9=window (or 0 if called from iconbar menu)
  82.         R10=address of text for this menu item
  83.         R11=end of list of menu offsets as returned by the wimp
  84.     \X    You may corrupt R0-R11 VS on error etc
  85.     
  86. The menu warning code is called when the menu warning bit is set and zap gets
  87. a menu warning message. It has entry/exit conditions:
  88.  
  89.     \E    R8/R9=window (or 0 if called from iconbar menu)
  90.         R11=menu warning block as returned by the wimp
  91.     \X    R1=pointer to submenu OR window handle of leaf window to
  92.         be opened.
  93.  
  94. All leaf windows should be warned!
  95.