Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ menu(S) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     MENU(S)                   UNIX System V                   MENU(S)



     Name
          menu - CRT menu routines

     Syntax
          #include <menu.h>

          cc [ flags ] files -lmenu -lcurses [ libraries ]

          MENU *new_menu(ip)
          ITEM ** ip;

          int free_menu(m)
          MENU *m;

          int set_menu_items(m,i)
          MENU * m;
          ITEM ** i;

          ITEM ** menu_items(m)
          MENU * m;

          int set_menu_format(m, c, r)
          MENU *m;
          int c, r;

          void menu_format(m, rp, cp)
          MENU *m;
          int *rp, *cp;

          int set_menu_mark(m, n)
          MENU *m;
          char *n;

          char *menu_mark(m)
          MENU *m;

          int scale_menu(m, rp, cp)
          MENU *m;
          int *rp, *cp;

          int set_menu_win(m, w)
          MENU *m;
          WINDOW *w;

          WINDOW *menu_win(m)
          MENU *m;

          int set_menu_sub(m, w)
          MENU *m;
          WINDOW *w;

          WINDOW *menu_sub(m)
          MENU *m;

          int set_menu_fore(m, c)
          MENU *m;
          int c;

          int menu_fore(m)
          MENU *m;

          int set_menu_back(m, c)
          MENU *m;
          int c;

          int menu_back(m)
          MENU *m;

          int set_menu_grey(m, c)
          MENU *m;
          int c;

          int menu_grey(m)
          MENU *m;

          int set_menu_pad(m, c)
          MENU *m;
          int c;

          int menu_pad(m)
          MENU *m;

          int post_menu(m)
          MENU *m;

          int unpost_menu(m)
          MENU *m;

          int menu_driver(m, c)
          MENU *m;
          int c;

          int set_item_init(m, f)
          MENU *m;
          ITEM * item;
          PTF_void f;

          PTF_void item_init(m)
          MENU *m;

          set_item_term(m, f)
          MENU *m;
          PTF_void f;

          PTF_void item_term(m)
          MENU *m;

          int set_menu_init(m, f)
          MENU *m;
          PTF_void f;

          PTF_void menu_init(m)
          MENU *m;

          int set_menu_term(m, f)
          MENU *m;
          PTF_void f;

          PTF_void menu_term(m)
          MENU *m;

          int set_current_item(m, i)
          MENU *m;
          ITEM * item;

          ITEM * current_item(m)
          MENU *m;

          int item_index(i)
          ITEM * i;

          int set_top_row(m, c)
          MENU *m;
          int *c;

          int top_row(m)
          MENU *m;

          int pos_menu_cursor(m)
          MENU *m;

          int set_menu_pattern(m, n)
          MENU *m;
          char *n;

          char *menu_pattern(m)
          MENU *m;

          int set_menu_userptr(m, n)
          MENU *m;
          chr *n;

          char *menu_userptr(m)
          MENU *m;

          int set_menu_opts(m, o)
          MENU *m;
          OPTIONS o;

          OPTIONS menu_opts(m)
          MENU *m;

          int menu_opts_on (m, o)
          MENU *m;
          OPTIONS o;

          int menu_opts_off (m, o)
          MENU *m;
          OPTIONS o;

     Description
          These routines allow you to create, display, and access
          menus.  Menus can be displayed on any display device
          supported by the low-level
           () library curses(S).  Once you compile your program
          includeing the MENU header file menu.h, you should link it
          with the MENU and curses library routines.

     Functions
          The following is a list of MENU routines.

          new_menu(ip) creates a new menu connected to the given item
          pointer array and returns a pointer to the new menu.

          free_menu(m) disconnects the menu from its associated item
          pointer array and free the storage allocated for the menu.

          set_menu_items(m,i) changes the item pointer array connected
          to the given menu to item pointer array i.

          menu_items(m) returns a pointer to the item pointer array
          connected to menu m.

          set_menu_format(m,c, r) sets the maximum number of rows and
          columns of items that may be displayed at one time on a
          menu.

          menu_format(m,rp, cp) returns the maximum number of rows and
          columns that may be displayed at one time on a menu.  rp and
          cp are pointers to the values used to return these numbers.

          The mark string distinguishes selected items in a multi-
          valued menu and the current item in a single-valued menu.
          set_menu_mark(m,n) sets the menu's mark string to n.

          menu_mark(m) returns a pointer to the menu's mark string.

          scale_menu(m,rp, cp) returns the minimum window size
          necessary for the given menu.  rp and cp are pointers to the
          locations used to return the number of rows and columns for
          the menu.

          set_menu_win(m,w) sets window w as the window of menu m.

          menu_win(m) returns a pointer to the menu's window.

          set_menu_sub(m,w) sets window w as the subwindow of menu m.

          menu_sub(m) returns a pointer to the menu's subwindow.

          set_menu_fore(m,c) sets the menu's foreground attribute-the
          display attribute for the current item (if selectable) on
          single-valued menus and for selected items on multi-valued
          menus.  This display attribute is a curses visual attribute.
          By default, this attribute is A_STANDOUT.

          menu_fore(m) returns the menu foreground attribute.

          set_menu_back(m,c) sets the menu's background attribute-the
          display attribute for unselected, yet selectable, items.
          This display attribute is a curses visual attribute.  By
          default, this attribute is A_NORMAL.

          menu_back(m) returns the menu background attribute.

          set_menu_grey(m,c) sets the menu's grey attribute-the
          display attribute for nonselectable items in multi-valued
          menus.  This display attribute is a curses visual attribute.
          By default, this attribute is A_UNDERLINE.

          menu_grey(m) returns the menu's grey attribute.

          The pad character is the character that fills the space
          between a menu item's name and description, if any.
          set_menu_pad(m,c) sets the pad character for menu m to c.

          menu_pad(m) returns the menu's pad character.

          post_menu(m) writes the menu in the menu's subwindow.

          unpost_menu(m) erases the menu from its associated
          subwindow.

          The workhorse of the menu subsystem, menu_driver(m,c) checks
          if the character c is a menu request or data.  If it is a
          request, the menu driver executes the request and reports
          the result.  If it is data (a printable ASCII character), it
          enters the data into the current position in the current
          field.  If the character is not recognized, the menu driver
          assumes it is an application-defined command and returns
          E_UNKNOWN_COMMAND.

          The following set_ functions enable you to establish
          application routines to be executed automatically at
          initialization and termination points in your form
          application.  You need not specify any application-defined
          initialization or termination routines at all, but they may
          be helpful for displaying messages or page numbers and other
          chores.

          set_item_init(m,f) sets the application-defined function f
          to be called when the menu is posted and just after the
          current item changes.

          item_init(m) returns a pointer to the item initialization
          routine, if any, called when the menu is posted and just
          after the current item changes.

          set_item_term(m,f) sets function f to be called when the
          menu is unposted and just before the current item changes.

          item_term(m) returns a pointer to the termination function,
          if any, called when the menu is unposted and just before the
          current item changes.

          set_menu_init(m,f) sets the application-defined function f
          to be called when the menu is posted and just after the top
          row changes on a posted menu.

          menu_init(m) returns a pointer to the menu's initialization
          routine, if any, called when the menu is posted and just
          after the top row changes on a posted menu.

          set_menu_term(m,f) sets the application-defined function f
          to be called when the menu is unposted and just before the
          top row changes on a posted menu.

          menu_term(m) returns a pointer to the menu's termination
          routine, if any, called when the menu is unposted and just
          before the top row changes on a posted menu.

          The current item is the item where the cursor is currently
          positioned.  set_current_item(m,i) sets the current menu
          item to the given item.

          current_item(m) returns a pointer to the current item.

          item_index(i) returns the index to the given item in the
          item pointer array.

          set_top_row(m,c) sets the top of the menu to the named row.
          The leftmost item on the new top row becomes the current
          item.

          top_row(m) returns the number of the menu row currently
          displayed at the top of the given menu.

          pos_menu_cursor(m) moves the menu window's cursor to the
          correct position to resume menu processing.

          Every menu has a pattern buffer to match entered data with
          menu items.  set_menu_pattern(m,p) sets the pattern buffer
          to the given pattern and tries to find the first item that
          matches the pattern.  If it does, the matching item becomes
          the current item.  If not, the current item does not change.

          menu_pattern(m) returns the string in the pattern buffer of
          the given menu.

          Every menu has an associated user pointer that you can use
          to store pertinent information.

          set_menu_userptr(m,n) sets the menu's user pointer.

          menu_userptr(m) returns the menu's user pointer.

          set_menu_opts(m,o) turns on the named options for the menu
          and turns off all its remaining options.  Options are
          boolean values.  Menu options are O_ONEVALUE, O_SHOWDESC,
          O_ROWMAJOR, O_IGNORECASE, and O_SHOWMATCH.

          menu_opts(m) returns the menu's option setting.

          menu_opts_on(m,opts) turns on the named options for the
          menu.

          menu_opts_off(m,opts) turns off the named options for the
          menu.

     See Also
          curses(S), field(S), fieldtype(S), form(S), item(S),
          panel(S), tam(S)

     Diagnostics
          The following values are returned by one or more routines
          that return an integer.

          E_OK                routine returned normally

          E_SYSTEM_ERROR      system error

          E_BAD_ARGUMENT      an incorrect argument was passed to the
                              routine

          E_POSTED            menu is already posted

          E_CONNECTED         one or more items are connected to
                              another menu

          E_BAD_STATE         routine called from an inappropriate
                              routine

          E_NO_ROOM           menu does not fit within its subwindow

          E_NOT_POSTED        menu has not yet been posted

          E_UNKNOWN_COMMAND   unrecognizable request was given to the
                              driver

          E_NO_MATCH          no match occurred

          E_NOT_SELECTABLE    item cannot be selected

          E_NOT_CONNECTED     no items are associated with the menu

          E_REQUEST_DENIED    menu driver could not process the
                              request


                                             (printed 6/20/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026