Go to the source code of this file.
◆ nctree
◆ nctree_int_item
◆ __attribute__()
__attribute__ |
( |
(unused) |
| ) |
|
Definition at line 44 of file tree.c.
45 {
46 unsigned* path = malloc(
sizeof(*path) * (
n->maxdepth + 2));
47 path[0] = UINT_MAX;
48 nctree_debug_internal(&
n->items, path, 0);
50}
◆ nctree_add()
Definition at line 209 of file tree.c.
209 {
210
211 if(spec[0] == UINT_MAX){
213 return -1;
214 }
217 return -1;
218 }
221 return -1;
222 }
223 if(nctree_add_internal(
n, &
n->items, spec, add)){
224 return -1;
225 }
226 if(
n->activerow == -1){
228 n->curitem = &
n->items.subs[0];
229 n->currentpath = malloc(
sizeof(*
n->currentpath) * 3);
230 n->currentpath[0] = 0;
231 n->currentpath[1] = UINT_MAX;
233 }
234 return 0;
235}
#define logerror(fmt,...)
struct nctree_item * subs
◆ nctree_create()
Definition at line 266 of file tree.c.
266 {
269 }
271 logerror(
"can't use the standard plane");
272 goto error;
273 }
275 logerror(
"can't use NULL callback");
276 goto error;
277 }
278 if(
opts->indentcols < 0){
279 logerror(
"can't indent negative columns");
280 goto error;
281 }
284 logerror(
"couldn't prepare nctree");
285 goto error;
286 }
287 return ret;
288
289error:
292}
ncplane * notcurses_stdplane(notcurses *nc)
int ncplane_destroy(ncplane *ncp)
notcurses * ncplane_notcurses(const ncplane *n)
const struct ncplane_options * opts
◆ nctree_del()
int nctree_del |
( |
nctree * |
n, |
|
|
const unsigned * |
spec |
|
) |
| |
Definition at line 237 of file tree.c.
237 {
240 const unsigned* p = spec;
241 while(*p != UINT_MAX){
244 return -1;
245 }
246 parent = nii;
247 nii = &nii->
subs[*p];
248 ++p;
249 }
250 free_tree_items(nii);
251 if(parent){
252
253 unsigned lastelem = spec[-1];
255 memmove(&parent->
subs[lastelem], &parent->
subs[lastelem + 1],
257 }
258 }
259 if(
n->items.subcount == 0){
262 }
263 return 0;
264}
struct nctree_int_item * subs
◆ nctree_destroy()
void nctree_destroy |
( |
nctree * |
n | ) |
|
Definition at line 294 of file tree.c.
294 {
296 free_tree_items(&
n->items);
297 free(
n->currentpath);
299 }
300}
◆ nctree_focused()
void * nctree_focused |
( |
nctree * |
n | ) |
|
Definition at line 606 of file tree.c.
606 {
607 return n->curitem->curry;
608}
◆ nctree_goto()
void * nctree_goto |
( |
nctree * |
n, |
|
|
const unsigned * |
spec, |
|
|
int * |
failspec |
|
) |
| |
Definition at line 610 of file tree.c.
610 {
612 (void)spec;
613 (void)failspec;
614
616}
◆ nctree_next()
void * nctree_next |
( |
nctree * |
n | ) |
|
Definition at line 396 of file tree.c.
396 {
397 int rows = 0;
399 rows = ncplane_dim_y(
n->curitem->ncp);
400 }
402 if(tmp !=
n->curitem){
404 n->activerow += rows;
405 if(
n->activerow >= (
int)ncplane_dim_y(
n->items.ncp)){
406 n->activerow = ncplane_dim_y(
n->items.ncp) - 1;
407 }
408 }
410}
◆ nctree_offer_input()
Definition at line 579 of file tree.c.
579 {
581 return false;
582 }
585 return true;
588 return true;
591 return true;
594 return true;
597 return true;
600 return true;
601 }
602
603 return false;
604}
void * nctree_prev(nctree *n)
void * nctree_next(nctree *n)
◆ nctree_plane()
◆ nctree_prev()
void * nctree_prev |
( |
nctree * |
n | ) |
|
Definition at line 349 of file tree.c.
349 {
350 int rows = 0;
352 rows = ncplane_dim_y(
n->curitem->ncp);
353 }
355 if(tmp !=
n->curitem){
357 n->activerow -= rows;
358 if(
n->activerow < 0){
360 }
361 }
363}
◆ nctree_redraw()
int nctree_redraw |
( |
nctree * |
n | ) |
|
Definition at line 568 of file tree.c.
568 {
569 unsigned* tmppath = malloc(
sizeof(*tmppath) * (
n->maxdepth + 2));
571 return -1;
572 }
573 memcpy(tmppath,
n->currentpath,
sizeof(*tmppath) * (
n->maxdepth + 1));
574 int ret = nctree_inner_redraw(
n, tmppath);
576 return ret;
577}