home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
PUMENU.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-28
|
2KB
|
84 lines
/*
pumenu.c 1/20/87
% pop_Menu
Popup menu routine.
C-scape 3.2
Copyright (c) 1986, 1987, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
9/16/88 jmd updated for 3.0
11/05/88 jmd removed menu_Close
4/22/89 jmd changed border to bord (i was bored at the time)
12/15/89 jdc preened
12/18/89 jmd added mouse support
3/28/90 jmd ansi-fied
*/
#include <stdio.h>
#include "cscape.h"
#include "strdecl.h" /* for invert_char() */
#include "popdecl.h"
int pop_Menu(char *text, char **choice, int row, int col, int height, int width, byte color, int label, bd_fptr bord)
/*
Puts up a popup menu with the text at the top of the box
and the choices displayed at the bottom.
The menu is placed at position (row, col) and with the
given height and width.
If any of these arguments (row, col, height, width) are
negative default values are used (centered).
Choice is a NULL terminated list of pointers to the text of the
choices.
Returns number of the choice (1 - n)
or 0 if ESC pressed.
*/
{
menu_type menu;
sed_type sed;
register int x;
int ret;
/* leave if there are no choices */
if (choice[0] == NULL) {
return(0);
}
if ((menu = menu_Open()) == NULL) {
return(0);
}
for (x = 0; choice[x] != NULL; x++) {
if (!menu_Printf(menu," @f[%s] \n", NULL, &menu_funcs, choice[x])) {
menu_Destroy(menu);
return(0);
}
}
menu_Flush(menu);
if ((sed = sed_Open(menu)) == NULL) {
menu_Destroy(menu);
return(0);
}
sed_SetColors(sed, color, color, invert_char(color) & 0x7f);
sed_SetBorder(sed, bord);
sed_SetMouse(sed, sedmou_GreedyTrack);
pop_SetParms(sed, row, col, height, width, text);
sed_SetLabel(sed, label);
sed_Repaint(sed);
ret = sed_Go(sed);
sed_Close(sed);
return(ret);
}