Commit 9a62509f authored by deuce's avatar deuce
Browse files

Add new option WIN_FIXEDHEIGHT which uses the height in uifc.list_height

as the height of the listbox rather than calculating it.
Allow list title to be NULL.
parent 597c7ef7
......@@ -187,6 +187,7 @@
#define WIN_EXTKEYS (1<<23) /* Return on any keypress... if it's not handled internally
* Return value is -2 - keyvalue */
#define WIN_NOBRDR (1<<24) /* Do not draw a border around the window */
#define WIN_FIXEDHEIGHT (1<<25) /* Use list_height from uifc struct */
#define WIN_MID WIN_L2R|WIN_T2B /* Place window in middle of screen */
......@@ -349,6 +350,10 @@ typedef struct {
int helpstart;
int helpend;
/****************************************************************************/
/* List height for WIN_FIXEDHEIGHT lists. */
/****************************************************************************/
int list_height;
/****************************************************************************/
/* Exit/uninitialize function. */
/****************************************************************************/
void (*bail) (void);
......
......@@ -498,15 +498,11 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
int bbrdrwidth=1;
uint title_len;
struct mouse_event mevnt;
char *title;
char *title=NULL;
int a,b,c,longopt;
if((title=(char *)MALLOC(strlen(initial_title)+1))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,strlen(title)+1);
return(-1);
}
strcpy(title,initial_title);
title=strdup(initial_title==NULL?"":initial_title);
uifc_mouse_disable();
title_len=strlen(title);
......@@ -540,6 +536,11 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
if(mode&WIN_XTR && opts<MAX_OPTS)
opts++;
height=opts+hbrdrsize+2;
if(mode&WIN_FIXEDHEIGHT) {
gotoxy(30,1);
cprintf("Height is: %d",api->list_height);
height=api->list_height;
}
if(top+height>s_bottom)
height=(s_bottom)-top;
if(!width || width<title_len+hbrdrsize+2) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment