Esempio n. 1
0
/**
 * Print the current button list at the specified `row` and `col`umn.
 */
size_t button_print(int row, int col)
{
	int j;
	button_mouse *bttn;
	if (button_print_hook) {
		size_t res = (*button_print_hook)(row, col);
		if (res) { // if res != 0
			return res;
		}
	}
	button_1d_start_x = col;
	button_1d_start_y = row;

	for (j = 0; j < button_1d_num; j++)
		put_fstr(col + button_1d_list[j].left, row, CLR_SLATE "%s", button_1d_list[j].label);

	/* print 2d buttons */
	bttn = button_stack;
	while (bttn) {
		if (bttn->label && bttn->label[0]) {
			put_cstr(bttn->left, bttn->top, bttn->label, 0);
		}
		bttn = bttn->next;
	}

	return button_1d_length;
}
Esempio n. 2
0
void menu_refresh(menu_type *menu, bool reset_screen)
{
	int oid = menu->cursor;
	rect_region *loc = &menu->active;

	if (reset_screen) {
		screen_load();
		screen_save();
	}

	if (menu->filter_list && menu->cursor >= 0)
		oid = menu->filter_list[oid];

	if (menu->flags & MN_BORDER) {
		window_make(menu->boundary.col, menu->boundary.row,
			menu->boundary.col + menu->boundary.width,
			menu->boundary.row + menu->boundary.page_rows);
	}

	if (menu->title) {
		if (menu->flags & MN_BORDER) {
			put_cstr(menu->boundary.col+2, menu->boundary.row+2, menu->title, loc->width);
		} else {
			put_cstr(menu->boundary.col, menu->boundary.row, menu->title, loc->width);
		}
	}

	if (menu->header)
		put_cstr(loc->col, loc->row - 1, menu->header, loc->width);

	if (menu->prompt) {
		if (menu->flags & MN_BORDER) {
			put_cstr(menu->boundary.col+2, loc->row + loc->page_rows, menu->prompt, loc->width);
		} else {
			put_cstr(menu->boundary.col, loc->row + loc->page_rows, menu->prompt, loc->width);
		}
		
	}
	if (menu->browse_hook && oid >= 0)
		menu->browse_hook(oid, menu->menu_data, loc);

	menu->skin->display_list(menu, menu->cursor, &menu->top, loc);
}
Esempio n. 3
0
/*
 * Put a string with formatting information at a given location.
 * Clear the line before we start printing.
 */
void prtf(int col, int row, cptr str, ...)
{
	va_list vp;

	char buf[1024];

	/* Begin the Varargs Stuff */
	va_start(vp, str);

	/* Format the args, save the length */
	(void)vstrnfmt(buf, 1024, str, &vp);

	/* End the Varargs Stuff */
	va_end(vp);

	/* Display */
	put_cstr(col, row, buf, TRUE);
}