AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox

01.01.2013 Views

MENU (3T) (AT&T UNIX PC only ) MENU (3T) mitem_t *m_topi; } menu_t; j* item at top of dpy * / M_label is displayed in the menu's window label line. If m_label is NULL, no label is displayed. M_title is a title for the menu. If m_title is NULL, the menu is displayed without any title. If m_title contains newline characters, all but the first line of the title are underlined. M_prompt (when non-NULL) is an prompt for the menu. All prompts are displayed on the system prompt line, generally located at the bottom of the display. M_rows and m_cols allow the caller to specify the number of rows and columns of items. Either or both of these values may be zero, in which case menu will try to pick "good" values. It is quite common to specify "zero" rows and one column to force output to be vertical. When both m_rows and m_cols are zero, menu tries to fit the menu into an appealing rectangle. M_iwidth specifies a maximum width for each item. If m_iwidth is zero, menu will display as much of the item as possible given the available window real-estate. If m_iwidth is non-zero, items are automatically truncated to that width, regardless of other parameters. This is very useful when generating multi-column menus where the caller wishes to prevent one long item from disrupting the columnar output. M_IWIDTH IS NOT YET IMPLE- ·1 MENTED. M_iheight allows the caller to specify the number of rows per item on the display. Newline characters in the item's name cause menu to advance to the next row. If m_iheight is zero, one-row items are assumed. M_IHEIGHT IS NOT YET IMPLEMENTED. M_ft ags contains the M_SINGLE flag which prohibits the user from selecting more than one item from the menu. If the M_SINGLE flag is off, the user may select multiple items from the menu. The M_USEWIN flag, if set, will cause menu to use the window supplied in m_win instead of creating its own. If M_USEWIN is set, M_BEGIN operations will re-size the window (as necessary) and M_END operations do not delete the window. The M_WINNEW flag causes menu to use the "new " algorithm to place the window. Basically, the new algorithm looks for relatively empty screen space to place the window. M_ WINSON causes menu to use the "son" algorithm which causes the new window to slightly overlap the current window. If neither M_WINNEW nor M_WINSON is given, the "popup" algorithm is used. This causes the new window to appear near the middle of � the current window, inside it if possible. The M_NOMOVE, M_NOHELP, and M_NORESIZE flags, if set, prevent the Move, Help and Resize icons, respectively, from being displayed on the menu border. The M....ASISTITLE flag, if set, causes the menu title to be displayed as supplied by the user, i.e., without centering. - 2-

MENU (3T) (AT&T UNIX PC only ) MENU (3T) M_lbuf is an array of characters which is used to assemble typed input. It is always returned to the caller in case it is necessary to record keystrokes. In addition, the user may enter keystroke data which does not match any items. In this case m_selcnt is set to zero on return. M_win holds the window identifier associated with this menu. It is allocated on an M_BEGIN call, used on subsequent calls, and deleted on an M_END call. M_track is a pointer to the mousetracking information required during menu interaction. The space for this data is allocated on M_BEGIN and freed on M_END. The caller should not use m_track, m_oldwidth, or m_oldheight. They may be left un-initialized on call to M_BEGIN. If a value must be given (as in a mitem_t initializer), a value of zero should be used. On return, m_selcnt contains a count of the number of selected items. M_items points to the array of menu items (see below). M_ curi points to the current item. The caller should point m_curi to the default item. Menu will modify m_curi as the user moves the highlighting around in the menu. The list of menu items is terminated by an item whose mi_name is NULL. M_topi contains a pointer to the item which is at the top of the display. As the window scrolls through the menu, m_topi changes to reflect the new position of the view. The caller needn't initialize m_topi as menu will compute a "good" initial view from the value in m_curi. In general, callers will not read the value in m_topi and should never write it. Each item in the array pointed to by m_items and m_curi has the following form: typedef struct { char char int } mitem_t; *mi_name; mi_flags; mi_val; /* name of item * / /* flags * / /* user-supplied value * / Mi_name is the item name, mi_ftags contains the M_MARKED flag which indicates that this item should be marked (on call) and/or was marked (on return) and/or the M_DIMMED flag which indicates that this item should be displayed in lowerintensity. Mi_val is unused by menu and is available for application-specific data. Often, mi_val contains a small positive integer identifying the particular choice. EXAMPLE The following program illustrates a simple single-selection menu: #include #include #include #include - 3-

MENU (3T) (AT&T UNIX PC only ) MENU (3T)<br />

M_lbuf is an array of characters which is used to assemble typed<br />

input. It is always returned to the caller in case it is necessary to<br />

record keystrokes. In addition, the user may enter keystroke data<br />

which does not match any items. In this case m_selcnt is set to<br />

zero on return.<br />

M_win holds the window identifier associated with this menu. It<br />

is allocated on an M_BEGIN call, used on subsequent calls, and<br />

deleted on an M_END call. M_track is a pointer to the mousetracking<br />

information required during menu interaction. The space<br />

for this data is allocated on M_BEGIN and freed on M_END.<br />

The caller should not use m_track, m_oldwidth, or m_oldheight.<br />

They may be left un-initialized on call to M_BEGIN. If a value<br />

must be given (as in a mitem_t initializer), a value of zero should<br />

be used.<br />

On return, m_selcnt contains a count of the number of selected<br />

items.<br />

M_items points to the array of menu items (see below). M_ curi<br />

points to the current item. The caller should point m_curi to the<br />

default item. Menu will modify m_curi as the user moves the<br />

highlighting around in the menu. The list of menu items is terminated<br />

by an item whose mi_name is NULL. M_topi contains a<br />

pointer to the item which is at the top of the display. As the window<br />

scrolls through the menu, m_topi changes to reflect the new<br />

position of the view. The caller needn't initialize m_topi as menu<br />

will compute a "good" initial view from the value in m_curi. In<br />

general, callers will not read the value in m_topi and should never<br />

write it.<br />

Each item in the array pointed to by m_items and m_curi has<br />

the following form:<br />

typedef struct<br />

{<br />

char<br />

char<br />

int<br />

} mitem_t;<br />

*mi_name;<br />

mi_flags;<br />

mi_val;<br />

/* name of item * /<br />

/* flags * /<br />

/* user-supplied value * /<br />

Mi_name is the item name, mi_ftags contains the M_MARKED<br />

flag which indicates that this item should be marked (on call)<br />

and/or was marked (on return) and/or the M_DIMMED flag<br />

which indicates that this item should be displayed in lowerintensity.<br />

Mi_val is unused by menu and is available for<br />

application-specific data. Often, mi_val contains a small positive<br />

integer identifying the particular choice.<br />

EXAMPLE<br />

The following program illustrates a simple single-selection menu:<br />

#include <br />

#include <br />

#include <br />

#include <br />

- 3-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!