Example #1
0
struct multilist *multilist_new(TALLOC_CTX *ctx, WINDOW *window,
				const struct multilist_accessors *cb,
				unsigned ncol)
{
	struct multilist *list;

	SMB_ASSERT(ncol > 0);

	list = talloc_zero(ctx, struct multilist);
	if (list == NULL) {
		return NULL;
	}
	talloc_set_destructor(list, multilist_free);

	list->cb = cb;
	list->ncols = ncol;
	list->columns = talloc_zero_array(list, struct multilist_column, ncol);
	if (list->columns == NULL) {
		talloc_free(list);
		return NULL;
	}
	multilist_set_window(list, window);

	return list;
}
Example #2
0
void value_list_resize(struct value_list *vl, int nlines, int ncols,
		       int begin_y, int begin_x)
{
	WINDOW *nwin, *nsub;

	nwin = newwin(nlines, ncols, begin_y, begin_x);
	if (nwin == NULL) {
		return;
	}
	nsub = subwin(nwin, nlines - 2, ncols - 2, begin_y + 1, begin_x + 1);
	if (nsub == NULL) {
		delwin(nwin);
		return;
	}
	replace_panel(vl->panel, nwin);
	delwin(vl->sub);
	delwin(vl->window);
	vl->window = nwin;
	vl->sub = nsub;
	box(vl->window, 0, 0);
	mvwprintw(vl->window, 0, HEADING_X, "Value");
	multilist_set_window(vl->list, vl->sub);
	value_list_show(vl);
}