home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1986-11-21 | 6.7 KB | 135 lines |
- DEFINITION MODULE EasyMenus;
-
- (* EasyMenus.def 1.00 Mike Scalora PLink : SCARY
-
- This MODULE is public domain. Freely distributable as long as this
- notice stays in.
-
- This program was originally uploaded to PeopleLink's Amiga Zone. The Amiga
- Zone has well over 2000 members, and a library of thousands of public domain
- files. If you're interested in joining us, call 800-524-0100 (voice)
- or 800-826-8855 (modem).
-
- Modified: 8/7/87 by Richie Bielak
- Adapted to OXXI Modula-2 Compiler.
-
- *)
-
- FROM SYSTEM IMPORT ADDRESS;
-
- (* GLOBAL NOTE: x,y,w,h are all in pixels *)
-
- PROCEDURE EasyIntuiText(text : ARRAY OF CHAR; x,y,fc,bc : INTEGER): ADDRESS;
- (* text - text to be made into a IntuitionText structure
- x,y - x and y offset for position of text
- fc - FrontPen color (text color)
- bc - BackPen color (background color)
- NOTE: if fc=bc then BackPen will be set to bc+1
- NOTE: DrawMode is always set to JAM2
- RETURNS - address (IntuiTextPtr) of IntuitionText structure created *)
-
- PROCEDURE EasyMenuItem( NextItems,SubItems : ADDRESS;
- x,y,w,h,mx,select,high,fc,bc : INTEGER;
- cmd : CHAR; text : ARRAY OF CHAR): ADDRESS;
- (* NextItem - address of next MenuItem in the chain. (NULL if none)
- SubItem - address of first subitem in MenuItem chain. (NULL if none)
- text - text to be used for the MenuItem
- x,y - x and y offset for position of select box
- w,h - width and height of select box
- mx - mutual exclude [ 0=no 1=yes ]
- select - type of select
- [ 0=normal 1=cheked item 2=checked item preset as SELECTED ]
- high - type of highlighting [ 0=complement 1=box 2=none ]
- fc,bc - FrontPen and BackPen colors for text of item
- NOTE: if fc=bc then BackPen will be set to bc+1
- cmd - character to be used for command key [ 0C if none ]
- text - text to be used for the MenuItem
- RETURNS - address (MenuItemPtr) to the MenuItem structure created *)
-
- PROCEDURE EasyItemStrip(x,y,w,mx,select,selected,high : INTEGER;
- text : ARRAY OF CHAR): ADDRESS;
- (* x,y - x and y offset for position of select box of first item
- w - minimun width (will be increased if any item text is wider)
- mx - mutual exclude [ 0=none 1=all items exclude each other ]
- select - type of select [ 0=normal 1=all items will have checkmarks ]
- selected - number of item to be preset as SELECTED [0=none preset]
- high - type of highlighting [ 0=complement 1=box 2=none ]
- text - text for all items separated by |
- EXAMPLE: ' New| Load... | Save | Save as... | Quit '
- NOTE: If an at sign ('@') is the first character of the
- text for an item, then the next character will be used
- for the command key.
- EXAMPLE: '@N New |@L Load... |@S Save | Save as... |@Q Quit '
- RETURNS - addess (MenuItemPtr) to the first MenuItem structure
- in the ItemStrip (MenuItem chain) *)
-
- PROCEDURE EasyMenu(NextMenus,Items : ADDRESS; x,w : INTEGER;
- text : ARRAY OF CHAR): ADDRESS;
- (* NextMenu - address of next Menu in the chain. (NULL if none)
- Items - address of first item in MenuItem chain. (NULL if none)
- x - offset from right edge of titlebar for select box
- w - width of select box
- text - text to be used for the Menu structure
- RETURNS - address (MenuPtr) to Menu structure created *)
-
- PROCEDURE EasyMenuStrip(x : INTEGER; mx,select,high : BITSET;
- text1,text2,text3,text4,text5,text6,text7,
- text8,text9,text10,text11,text12 : ARRAY OF CHAR): ADDRESS;
- (* x - offset of where to place left edge of MenuStrip (usually 0)
- mx - mutual exclude bitmap (see NOTE)
- [ 0=none 1=all items exclude each other ]
- select - type of select bitmap (see NOTE)
- [ 0=normal 1=all items will have checkmarks ]
- high - type of highlighting bitmap (see NOTE) [ 0=complement 1=box ]
- text.. - text for Menu and each Item. Because of the way Modula-2
- passes string constants, you must place an extra character
- at the end of each text parameter. Notice the extra blank
- after 'Quit' in the example
- EXAMPLE: ' PROJECT |@N New |@L Load... |@S Save |@Q Quit '
- NOTE: see EasyItemStrip for use of '@'
- RETURNS - address (MenuPtr) of first Menu in MenuStrip
-
- NOTE: mx, select, and high are defined as BITSET's. To activate a
- feature just include the bit number that coresponds to the
- menu number. For example, to use box highlighing for menu
- 5 and 8 you would pass BITSET{5,8} for high. Simple, no?
- SubNote: bit 0 is not used *)
-
- PROCEDURE DisposeEasyIntuiText(ITextPtr : ADDRESS);
- (* ITextPtr - address of IntuitionText structure to deallocate *)
-
- PROCEDURE DisposeEasyItem(ItemPtr : ADDRESS);
- (* ItemPtr - address of MenuItem structure to deallocate *)
-
- PROCEDURE DisposeEasyItemStrip(ItemPtr : ADDRESS);
- (* ItemPtr - address of the first MenuItem structure in a ItemStrip
- to deallocate *)
-
- PROCEDURE DisposeEasyMenu(MenuPt : ADDRESS);
- (* MenuPt - address of Menu structure to deallocate *)
-
- PROCEDURE DisposeEasyMenuStrip(MenuPt : ADDRESS);
- (* MenuPt - address of the first Menu structure in a MenuStrip to
- deallocate *)
-
- PROCEDURE SubItemNum(MenuNumber : INTEGER): CARDINAL;
- (* MenuNumber - code field from an IDCMP message
- RETURNS - number of subitem selected [0 if none ] *)
-
- PROCEDURE ItemNum(MenuNumber : INTEGER): CARDINAL;
- (* MenuNumber - code field from an IDCMP message
- RETURNS - number of item selected [0 if none ] *)
-
- PROCEDURE MenuNum(MenuNumber : INTEGER): CARDINAL;
- (* MenuNumber - code field from an IDCMP message
- RETURNS - number of menu selected [0 if none ] *)
-
- PROCEDURE AttachMenuStrip(WindPtr, MenuPt : ADDRESS);
- (* WindPtr - address (WindowPtr) of window to attach menu to
- MenuPt - address (MenuPtr) of MenuStrip to attach to WindPtr *)
-
- PROCEDURE DetachMenuStrip(WindPtr : ADDRESS);
- (* WindPtr - address (WindowPtr) of window to detach menu from *)
-
- END EasyMenus.
-