Dialog

 view release on metacpan or  search on metacpan

Dialog.xs  view on Meta::CPAN

	PROTOTYPE:

void
Clear()
	PROTOTYPE:
	CODE:
	dialog_clear();

int
YesNo(title, prompt, height, width)
char *	title
char *	prompt
int	height
int	width
	PROTOTYPE: $$$$
	CODE:
	RETVAL = ! dialog_yesno(title, prompt, height, width);
	OUTPUT:
	RETVAL

int
PrgBox(title, line, height, width, pause=1, use_shell=1)
char *	title
char *	line
int	height
int	width
int	pause
int	use_shell
	PROTOTYPE: $$$$;$$
	CODE:
	RETVAL = dialog_prgbox(title, line, height, width, pause, use_shell);
	OUTPUT:
	RETVAL

int
MsgBox(title, prompt, height, width, pause=1)
char *	title
char *	prompt
int	height
int	width
int	pause
	PROTOTYPE: $$$$;$
	CODE:
	RETVAL = dialog_msgbox(title, prompt, height, width, pause);
	OUTPUT:
	RETVAL

int
TextBox(title, file, height, width)
char *	title
char *	file
int	height
int	width
	PROTOTYPE: $$$$
	CODE:
	RETVAL = dialog_textbox(title, file, height, width);
	OUTPUT:
	RETVAL

void
Menu(title, prompt, height, width, menu_height, menu_item1, ...)
char *		title
char *		prompt
int		height
int		width
int		menu_height
SV *		menu_item1 = NO_INIT
	PROTOTYPE: $$$$$@
	PREINIT:
	int item_no, i, cancel, zero = 0;
	uchar **item_list, **item_ptr, *item;
	uchar *result;
	size_t size = 0, tmpsz, len;
	PPCODE:
	item_no = items - 5;
	New(0,item_list,2 * item_no,uchar*);
	item_ptr = item_list;
	for(i=0; i<item_no; i++) {
	  *(item_ptr++) = item = SvPV(ST(i+5), na);
	  tmpsz = na + 1;
	  if(tmpsz > size) size = tmpsz;
	  len = strlen(item);
	  *(item_ptr++) = item + len + (len < na);
	}
	New(0,result,size,char);
	cancel = dialog_menu(title, prompt, height, width, menu_height,
	  item_no, item_list, result, &zero, &zero);
	if(!cancel) XPUSHs(sv_2mortal(newSVpv(result, 0)));
	Safefree(result);
	Safefree(item_list);

void
CheckList(title, prompt, height, width, list_height, menu_item1, ...)
char *		title
char *		prompt
int		height
int		width
int		list_height
SV *		menu_item1 = NO_INIT
	PROTOTYPE: $$$$$@
	PREINIT:
	int item_no, i, cancel;
	uchar **item_list, **item_ptr, *item;
	uchar *result, *strb, *stre;
	size_t size = 1, len;
	PPCODE:
	item_no = items - 5;
	New(0,item_list,3 * item_no,uchar*);
	item_ptr = item_list;
	for(i=0; i<item_no; i++) {
	  *(item_ptr++) = item = SvPV(ST(i+5), na);
	  size += na + 1;
	  len = strlen(item);
	  *(item_ptr++) = item + len + (len < na);
	  *(item_ptr++) = item + len;
	}
	New(0,result,size,char);
	cancel = dialog_checklist(title, prompt, height, width, list_height,
	  item_no, item_list, result);
	if(!cancel) {
	  if(*result == '\0') XPUSHs(sv_2mortal(newSVpv("", 0)));



( run in 2.691 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )