selector PoC: ncplane_new -> ncplane_create #1115

This commit is contained in:
nick black 2020-11-14 17:31:16 -05:00 committed by Nick Black
parent 4a5fb14bc1
commit 0215f9482b

View File

@ -98,20 +98,30 @@ int main(void){
ncplane_set_fg_rgb(n, 0x40f040); ncplane_set_fg_rgb(n, 0x40f040);
ncplane_putstr_aligned(n, 0, NCALIGN_RIGHT, "selector widget demo"); ncplane_putstr_aligned(n, 0, NCALIGN_RIGHT, "selector widget demo");
struct ncplane* seln = ncplane_new(n, 1, 1, 3, 0, NULL, NULL); struct ncplane_options nopts = {
.y = 3,
.horiz = { .x = 0, },
.rows = 1,
.cols = 1,
.userptr = NULL,
.name = NULL,
.resizecb = NULL,
.flags = 0,
};
struct ncplane* seln = ncplane_create(n, &nopts);
ncplane_set_base(seln, "", 0, bgchannels); ncplane_set_base(seln, "", 0, bgchannels);
struct ncselector* ns = ncselector_create(seln, &sopts); struct ncselector* ns = ncselector_create(seln, &sopts);
run_selector(nc, ns); run_selector(nc, ns);
sopts.title = "short round title"; sopts.title = "short round title";
seln = ncplane_new(n, 1, 1, 3, 0, NULL, NULL); seln = ncplane_create(n, &nopts);
ncplane_set_base(seln, "", 0, bgchannels); ncplane_set_base(seln, "", 0, bgchannels);
ns = ncselector_create(seln, &sopts); ns = ncselector_create(seln, &sopts);
run_selector(nc, ns); run_selector(nc, ns);
sopts.title = "short round title"; sopts.title = "short round title";
sopts.secondary = "now this secondary is also very, very, very outlandishly long, you see"; sopts.secondary = "now this secondary is also very, very, very outlandishly long, you see";
seln = ncplane_new(n, 1, 1, 3, 0, NULL, NULL); seln = ncplane_create(n, &nopts);
ncplane_set_base(seln, "", 0, bgchannels); ncplane_set_base(seln, "", 0, bgchannels);
ns = ncselector_create(seln, &sopts); ns = ncselector_create(seln, &sopts);
run_selector(nc, ns); run_selector(nc, ns);
@ -119,7 +129,7 @@ int main(void){
sopts.title = "the whole world is watching"; sopts.title = "the whole world is watching";
sopts.secondary = NULL; sopts.secondary = NULL;
sopts.footer = "now this FOOTERFOOTER is also very, very, very outlandishly long, you see"; sopts.footer = "now this FOOTERFOOTER is also very, very, very outlandishly long, you see";
seln = ncplane_new(n, 1, 1, 3, 0, NULL, NULL); seln = ncplane_create(n, &nopts);
ncplane_set_base(seln, "", 0, bgchannels); ncplane_set_base(seln, "", 0, bgchannels);
ns = ncselector_create(seln, &sopts); ns = ncselector_create(seln, &sopts);
run_selector(nc, ns); run_selector(nc, ns);
@ -127,7 +137,7 @@ int main(void){
sopts.title = "chomps"; sopts.title = "chomps";
sopts.secondary = NULL; sopts.secondary = NULL;
sopts.footer = NULL; sopts.footer = NULL;
seln = ncplane_new(n, 1, 1, 3, 0, NULL, NULL); seln = ncplane_create(n, &nopts);
ncplane_set_base(seln, "", 0, bgchannels); ncplane_set_base(seln, "", 0, bgchannels);
ns = ncselector_create(seln, &sopts); ns = ncselector_create(seln, &sopts);
run_selector(nc, ns); run_selector(nc, ns);