mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
remove bgchannels field from selector_options #627
This commit is contained in:
parent
306948507f
commit
4f04f1bc31
14
NEWS.md
14
NEWS.md
@ -6,12 +6,14 @@ rearrangements of Notcurses.
|
||||
all widgets, has been effected. Sorry, there was no getting around this
|
||||
one. Pretty much all widgets have slightly changed, because pretty much all
|
||||
widgets previously behaved slightly differently:
|
||||
* `ncselector` no longer accepts `y, x` placement parameters.
|
||||
* `ncselector` now takes ownership of the provided `ncplane`. It is
|
||||
destroyed by `ncselector_destroy`/`ncselector_create`.
|
||||
* `ncmultiselector` no longer accepts `y, x` placement parameters.
|
||||
* `ncmultiselector` now takes ownership of the provided `ncplane`. It is
|
||||
destroyed by `ncmultiselector_destroy`/`ncmultiselector_create`.
|
||||
* `ncselector_create()` and `ncmultiselector_create()` now take ownership
|
||||
of the provided `ncplane`. On an error in these functions, the `ncplane`
|
||||
will be destroyed. Otherwise, the `ncplane` is destroyed by
|
||||
`ncselector_destroy()` or `ncmultiselector_destroy()`.
|
||||
* `ncselector_create()` and `ncmultiselector_create()` no longer accept
|
||||
`int y, int x` placement parameters. Just place the `ncplane`.
|
||||
* `ncselector_options` and `ncmultiselector_options` have lost their
|
||||
`bgchannels` members. Just set the base character for the `ncplane`.
|
||||
* ...
|
||||
|
||||
* 1.7.2 (2020-09-09)
|
||||
|
@ -37,7 +37,6 @@ typedef struct ncmultiselector_options {
|
||||
uint64_t titlechannels;// title channels
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels for body
|
||||
unsigned flags; // bitfield over NCMULTISELECTOR_OPTION_*
|
||||
} ncmultiselector_options;
|
||||
```
|
||||
|
@ -36,7 +36,6 @@ typedef struct ncselector_options {
|
||||
uint64_t titlechannels;// title channels
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels for body
|
||||
unsigned flags; // bitfield over NCSELECTOR_OPTION_*
|
||||
} ncselector_options;
|
||||
```
|
||||
|
@ -2692,7 +2692,6 @@ typedef struct ncselector_options {
|
||||
uint64_t titlechannels;// title channels
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels, used only in body
|
||||
uint64_t flags; // bitfield of NCSELECTOR_OPTION_*
|
||||
} ncselector_options;
|
||||
|
||||
@ -2768,7 +2767,6 @@ typedef struct ncmultiselector_options {
|
||||
uint64_t titlechannels;// title channels
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels, used only in body
|
||||
uint64_t flags; // bitfield of NCMULTISELECTOR_OPTION_*
|
||||
} ncmultiselector_options;
|
||||
|
||||
|
@ -246,7 +246,7 @@ typedef struct ncselector_options {
|
||||
uint64_t titlechannels;// title channels
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels, used only in body
|
||||
uint64_t flags; // bitmap over NCSELECTOR_OPTIONS_*
|
||||
} ncselector_options;
|
||||
struct ncselector* ncselector_create(struct ncplane* n, const ncselector_options* opts);
|
||||
int ncselector_additem(struct ncselector* n, const struct ncselector_item* item);
|
||||
@ -275,7 +275,7 @@ typedef struct ncmultiselector_options {
|
||||
uint64_t titlechannels;// title channels
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels, used only in body
|
||||
uint64_t flags; // bitmap over NCSELECTOR_OPTIONS_*
|
||||
} ncmultiselector_options;
|
||||
struct ncmultiselector* ncmultiselector_create(struct ncplane* n, const ncmultiselector_options* opts);
|
||||
int ncmultiselector_selected(struct ncmultiselector* n, bool* selected, unsigned count);
|
||||
@ -316,7 +316,6 @@ typedef struct ncreel_options {
|
||||
unsigned tabletmask;
|
||||
uint64_t tabletchan;
|
||||
uint64_t focusedchan;
|
||||
uint64_t bgchannel;
|
||||
unsigned flags; // bitfield over NCREEL_OPTION_*
|
||||
} ncreel_options;
|
||||
struct ncreel* ncreel_create(struct ncplane* nc, const ncreel_options* popts);
|
||||
@ -353,6 +352,7 @@ typedef struct ncplot_options {
|
||||
uint64_t rangex;
|
||||
unsigned flags;
|
||||
const char* title;
|
||||
uint64_t flags; // bitmap over NCPLOT_OPTIONS_*
|
||||
} ncplot_options;
|
||||
struct ncuplot* ncuplot_create(struct ncplane* n, const ncplot_options* opts, uint64_t miny, uint64_t maxy);
|
||||
struct ncdplot* ncdplot_create(struct ncplane* n, const ncplot_options* opts, double miny, double maxy);
|
||||
@ -370,6 +370,7 @@ bool ncplane_set_scrolling(struct ncplane* n, bool scrollp);
|
||||
typedef struct ncfdplane_options {
|
||||
void* curry; // parameter provided to callbacks
|
||||
bool follow; // keep reading after hitting end? (think tail -f)
|
||||
uint64_t flags; // bitmap over NCPLOT_OPTIONS_*
|
||||
} ncfdplane_options;
|
||||
typedef int(ncfdplane_callback)(struct ncfdplane* n, const void* buf, size_t s, void* curry);
|
||||
typedef int(ncfdplane_done_cb)(struct ncfdplane* n, int fderrno, void* curry);
|
||||
@ -379,6 +380,7 @@ int ncfdplane_destroy(struct ncfdplane* n);
|
||||
typedef struct ncsubproc_options {
|
||||
void* curry;
|
||||
uint64_t restart_period; // restart this many seconds after an exit (watch)
|
||||
uint64_t flags; // bitmap over NCPLOT_OPTIONS_*
|
||||
} ncsubproc_options;
|
||||
struct ncsubproc* ncsubproc_createv(struct ncplane* n, const ncsubproc_options* opts, const char* bin, char* const arg[], ncfdplane_callback cbfxn, ncfdplane_done_cb donecbfxn);
|
||||
struct ncsubproc* ncsubproc_createvp(struct ncplane* n, const ncsubproc_options* opts, const char* bin, char* const arg[], ncfdplane_callback cbfxn, ncfdplane_done_cb donecbfxn);
|
||||
|
@ -73,14 +73,15 @@ multiselector_demo(struct ncplane* n, struct ncplane* under, int y){
|
||||
.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0),
|
||||
.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0x20, 0),
|
||||
.titlechannels = CHANNELS_RGB_INITIALIZER(0x80, 0x80, 0xff, 0, 0, 0x20),
|
||||
.bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x40, 0, 0, 0x40, 0),
|
||||
};
|
||||
channels_set_fg_alpha(&mopts.bgchannels, CELL_ALPHA_BLEND);
|
||||
channels_set_bg_alpha(&mopts.bgchannels, CELL_ALPHA_BLEND);
|
||||
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x40, 0, 0, 0x40, 0);
|
||||
channels_set_fg_alpha(&bgchannels, CELL_ALPHA_BLEND);
|
||||
channels_set_bg_alpha(&bgchannels, CELL_ALPHA_BLEND);
|
||||
struct ncplane* mseln = ncplane_new(ncplane_notcurses(n), 1, 1, y, 0, NULL);
|
||||
if(mseln == NULL){
|
||||
return NULL;
|
||||
}
|
||||
ncplane_set_base(mseln, "", 0, bgchannels);
|
||||
struct ncmultiselector* mselect = ncmultiselector_create(mseln, &mopts);
|
||||
if(mselect == NULL){
|
||||
return NULL;
|
||||
@ -102,19 +103,20 @@ selector_demo(struct ncplane* n, struct ncplane* under, int dimx, int y){
|
||||
.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0),
|
||||
.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0, 0),
|
||||
.titlechannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0x80, 0, 0, 0x20),
|
||||
.bgchannels = CHANNELS_RGB_INITIALIZER(0, 0, 0x40, 0, 0, 0x40),
|
||||
};
|
||||
channels_set_fg_alpha(&sopts.bgchannels, CELL_ALPHA_BLEND);
|
||||
channels_set_bg_alpha(&sopts.bgchannels, CELL_ALPHA_BLEND);
|
||||
struct ncplane* mplane = ncplane_new(ncplane_notcurses(n), 1, 1, y, dimx, NULL);
|
||||
if(mplane == NULL){
|
||||
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0, 0x40, 0, 0, 0x40);
|
||||
channels_set_fg_alpha(&bgchannels, CELL_ALPHA_BLEND);
|
||||
channels_set_bg_alpha(&bgchannels, CELL_ALPHA_BLEND);
|
||||
struct ncplane* seln = ncplane_new(ncplane_notcurses(n), 1, 1, y, dimx, NULL);
|
||||
if(seln == NULL){
|
||||
return NULL;
|
||||
}
|
||||
struct ncselector* selector = ncselector_create(mplane, &sopts);
|
||||
ncplane_set_base(seln, "", 0, bgchannels);
|
||||
struct ncselector* selector = ncselector_create(seln, &sopts);
|
||||
if(selector == NULL){
|
||||
return NULL;
|
||||
}
|
||||
ncplane_move_below(mplane, under);
|
||||
ncplane_move_below(seln, under);
|
||||
return selector;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@ typedef struct ncselector {
|
||||
int secondarycols; // columns occupied by secondary
|
||||
char* footer; // can be NULL
|
||||
int footercols; // columns occupied by footer
|
||||
cell background; // background, used in body only
|
||||
uint64_t opchannels; // option channels
|
||||
uint64_t descchannels; // description channels
|
||||
uint64_t titlechannels; // title channels
|
||||
@ -38,7 +37,6 @@ typedef struct ncmultiselector {
|
||||
int secondarycols; // columns occupied by secondary
|
||||
char* footer; // can be NULL
|
||||
int footercols; // columns occupied by footer
|
||||
cell background; // background, used in body only
|
||||
uint64_t opchannels; // option channels
|
||||
uint64_t descchannels; // description channels
|
||||
uint64_t titlechannels; // title channels
|
||||
@ -71,6 +69,9 @@ ncselector_body_width(const ncselector* n){
|
||||
static int
|
||||
ncselector_draw(ncselector* n){
|
||||
ncplane_erase(n->ncp);
|
||||
cell transchar = CELL_TRIVIAL_INITIALIZER;
|
||||
cell_set_fg_alpha(&transchar, CELL_ALPHA_TRANSPARENT);
|
||||
cell_set_bg_alpha(&transchar, CELL_ALPHA_TRANSPARENT);
|
||||
// if we have a title, we'll draw a riser. the riser is two rows tall, and
|
||||
// exactly four columns longer than the title, and aligned to the right. we
|
||||
// draw a rounded box. the body will blow part or all of the bottom away.
|
||||
@ -134,7 +135,7 @@ ncselector_draw(ncselector* n){
|
||||
++yoff;
|
||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||
for(int i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||
ncplane_putc(n->ncp, &n->background);
|
||||
ncplane_putc(n->ncp, &transchar);
|
||||
}
|
||||
const int bodyoffset = dimx - bodywidth + 2;
|
||||
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
||||
@ -157,7 +158,7 @@ ncselector_draw(ncselector* n){
|
||||
}
|
||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||
for(int i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||
ncplane_putc(n->ncp, &n->background);
|
||||
ncplane_putc(n->ncp, &transchar);
|
||||
}
|
||||
n->ncp->channels = n->opchannels;
|
||||
if(printidx == n->selected){
|
||||
@ -177,7 +178,7 @@ ncselector_draw(ncselector* n){
|
||||
// Bottom line of body (background and possibly down arrow)
|
||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||
for(int i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||
ncplane_putc(n->ncp, &n->background);
|
||||
ncplane_putc(n->ncp, &transchar);
|
||||
}
|
||||
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
||||
n->ncp->channels = n->descchannels;
|
||||
@ -296,15 +297,6 @@ ncselector* ncselector_create(ncplane* n, const ncselector_options* opts){
|
||||
ncplane_destroy(ns->ncp);
|
||||
goto freeitems;
|
||||
}
|
||||
cell_init(&ns->background);
|
||||
uint64_t transchan = 0;
|
||||
channels_set_fg_alpha(&transchan, CELL_ALPHA_TRANSPARENT);
|
||||
channels_set_bg_alpha(&transchan, CELL_ALPHA_TRANSPARENT);
|
||||
ncplane_set_base(ns->ncp, "", 0, transchan);
|
||||
if(cell_prime(ns->ncp, &ns->background, "", 0, opts->bgchannels) < 0){
|
||||
ncplane_destroy(ns->ncp);
|
||||
goto freeitems;
|
||||
}
|
||||
ncselector_draw(ns); // deal with error here?
|
||||
return ns;
|
||||
|
||||
@ -517,7 +509,6 @@ void ncselector_destroy(ncselector* n, char** item){
|
||||
free(n->items[n->itemcount].option);
|
||||
free(n->items[n->itemcount].desc);
|
||||
}
|
||||
cell_release(n->ncp, &n->background);
|
||||
ncplane_destroy(n->ncp);
|
||||
free(n->items);
|
||||
free(n->title);
|
||||
@ -604,9 +595,10 @@ ncmultiselector_draw(ncmultiselector* n){
|
||||
}
|
||||
// Top line of body (background and possibly up arrow)
|
||||
++yoff;
|
||||
cell transc = CELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||
for(int i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||
ncplane_putc(n->ncp, &n->background);
|
||||
ncplane_putc(n->ncp, &transc);
|
||||
}
|
||||
const int bodyoffset = dimx - bodywidth + 2;
|
||||
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
||||
@ -626,7 +618,7 @@ ncmultiselector_draw(ncmultiselector* n){
|
||||
}
|
||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||
for(int i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||
ncplane_putc(n->ncp, &n->background);
|
||||
ncplane_putc(n->ncp, &transc);
|
||||
}
|
||||
n->ncp->channels = n->descchannels;
|
||||
if(printidx == n->current){
|
||||
@ -655,7 +647,7 @@ ncmultiselector_draw(ncmultiselector* n){
|
||||
// Bottom line of body (background and possibly down arrow)
|
||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||
for(int i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||
ncplane_putc(n->ncp, &n->background);
|
||||
ncplane_putc(n->ncp, &transc);
|
||||
}
|
||||
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
||||
n->ncp->channels = n->descchannels;
|
||||
@ -871,15 +863,6 @@ ncmultiselector* ncmultiselector_create(ncplane* n, const ncmultiselector_option
|
||||
if(ncplane_resize_simple(ns->ncp, dimy, dimx)){
|
||||
goto freeitems;
|
||||
}
|
||||
cell_init(&ns->background);
|
||||
uint64_t transchan = 0;
|
||||
channels_set_fg_alpha(&transchan, CELL_ALPHA_TRANSPARENT);
|
||||
channels_set_bg_alpha(&transchan, CELL_ALPHA_TRANSPARENT);
|
||||
ncplane_set_base(ns->ncp, "", 0, transchan);
|
||||
if(cell_prime(ns->ncp, &ns->background, "", 0, opts->bgchannels) < 0){
|
||||
ncplane_destroy(ns->ncp);
|
||||
goto freeitems;
|
||||
}
|
||||
ncmultiselector_draw(ns); // deal with error here?
|
||||
return ns;
|
||||
|
||||
@ -901,7 +884,6 @@ void ncmultiselector_destroy(ncmultiselector* n){
|
||||
free(n->items[n->itemcount].option);
|
||||
free(n->items[n->itemcount].desc);
|
||||
}
|
||||
cell_release(n->ncp, &n->background);
|
||||
ncplane_destroy(n->ncp);
|
||||
free(n->items);
|
||||
free(n->title);
|
||||
|
@ -14,7 +14,6 @@ ncmultiselector_options MultiSelector::default_options = {
|
||||
/* titlechannels */ 0,
|
||||
/* footchannels */ 0,
|
||||
/* boxchannels */ 0,
|
||||
/* bgchannels */ 0,
|
||||
/* flags */ 0,
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,6 @@ ncselector_options Selector::default_options = {
|
||||
/* titlechannels */ 0,
|
||||
/* footchannels */ 0,
|
||||
/* boxchannels */ 0,
|
||||
/* bgchannels */ 0,
|
||||
/* flags */ 0,
|
||||
};
|
||||
|
||||
|
@ -80,14 +80,14 @@ int main(void){
|
||||
sopts.title = "this is truly an awfully long example of a MULTISELECTOR title";
|
||||
sopts.secondary = "pick one (you will die regardless)";
|
||||
sopts.footer = "press q to exit (there is sartrev(\"no exit\"))";
|
||||
sopts.boxchannels = CHANNELS_RGB_INITIALIZER(0x20, 0xe0, 0xe0, 0x20, 0, 0),
|
||||
sopts.opchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0),
|
||||
sopts.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0),
|
||||
sopts.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0x20, 0),
|
||||
sopts.titlechannels = CHANNELS_RGB_INITIALIZER(0x20, 0xff, 0xff, 0, 0, 0x20),
|
||||
sopts.bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x20, 0, 0, 0x20, 0),
|
||||
channels_set_fg_alpha(&sopts.bgchannels, CELL_ALPHA_BLEND);
|
||||
channels_set_bg_alpha(&sopts.bgchannels, CELL_ALPHA_BLEND);
|
||||
sopts.boxchannels = CHANNELS_RGB_INITIALIZER(0x20, 0xe0, 0xe0, 0x20, 0, 0);
|
||||
sopts.opchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0);
|
||||
sopts.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0);
|
||||
sopts.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0x20, 0);
|
||||
sopts.titlechannels = CHANNELS_RGB_INITIALIZER(0x20, 0xff, 0xff, 0, 0, 0x20);
|
||||
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x20, 0, 0, 0x20, 0);
|
||||
channels_set_fg_alpha(&bgchannels, CELL_ALPHA_BLEND);
|
||||
channels_set_bg_alpha(&bgchannels, CELL_ALPHA_BLEND);
|
||||
struct ncplane* n = notcurses_stdplane(nc);
|
||||
|
||||
if(notcurses_canopen_images(nc)){
|
||||
@ -110,17 +110,20 @@ int main(void){
|
||||
if(mseln == NULL){
|
||||
goto err;
|
||||
}
|
||||
ncplane_set_base(mseln, "", 0, bgchannels);
|
||||
struct ncmultiselector* ns = ncmultiselector_create(mseln, &sopts);
|
||||
run_mselect(nc, ns);
|
||||
|
||||
sopts.title = "short round title";
|
||||
mseln = ncplane_new(nc, 1, 1, 3, 0, NULL);
|
||||
ncplane_set_base(mseln, "", 0, bgchannels);
|
||||
ns = ncmultiselector_create(mseln, &sopts);
|
||||
run_mselect(nc, ns);
|
||||
|
||||
sopts.title = "short round title";
|
||||
sopts.secondary = "now this secondary is also very, very, very outlandishly long, you see";
|
||||
mseln = ncplane_new(nc, 1, 1, 3, 0, NULL);
|
||||
ncplane_set_base(mseln, "", 0, bgchannels);
|
||||
ns = ncmultiselector_create(mseln, &sopts);
|
||||
run_mselect(nc, ns);
|
||||
|
||||
@ -128,6 +131,7 @@ int main(void){
|
||||
sopts.secondary = NULL;
|
||||
sopts.footer = "now this FOOTERFOOTER is also very, very, very outlandishly long, you see";
|
||||
mseln = ncplane_new(nc, 1, 1, 3, 0, NULL);
|
||||
ncplane_set_base(mseln, "", 0, bgchannels);
|
||||
ns = ncmultiselector_create(mseln, &sopts);
|
||||
run_mselect(nc, ns);
|
||||
|
||||
@ -135,6 +139,7 @@ int main(void){
|
||||
sopts.secondary = NULL;
|
||||
sopts.footer = NULL;
|
||||
mseln = ncplane_new(nc, 1, 1, 3, 0, NULL);
|
||||
ncplane_set_base(mseln, "", 0, bgchannels);
|
||||
ns = ncmultiselector_create(mseln, &sopts);
|
||||
run_mselect(nc, ns);
|
||||
|
||||
|
@ -71,14 +71,14 @@ int main(void){
|
||||
sopts.secondary = "pick one (you will die regardless)";
|
||||
sopts.footer = "press q to exit (there is no exit)";
|
||||
sopts.defidx = 1;
|
||||
sopts.boxchannels = CHANNELS_RGB_INITIALIZER(0x20, 0xe0, 0x40, 0x20, 0x20, 0x20),
|
||||
sopts.opchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0),
|
||||
sopts.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0),
|
||||
sopts.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0, 0),
|
||||
sopts.titlechannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0x80, 0, 0, 0x20),
|
||||
sopts.bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x20, 0, 0, 0x20, 0),
|
||||
channels_set_fg_alpha(&sopts.bgchannels, CELL_ALPHA_BLEND);
|
||||
channels_set_bg_alpha(&sopts.bgchannels, CELL_ALPHA_BLEND);
|
||||
sopts.boxchannels = CHANNELS_RGB_INITIALIZER(0x20, 0xe0, 0x40, 0x20, 0x20, 0x20);
|
||||
sopts.opchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0x80, 0x40, 0, 0, 0);
|
||||
sopts.descchannels = CHANNELS_RGB_INITIALIZER(0x80, 0xe0, 0x40, 0, 0, 0);
|
||||
sopts.footchannels = CHANNELS_RGB_INITIALIZER(0xe0, 0, 0x40, 0x20, 0, 0);
|
||||
sopts.titlechannels = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0x80, 0, 0, 0x20);
|
||||
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x20, 0, 0, 0x20, 0);
|
||||
channels_set_fg_alpha(&bgchannels, CELL_ALPHA_BLEND);
|
||||
channels_set_bg_alpha(&bgchannels, CELL_ALPHA_BLEND);
|
||||
struct ncplane* n = notcurses_stdplane(nc);
|
||||
|
||||
if(notcurses_canopen_images(nc)){
|
||||
@ -99,17 +99,20 @@ int main(void){
|
||||
ncplane_set_fg(n, 0x40f040);
|
||||
ncplane_putstr_aligned(n, 0, NCALIGN_RIGHT, "selector widget demo");
|
||||
struct ncplane* seln = ncplane_new(nc, 1, 1, 3, 0, NULL);
|
||||
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(nc, 1, 1, 3, 0, NULL);
|
||||
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(nc, 1, 1, 3, 0, NULL);
|
||||
ncplane_set_base(seln, "", 0, bgchannels);
|
||||
ns = ncselector_create(seln, &sopts);
|
||||
run_selector(nc, ns);
|
||||
|
||||
@ -117,6 +120,7 @@ int main(void){
|
||||
sopts.secondary = NULL;
|
||||
sopts.footer = "now this FOOTERFOOTER is also very, very, very outlandishly long, you see";
|
||||
seln = ncplane_new(nc, 1, 1, 3, 0, NULL);
|
||||
ncplane_set_base(seln, "", 0, bgchannels);
|
||||
ns = ncselector_create(seln, &sopts);
|
||||
run_selector(nc, ns);
|
||||
|
||||
@ -124,6 +128,7 @@ int main(void){
|
||||
sopts.secondary = NULL;
|
||||
sopts.footer = NULL;
|
||||
seln = ncplane_new(nc, 1, 1, 3, 0, NULL);
|
||||
ncplane_set_base(seln, "", 0, bgchannels);
|
||||
ns = ncselector_create(seln, &sopts);
|
||||
run_selector(nc, ns);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user