25 unsigned drawn_cols = 0;
35 ncplane_resize_simple(nt->
hp, -1, cols);
36 ncplane_resize_simple(nt->
p, rows - 1, cols);
39 ncplane_resize_simple(nt->
hp, -1, cols);
40 ncplane_resize_simple(nt->
p, rows - 1, cols);
53 drawn_cols += ncplane_putstr(nt->
hp, t->
name);
56 drawn_cols += ncplane_putstr(nt->
hp, t->
name);
66 }
while(t != nt->
leftmost && drawn_cols < cols);
71 int cols = ncplane_dim_x(nt->
hp);
82 if(takencols >= cols){
98 if(
opts->sepchan && !
opts->separator){
99 logwarn(
"provided non-zero separator channel when separator is NULL")
151 unsigned nrows, ncols;
156 if(!nctabbed_validate_opts(topts)){
159 if((nt = malloc(
sizeof(*nt))) ==
NULL){
160 logerror(
"Couldn't allocate nctabbed");
174 logerror(
"Separator string contains illegal characters");
178 logerror(
"Couldn't allocate nctabbed separator");
184 nopts.
y = nopts.
x = 0;
186 nopts.
rows = nrows - 1;
188 logerror(
"Couldn't create the tab content plane");
194 logerror(
"Couldn't create the tab headers plane");
199 nopts.
y = nopts.
x = 0;
203 logerror(
"Couldn't create the tab headers plane");
207 nopts.
rows = nrows - 1;
209 logerror(
"Couldn't create the tab content plane");
232 const char* name,
void* opaque){
235 if(after->
next != before || before->
prev != after){
236 logerror(
"bad before (%p) / after (%p) spec", before, after);
239 }
else if(!after && !before){
243 if((t = malloc(
sizeof(*t))) ==
NULL){
247 if((t->
name = strdup(name)) ==
NULL){
248 logerror(
"Couldn't allocate the tab name");
253 logerror(
"Tab name contains illegal characters")
305 if(after->
prev != before || before->
next != after){
306 logerror(
"bad before (%p) / after (%p) spec", before, after);
309 }
else if(!after && !before){
310 logerror(
"bad before (%p) / after (%p) spec", before, after);
314 if(t == after || t == before){
315 logerror(
"Cannot move a tab before or after itself.");
358 for(
int i = 0 ; i < amt ; ++i){
362 for(
int i = 0 ; i < -amt ; ++i){
393 memcpy(hdrchan, &nt->
opts.
hdrchan,
sizeof(*hdrchan));
396 memcpy(selchan, &nt->
opts.
selchan,
sizeof(*selchan));
399 memcpy(sepchan, &nt->
opts.
sepchan,
sizeof(*sepchan));
456 char* prevname = t->
name;
458 logerror(
"New tab name contains illegal characters");
461 if((t->
name = strdup(newname)) ==
NULL){
462 logerror(
"Couldn't allocate new tab name");
472 void* prevcurry = t->
curry;
473 t->
curry = newopaque;
481 logerror(
"New tab separator contains illegal characters");
485 logerror(
"Couldn't allocate new tab separator");
__attribute__((nonnull(1)))
#define logerror(fmt,...)
void ncplane_set_channels(ncplane *n, uint64_t channels)
int ncplane_destroy(ncplane *ncp)
int ncplane_move_yx(ncplane *n, int y, int x)
int ncstrwidth(const char *egcs, int *validbytes, int *validwidth)
ncplane * ncplane_create(ncplane *n, const ncplane_options *nopts)
void ncplane_erase(ncplane *n)
int ncplane_family_destroy(ncplane *ncp)
void ncplane_dim_yx(const ncplane *n, unsigned *rows, unsigned *cols)
void(* tabcb)(struct nctab *t, struct ncplane *ncp, void *curry)
const struct ncplane_options * opts
#define NCTABBED_OPTION_BOTTOM
int nctab_name_width(nctab *t)
void nctabbed_rotate(nctabbed *nt, int amt)
nctab * nctabbed_selected(nctabbed *nt)
void nctabbed_set_sepchan(nctabbed *nt, uint64_t chan)
int nctab_move(nctabbed *nt __attribute__((unused)), nctab *t, nctab *after, nctab *before)
nctab * nctabbed_prev(nctabbed *nt)
const char * nctabbed_separator(nctabbed *nt)
tabcb nctab_set_cb(nctab *t, tabcb newcb)
void nctab_move_left(nctabbed *nt, nctab *t)
int nctabbed_separator_width(nctabbed *nt)
nctab * nctabbed_select(nctabbed *nt, nctab *t)
void nctabbed_destroy(nctabbed *nt)
void nctabbed_set_hdrchan(nctabbed *nt, uint64_t chan)
nctab * nctab_next(nctab *t)
int nctabbed_del(nctabbed *nt, nctab *t)
void nctabbed_redraw(nctabbed *nt)
nctab * nctabbed_leftmost(nctabbed *nt)
void nctab_move_right(nctabbed *nt, nctab *t)
int nctabbed_set_separator(nctabbed *nt, const char *separator)
nctab * nctabbed_add(nctabbed *nt, nctab *after, nctab *before, tabcb cb, const char *name, void *opaque)
void nctabbed_channels(nctabbed *nt, uint64_t *RESTRICT hdrchan, uint64_t *RESTRICT selchan, uint64_t *RESTRICT sepchan)
nctabbed * nctabbed_create(ncplane *n, const nctabbed_options *topts)
void * nctab_set_userptr(nctab *t, void *newopaque)
ncplane * nctabbed_content_plane(nctabbed *nt)
ncplane * nctabbed_plane(nctabbed *nt)
int nctabbed_tabcount(nctabbed *nt)
void nctabbed_set_selchan(nctabbed *nt, uint64_t chan)
void nctabbed_ensure_selected_header_visible(nctabbed *nt)
void * nctab_userptr(nctab *t)
const char * nctab_name(nctab *t)
nctab * nctab_prev(nctab *t)
int nctab_set_name(nctab *t, const char *newname)
nctab * nctabbed_next(nctabbed *nt)