From 0215f9482b94ae59bfdf151ad202df1a1dd1e17b Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 14 Nov 2020 17:31:16 -0500 Subject: [PATCH] selector PoC: ncplane_new -> ncplane_create #1115 --- src/poc/selector.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/poc/selector.c b/src/poc/selector.c index 556c6b439..644d4375e 100644 --- a/src/poc/selector.c +++ b/src/poc/selector.c @@ -98,20 +98,30 @@ int main(void){ ncplane_set_fg_rgb(n, 0x40f040); 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); struct ncselector* ns = ncselector_create(seln, &sopts); run_selector(nc, ns); 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); ns = ncselector_create(seln, &sopts); run_selector(nc, ns); sopts.title = "short round title"; 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); ns = ncselector_create(seln, &sopts); run_selector(nc, ns); @@ -119,7 +129,7 @@ int main(void){ sopts.title = "the whole world is watching"; sopts.secondary = NULL; 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); ns = ncselector_create(seln, &sopts); run_selector(nc, ns); @@ -127,7 +137,7 @@ int main(void){ sopts.title = "chomps"; sopts.secondary = 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); ns = ncselector_create(seln, &sopts); run_selector(nc, ns);