home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 093.lha / Chaos / Sources / easymenu.def < prev    next >
Encoding:
Modula Definition  |  1986-11-21  |  6.7 KB  |  135 lines

  1. DEFINITION MODULE EasyMenus; 
  2.  
  3. (* EasyMenus.def 1.00          Mike Scalora            PLink : SCARY
  4.  
  5.    This MODULE is public domain.  Freely distributable as long as this 
  6.    notice stays in.
  7.  
  8.    This program was originally uploaded to PeopleLink's Amiga Zone.  The Amiga
  9.    Zone has well over 2000 members, and a library of thousands of public domain
  10.    files.  If you're interested in joining us, call 800-524-0100 (voice) 
  11.    or 800-826-8855 (modem).                                              
  12.  
  13.    Modified: 8/7/87 by Richie Bielak
  14.              Adapted to OXXI Modula-2 Compiler.
  15.  
  16. *)
  17.  
  18. FROM SYSTEM IMPORT ADDRESS;
  19.  
  20.  (*  GLOBAL NOTE: x,y,w,h are all in pixels *)
  21.  
  22. PROCEDURE EasyIntuiText(text : ARRAY OF CHAR; x,y,fc,bc : INTEGER): ADDRESS;
  23.  (*   text - text to be made into a IntuitionText structure
  24.       x,y  - x and y offset for position of text
  25.       fc   - FrontPen color  (text color)
  26.       bc   - BackPen color (background color)
  27.              NOTE: if fc=bc then BackPen will be set to bc+1 
  28.              NOTE: DrawMode is always set to JAM2                  
  29.       RETURNS - address (IntuiTextPtr) of IntuitionText structure created   *)
  30.   
  31. PROCEDURE EasyMenuItem( NextItems,SubItems : ADDRESS; 
  32.                         x,y,w,h,mx,select,high,fc,bc : INTEGER;
  33.                         cmd : CHAR; text : ARRAY OF CHAR): ADDRESS;
  34.   (*  NextItem - address of next MenuItem in the chain. (NULL if none)
  35.       SubItem  - address of first subitem in MenuItem chain. (NULL if none)
  36.       text     - text to be used for the MenuItem
  37.       x,y      - x and y offset for position of select box
  38.       w,h      - width and height of select box
  39.       mx       - mutual exclude [ 0=no 1=yes ]
  40.       select   - type of select 
  41.                  [ 0=normal 1=cheked item 2=checked item preset as SELECTED ] 
  42.       high     - type of highlighting [ 0=complement 1=box 2=none ]
  43.       fc,bc    - FrontPen and BackPen colors for text of item
  44.                  NOTE: if fc=bc then BackPen will be set to bc+1 
  45.       cmd      - character to be used for command key [ 0C if none ]      
  46.       text     - text to be used for the MenuItem
  47.       RETURNS  - address (MenuItemPtr) to the MenuItem structure created    *)
  48.  
  49. PROCEDURE EasyItemStrip(x,y,w,mx,select,selected,high : INTEGER;
  50.                         text : ARRAY OF CHAR): ADDRESS;
  51.   (*  x,y      - x and y offset for position of select box of first item 
  52.       w        - minimun width (will be increased if any item text is wider)
  53.       mx       - mutual exclude [ 0=none 1=all items exclude each other ]
  54.       select   - type of select [ 0=normal 1=all items will have checkmarks ]
  55.       selected - number of item to be preset as SELECTED [0=none preset]
  56.       high     - type of highlighting [ 0=complement 1=box 2=none ]
  57.       text     - text for all items separated by | 
  58.                  EXAMPLE: ' New| Load... | Save | Save as... | Quit  '
  59.                  NOTE: If an at sign ('@') is the first character of the
  60.                  text for an item, then the next character will be used
  61.                  for the command key.
  62.                  EXAMPLE: '@N New |@L Load... |@S Save | Save as... |@Q Quit '
  63.       RETURNS  - addess (MenuItemPtr) to the first MenuItem structure 
  64.                  in the ItemStrip (MenuItem chain)                         *)
  65.  
  66. PROCEDURE EasyMenu(NextMenus,Items : ADDRESS; x,w : INTEGER;
  67.                    text : ARRAY OF CHAR): ADDRESS;
  68.   (*  NextMenu - address of next Menu in the chain. (NULL if none)
  69.       Items    - address of first item in MenuItem chain. (NULL if none)
  70.       x        - offset from right edge of titlebar for select box
  71.       w        - width of select box
  72.       text     - text to be used for the Menu structure 
  73.       RETURNS  - address (MenuPtr) to Menu structure created               *)
  74.  
  75. PROCEDURE EasyMenuStrip(x : INTEGER; mx,select,high : BITSET;
  76.                   text1,text2,text3,text4,text5,text6,text7,
  77.                   text8,text9,text10,text11,text12 : ARRAY OF CHAR): ADDRESS;
  78.    (* x        - offset of where to place left edge of MenuStrip (usually 0)
  79.       mx       - mutual exclude bitmap (see NOTE) 
  80.                  [ 0=none 1=all items exclude each other ]
  81.       select   - type of select bitmap (see NOTE)
  82.                  [ 0=normal 1=all items will have checkmarks ]
  83.       high     - type of highlighting bitmap (see NOTE) [ 0=complement 1=box ]
  84.       text..   - text for Menu and each Item.  Because of the way Modula-2
  85.                  passes string constants, you must place an extra character
  86.                  at the end of each text parameter.  Notice the extra blank
  87.                  after 'Quit' in the example
  88.                  EXAMPLE: ' PROJECT |@N New |@L Load... |@S Save |@Q Quit  '
  89.                  NOTE: see EasyItemStrip for use of '@'
  90.       RETURNS  - address (MenuPtr) of first Menu in MenuStrip
  91.  
  92.       NOTE: mx, select, and high are defined as BITSET's. To activate a 
  93.             feature just include the bit number that coresponds to the
  94.             menu number.  For example, to use box highlighing for menu
  95.             5 and 8 you would pass BITSET{5,8} for high. Simple, no?
  96.             SubNote: bit 0 is not used                                     *)
  97.       
  98. PROCEDURE DisposeEasyIntuiText(ITextPtr : ADDRESS);
  99.   (*  ITextPtr - address of IntuitionText structure to deallocate          *)
  100.  
  101. PROCEDURE DisposeEasyItem(ItemPtr : ADDRESS);
  102.   (*  ItemPtr - address of MenuItem structure to deallocate                *)
  103.  
  104. PROCEDURE DisposeEasyItemStrip(ItemPtr : ADDRESS);
  105.   (*  ItemPtr - address of the first MenuItem structure in a ItemStrip
  106.                 to deallocate                                              *)
  107.  
  108. PROCEDURE DisposeEasyMenu(MenuPt : ADDRESS);
  109.   (*  MenuPt - address of Menu structure to deallocate                     *)
  110.  
  111. PROCEDURE DisposeEasyMenuStrip(MenuPt : ADDRESS);
  112.   (*  MenuPt - address of the first Menu structure in a MenuStrip to
  113.                deallocate                                                  *)
  114.  
  115. PROCEDURE SubItemNum(MenuNumber : INTEGER): CARDINAL;
  116.   (* MenuNumber - code field from an IDCMP message
  117.      RETURNS    - number of subitem selected [0 if none ]                   *)
  118.  
  119. PROCEDURE ItemNum(MenuNumber : INTEGER): CARDINAL;
  120.   (* MenuNumber - code field from an IDCMP message
  121.      RETURNS    - number of item selected [0 if none ]                      *)
  122.  
  123. PROCEDURE MenuNum(MenuNumber : INTEGER): CARDINAL;
  124.   (* MenuNumber - code field from an IDCMP message
  125.      RETURNS    - number of menu selected [0 if none ]                      *)
  126.  
  127. PROCEDURE AttachMenuStrip(WindPtr, MenuPt : ADDRESS);
  128.   (* WindPtr - address (WindowPtr) of window to attach menu to
  129.      MenuPt  - address (MenuPtr) of MenuStrip to attach to WindPtr          *)
  130.  
  131. PROCEDURE DetachMenuStrip(WindPtr : ADDRESS);
  132.   (* WindPtr - address (WindowPtr) of window to detach menu from            *)
  133.      
  134. END EasyMenus.
  135.