Dialog

 view release on metacpan or  search on metacpan

Dialog.xs  view on Meta::CPAN

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)));
	  else {
	    for(strb = result; *strb; strb = stre+1) {
	      *(stre = strchr(strb, '\n')) = '\0';
	      XPUSHs(sv_2mortal(newSVpv(strb, 0)));
	    }
	  }
	}
	Safefree(result);
	Safefree(item_list);

void
RadioList(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;
	size_t size = 0, tmpsz, 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_radiolist(title, prompt, height, width, list_height,
	  item_no, item_list, result);
	if(!cancel) XPUSHs(sv_2mortal(newSVpv(result, 0)));
	Safefree(result);
	Safefree(item_list);

void
InputBox(title, prompt, height, width, line)
char *		title
char *		prompt
int		height
int		width
char *		line
	PROTOTYPE: $$$$$
	PREINIT:
	int cancel;
	uchar *result;
	PPCODE:
	New(0,result,MAX_LEN,char);
	strncpy(result, line, MAX_LEN);
	cancel = dialog_inputbox(title, prompt, height, width, result);
	if(!cancel) XPUSHs(sv_2mortal(newSVpv(result, 0)));
	Safefree(result);

int
Y()
	PREINIT:
	int x;
	CODE:
	getsyx(RETVAL, x);
	OUTPUT:
	RETVAL

int
X()
	PREINIT:
	int y;
	CODE:
	getsyx(y, RETVAL);
	OUTPUT:
	RETVAL



( run in 1.952 second using v1.01-cache-2.11-cpan-5511b514fd6 )