DEFINITION MODULE Menu;

(* (C) Copyright 1987 Fitted Software Tools. All rights reserved. *)

(*
    This module uses the module Windows to create windows for the menus.
*)

PROCEDURE PopMenu( line, col    :CARDINAL;
                   menu         :ARRAY OF CHAR;
                   width        :CARDINAL;
                   clear        :BOOLEAN;
                   VAR cmd      :CARDINAL );
(*
    Pop a menu at line,col.

    menu is a string of menu items separated by the character '|'.
    The first item is the menu title.

    width is the minimum width for the menu window.

    IF clear THEN the menu window is destroyed upon menu selection
    ELSE the menu window stays on the screen and must be destroyed
         by Windows.CloseCurWindow

    cmd will be 0 if no item was select (ESC), or the number of the
    item selected off the menu.

    If on return cmd = 0, the window was closed, regardless of the
    value of clear.
*)

PROCEDURE PullDownMenu( line            :CARDINAL;
                        frame           :BOOLEAN;
                        MainMenu        :ARRAY OF CHAR;
                        SubMenus        :ARRAY OF CHAR;
                        clear           :BOOLEAN;
                        VAR cmd1, cmd2  :CARDINAL );
(*
    Create a pull down menu at line line.

    frame determines whether the pull down bar should be framed.

    MainMenu is a string of pull down menu items, separated by '|'.

    SubMenus is a string of submenus separated by '&'; each of the
    submenus contain a list of selections separated by '|'.

    On return, cmd1 contains the number of the main menu item selected
    and cmd2 contains the number of the item selected from the submenu.

    If the user presses the ESC key, cmd1 will be = 0.

    All the menu windows are closed before returning.
*)

(* Examples:
    PopMenu( 5,10,"Main Menu|Hello|Bye|Quit",0,TRUE,cmd );

    PullDownMenu( 0, FALSE, "Hello|Bye|Quit", "1|2|3&4|5|6&0", FALSE,
                  cmd1, cmd2 );
*)

END Menu.