mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-10-31 15:20:13 +00:00
selector->ncselector, multiselector -> ncmultiselector #580
This commit is contained in:
parent
16376f872c
commit
989ca7ff9a
3
NEWS.md
3
NEWS.md
@ -6,6 +6,9 @@ rearrangements of Notcurses.
|
||||
be returned as a nul-terminated, heap-allocated string.
|
||||
* `ncreader` was added. This widget allows freeform input to be edited in a
|
||||
block, and collected into a string.
|
||||
* `selector_options` has been renamed to `ncselector_options`, and
|
||||
`multiselector_options` has been renamed to `ncmultiselector_options`.
|
||||
This matches the other widget option struct's nomenclature.
|
||||
|
||||
* 1.3.4 (2020-05-07)
|
||||
* `notcurses_lex_margins()` has been added to lex margins expressed in either
|
||||
|
@ -14,30 +14,30 @@ namespace ncpp
|
||||
class NCPP_API_EXPORT MultiSelector : public Root
|
||||
{
|
||||
public:
|
||||
static multiselector_options default_options;
|
||||
static ncmultiselector_options default_options;
|
||||
|
||||
public:
|
||||
explicit MultiSelector (NotCurses *nc, int y, int x, const multiselector_options *opts = nullptr)
|
||||
explicit MultiSelector (NotCurses *nc, int y, int x, const ncmultiselector_options *opts = nullptr)
|
||||
: MultiSelector (reinterpret_cast<notcurses*>(nc), y, x, opts)
|
||||
{}
|
||||
|
||||
explicit MultiSelector (NotCurses const* nc, int y, int x, const multiselector_options *opts = nullptr)
|
||||
explicit MultiSelector (NotCurses const* nc, int y, int x, const ncmultiselector_options *opts = nullptr)
|
||||
: MultiSelector (const_cast<NotCurses*>(nc), y, x, opts)
|
||||
{}
|
||||
|
||||
explicit MultiSelector (NotCurses &nc, int y, int x, const multiselector_options *opts = nullptr)
|
||||
explicit MultiSelector (NotCurses &nc, int y, int x, const ncmultiselector_options *opts = nullptr)
|
||||
: MultiSelector (reinterpret_cast<notcurses*>(&nc), y, x, opts)
|
||||
{}
|
||||
|
||||
explicit MultiSelector (NotCurses const& nc, int y, int x, const multiselector_options *opts = nullptr)
|
||||
explicit MultiSelector (NotCurses const& nc, int y, int x, const ncmultiselector_options *opts = nullptr)
|
||||
: MultiSelector (const_cast<NotCurses*>(&nc), y, x, opts)
|
||||
{}
|
||||
|
||||
explicit MultiSelector (notcurses *nc, int y, int x, const multiselector_options *opts = nullptr)
|
||||
explicit MultiSelector (notcurses *nc, int y, int x, const ncmultiselector_options *opts = nullptr)
|
||||
{
|
||||
multiselector = ncmultiselector_create (nc, y, x, opts == nullptr ? &default_options : opts);
|
||||
if (multiselector == nullptr)
|
||||
throw init_error ("notcurses failed to create a new multiselector");
|
||||
throw init_error ("notcurses failed to create a new ncmultiselector");
|
||||
}
|
||||
|
||||
~MultiSelector ()
|
||||
|
@ -14,26 +14,26 @@ namespace ncpp
|
||||
class NCPP_API_EXPORT Selector : public Root
|
||||
{
|
||||
public:
|
||||
static selector_options default_options;
|
||||
static ncselector_options default_options;
|
||||
|
||||
public:
|
||||
explicit Selector (NotCurses *nc, int y, int x, const selector_options *opts = nullptr)
|
||||
explicit Selector (NotCurses *nc, int y, int x, const ncselector_options *opts = nullptr)
|
||||
: Selector (reinterpret_cast<notcurses*>(nc), y, x, opts)
|
||||
{}
|
||||
|
||||
explicit Selector (NotCurses const* nc, int y, int x, const selector_options *opts = nullptr)
|
||||
explicit Selector (NotCurses const* nc, int y, int x, const ncselector_options *opts = nullptr)
|
||||
: Selector (const_cast<NotCurses*>(nc), y, x, opts)
|
||||
{}
|
||||
|
||||
explicit Selector (NotCurses &nc, int y, int x, const selector_options *opts = nullptr)
|
||||
explicit Selector (NotCurses &nc, int y, int x, const ncselector_options *opts = nullptr)
|
||||
: Selector (reinterpret_cast<NotCurses*>(&nc), y, x, opts)
|
||||
{}
|
||||
|
||||
explicit Selector (NotCurses const& nc, int y, int x, const selector_options *opts = nullptr)
|
||||
explicit Selector (NotCurses const& nc, int y, int x, const ncselector_options *opts = nullptr)
|
||||
: Selector (const_cast<NotCurses*>(&nc), y, x, opts)
|
||||
{}
|
||||
|
||||
explicit Selector (notcurses* nc, int y, int x, const selector_options *opts = nullptr)
|
||||
explicit Selector (notcurses* nc, int y, int x, const ncselector_options *opts = nullptr)
|
||||
{
|
||||
selector = ncselector_create (nc, y, x, opts == nullptr ? &default_options : opts);
|
||||
if (selector == nullptr)
|
||||
@ -46,7 +46,7 @@ namespace ncpp
|
||||
ncselector_destroy (selector, nullptr);
|
||||
}
|
||||
|
||||
int additem (const selector_item *item) const NOEXCEPT_MAYBE
|
||||
int additem (const ncselector_item *item) const NOEXCEPT_MAYBE
|
||||
{
|
||||
return error_guard<int> (ncselector_additem (selector, item), -1);
|
||||
}
|
||||
|
@ -2436,18 +2436,18 @@ API void ncplane_greyscale(struct ncplane* n);
|
||||
//
|
||||
// At all times, exactly one item is selected.
|
||||
|
||||
struct selector_item {
|
||||
struct ncselector_item {
|
||||
char* option;
|
||||
char* desc;
|
||||
size_t opcolumns; // filled in by library
|
||||
size_t desccolumns; // filled in by library
|
||||
};
|
||||
|
||||
typedef struct selector_options {
|
||||
typedef struct ncselector_options {
|
||||
char* title; // title may be NULL, inhibiting riser, saving two rows.
|
||||
char* secondary; // secondary may be NULL
|
||||
char* footer; // footer may be NULL
|
||||
struct selector_item* items; // initial items and descriptions
|
||||
struct ncselector_item* items; // initial items and descriptions
|
||||
unsigned itemcount; // number of initial items and descriptions
|
||||
// default item (selected at start), must be < itemcount unless 'itemcount'
|
||||
// is 0, in which case 'defidx' must also be 0
|
||||
@ -2461,12 +2461,12 @@ typedef struct selector_options {
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels, used only in body
|
||||
} selector_options;
|
||||
} ncselector_options;
|
||||
|
||||
API struct ncselector* ncselector_create(struct notcurses* n, int y, int x,
|
||||
const selector_options* opts);
|
||||
const ncselector_options* opts);
|
||||
|
||||
API int ncselector_additem(struct ncselector* n, const struct selector_item* item);
|
||||
API int ncselector_additem(struct ncselector* n, const struct ncselector_item* item);
|
||||
API int ncselector_delitem(struct ncselector* n, const char* item);
|
||||
|
||||
// Return reference to the selected option, or NULL if there are no items.
|
||||
@ -2493,7 +2493,7 @@ API bool ncselector_offer_input(struct ncselector* n, const struct ncinput* nc);
|
||||
// be strdup()ed and assigned to '*item' (and must be free()d by the caller).
|
||||
API void ncselector_destroy(struct ncselector* n, char** item);
|
||||
|
||||
struct mselector_item {
|
||||
struct ncmselector_item {
|
||||
char* option;
|
||||
char* desc;
|
||||
bool selected;
|
||||
@ -2520,11 +2520,11 @@ struct mselector_item {
|
||||
//
|
||||
// Unlike the selector widget, zero to all of the items can be selected, but
|
||||
// also the widget does not support adding or removing items at runtime.
|
||||
typedef struct multiselector_options {
|
||||
typedef struct ncmultiselector_options {
|
||||
char* title; // title may be NULL, inhibiting riser, saving two rows.
|
||||
char* secondary; // secondary may be NULL
|
||||
char* footer; // footer may be NULL
|
||||
struct mselector_item* items; // initial items, descriptions, and statuses
|
||||
struct ncmselector_item* items; // initial items, descriptions, and statuses
|
||||
unsigned itemcount; // number of items and descriptions, can't be 0
|
||||
// maximum number of options to display at once, 0 to use all available space
|
||||
unsigned maxdisplay;
|
||||
@ -2535,10 +2535,10 @@ typedef struct multiselector_options {
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels, used only in body
|
||||
} multiselector_options;
|
||||
} ncmultiselector_options;
|
||||
|
||||
API struct ncmultiselector* ncmultiselector_create(struct notcurses* n, int y, int x,
|
||||
const multiselector_options* opts);
|
||||
const ncmultiselector_options* opts);
|
||||
|
||||
// Return selected vector. An array of bools must be provided, along with its
|
||||
// length. If that length doesn't match the itemcount, it is an error.
|
||||
|
@ -299,17 +299,17 @@ typedef int (*streamcb)(struct notcurses* nc, struct ncvisual* ncv, void*);
|
||||
int ncvisual_stream(struct notcurses* nc, struct ncvisual* ncv, nc_err_e* err, float timescale, streamcb streamer, void* curry);
|
||||
int ncblit_bgrx(struct ncplane* nc, int placey, int placex, int linesize, const unsigned char* data, int begy, int begx, int leny, int lenx);
|
||||
int ncblit_rgba(struct ncplane* nc, int placey, int placex, int linesize, const unsigned char* data, int begy, int begx, int leny, int lenx);
|
||||
struct selector_item {
|
||||
struct ncselector_item {
|
||||
char* option;
|
||||
char* desc;
|
||||
size_t opcolumns; // filled in by library
|
||||
size_t desccolumns; // filled in by library
|
||||
};
|
||||
typedef struct selector_options {
|
||||
typedef struct ncselector_options {
|
||||
char* title; // title may be NULL, inhibiting riser, saving two rows.
|
||||
char* secondary; // secondary may be NULL
|
||||
char* footer; // footer may be NULL
|
||||
struct selector_item* items; // initial items and descriptions
|
||||
struct ncselector_item* items; // initial items and descriptions
|
||||
unsigned itemcount; // number of initial items and descriptions
|
||||
// default item (selected at start), must be < itemcount unless 'itemcount'
|
||||
// is 0, in which case 'defidx' must also be 0
|
||||
@ -323,9 +323,9 @@ typedef struct selector_options {
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels, used only in body
|
||||
} selector_options;
|
||||
struct ncselector* ncselector_create(struct notcurses* n, int y, int x, const selector_options* opts);
|
||||
int ncselector_additem(struct ncselector* n, const struct selector_item* item);
|
||||
} ncselector_options;
|
||||
struct ncselector* ncselector_create(struct notcurses* n, int y, int x, const ncselector_options* opts);
|
||||
int ncselector_additem(struct ncselector* n, const struct ncselector_item* item);
|
||||
int ncselector_delitem(struct ncselector* n, const char* item);
|
||||
const char* ncselector_selected(const struct ncselector* n);
|
||||
struct ncplane* ncselector_plane(struct ncselector* n);
|
||||
@ -333,16 +333,16 @@ const char* ncselector_previtem(struct ncselector* n);
|
||||
const char* ncselector_nextitem(struct ncselector* n);
|
||||
bool ncselector_offer_input(struct ncselector* n, const struct ncinput* nc);
|
||||
void ncselector_destroy(struct ncselector* n, char** item);
|
||||
struct mselector_item {
|
||||
struct ncmselector_item {
|
||||
char* option;
|
||||
char* desc;
|
||||
bool selected;
|
||||
};
|
||||
typedef struct multiselector_options {
|
||||
typedef struct ncmultiselector_options {
|
||||
char* title; // title may be NULL, inhibiting riser, saving two rows.
|
||||
char* secondary; // secondary may be NULL
|
||||
char* footer; // footer may be NULL
|
||||
struct mselector_item* items; // initial items, descriptions, and statuses
|
||||
struct ncmselector_item* items; // initial items, descriptions, and statuses
|
||||
unsigned itemcount; // number of items and descriptions, can't be 0
|
||||
// maximum number of options to display at once, 0 to use all available space
|
||||
unsigned maxdisplay;
|
||||
@ -353,8 +353,8 @@ typedef struct multiselector_options {
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
uint64_t bgchannels; // background channels, used only in body
|
||||
} multiselector_options;
|
||||
struct ncmultiselector* ncmultiselector_create(struct notcurses* n, int y, int x, const multiselector_options* opts);
|
||||
} ncmultiselector_options;
|
||||
struct ncmultiselector* ncmultiselector_create(struct notcurses* n, int y, int x, const ncmultiselector_options* opts);
|
||||
int ncmultiselector_selected(struct ncmultiselector* n, bool* selected, unsigned count);
|
||||
struct ncplane* ncmultiselector_plane(struct ncmultiselector* n);
|
||||
bool ncmultiselector_offer_input(struct ncmultiselector* n, const struct ncinput* nc);
|
||||
|
@ -165,50 +165,50 @@ typedef struct ncmenu {
|
||||
} ncmenu;
|
||||
|
||||
typedef struct ncselector {
|
||||
ncplane* ncp; // backing ncplane
|
||||
unsigned selected; // index of selection
|
||||
unsigned startdisp; // index of first option displayed
|
||||
unsigned maxdisplay; // max number of items to display, 0 -> no limit
|
||||
int longop; // columns occupied by longest option
|
||||
int longdesc; // columns occupied by longest description
|
||||
struct selector_item* items; // list of items and descriptions, heap-copied
|
||||
unsigned itemcount; // number of pairs in 'items'
|
||||
char* title; // can be NULL, in which case there's no riser
|
||||
int titlecols; // columns occupied by title
|
||||
char* secondary; // can be NULL
|
||||
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
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
ncplane* ncp; // backing ncplane
|
||||
unsigned selected; // index of selection
|
||||
unsigned startdisp; // index of first option displayed
|
||||
unsigned maxdisplay; // max number of items to display, 0 -> no limit
|
||||
int longop; // columns occupied by longest option
|
||||
int longdesc; // columns occupied by longest description
|
||||
struct ncselector_item* items; // list of items and descriptions, heap-copied
|
||||
unsigned itemcount; // number of pairs in 'items'
|
||||
char* title; // can be NULL, in which case there's no riser
|
||||
int titlecols; // columns occupied by title
|
||||
char* secondary; // can be NULL
|
||||
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
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
int uarrowy, darrowy, arrowx;// location of scrollarrows, even if not present
|
||||
} ncselector;
|
||||
|
||||
typedef struct ncmultiselector {
|
||||
ncplane* ncp; // backing ncplane
|
||||
unsigned current; // index of highlighted item
|
||||
unsigned startdisp; // index of first option displayed
|
||||
unsigned maxdisplay; // max number of items to display, 0 -> no limit
|
||||
int longitem; // columns occupied by longest item
|
||||
struct mselector_item* items;// items, descriptions, and statuses, heap-copied
|
||||
unsigned itemcount; // number of pairs in 'items'
|
||||
char* title; // can be NULL, in which case there's no riser
|
||||
int titlecols; // columns occupied by title
|
||||
char* secondary; // can be NULL
|
||||
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
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
int uarrowy, darrowy, arrowx;// location of scrollarrows, even if not present
|
||||
ncplane* ncp; // backing ncplane
|
||||
unsigned current; // index of highlighted item
|
||||
unsigned startdisp; // index of first option displayed
|
||||
unsigned maxdisplay; // max number of items to display, 0 -> no limit
|
||||
int longitem; // columns occupied by longest item
|
||||
struct ncmselector_item* items; // items, descriptions, and statuses, heap-copied
|
||||
unsigned itemcount; // number of pairs in 'items'
|
||||
char* title; // can be NULL, in which case there's no riser
|
||||
int titlecols; // columns occupied by title
|
||||
char* secondary; // can be NULL
|
||||
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
|
||||
uint64_t footchannels; // secondary and footer channels
|
||||
uint64_t boxchannels; // border channels
|
||||
int uarrowy, darrowy, arrowx; // location of scrollarrows, even if not present
|
||||
} ncmultiselector;
|
||||
|
||||
typedef struct ncdirect {
|
||||
|
@ -157,7 +157,7 @@ ncselector_dim_yx(notcurses* nc, const ncselector* n, int* ncdimy, int* ncdimx){
|
||||
return 0;
|
||||
}
|
||||
|
||||
ncselector* ncselector_create(notcurses* nc, int y, int x, const selector_options* opts){
|
||||
ncselector* ncselector_create(notcurses* nc, int y, int x, const ncselector_options* opts){
|
||||
if(opts->defidx && opts->defidx >= opts->itemcount){
|
||||
return NULL;
|
||||
}
|
||||
@ -190,7 +190,7 @@ ncselector* ncselector_create(notcurses* nc, int y, int x, const selector_option
|
||||
ns->items = NULL;
|
||||
}
|
||||
for(ns->itemcount = 0 ; ns->itemcount < opts->itemcount ; ++ns->itemcount){
|
||||
const struct selector_item* src = &opts->items[ns->itemcount];
|
||||
const struct ncselector_item* src = &opts->items[ns->itemcount];
|
||||
int cols = mbswidth(src->option);
|
||||
ns->items[ns->itemcount].opcolumns = cols;
|
||||
if(cols > ns->longop){
|
||||
@ -239,9 +239,9 @@ freeitems:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ncselector_additem(ncselector* n, const struct selector_item* item){
|
||||
int ncselector_additem(ncselector* n, const struct ncselector_item* item){
|
||||
size_t newsize = sizeof(*n->items) * (n->itemcount + 1);
|
||||
struct selector_item* items = realloc(n->items, newsize);
|
||||
struct ncselector_item* items = realloc(n->items, newsize);
|
||||
if(!items){
|
||||
return -1;
|
||||
}
|
||||
@ -654,7 +654,8 @@ ncmultiselector_dim_yx(notcurses* nc, const ncmultiselector* n, int* ncdimy, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
ncmultiselector* ncmultiselector_create(notcurses* nc, int y, int x, const multiselector_options* opts){
|
||||
ncmultiselector* ncmultiselector_create(notcurses* nc, int y, int x,
|
||||
const ncmultiselector_options* opts){
|
||||
ncmultiselector* ns = malloc(sizeof(*ns));
|
||||
ns->title = opts->title ? strdup(opts->title) : NULL;
|
||||
ns->titlecols = opts->title ? mbswidth(opts->title) : 0;
|
||||
@ -683,7 +684,7 @@ ncmultiselector* ncmultiselector_create(notcurses* nc, int y, int x, const multi
|
||||
ns->items = NULL;
|
||||
}
|
||||
for(ns->itemcount = 0 ; ns->itemcount < opts->itemcount ; ++ns->itemcount){
|
||||
const struct mselector_item* src = &opts->items[ns->itemcount];
|
||||
const struct ncmselector_item* src = &opts->items[ns->itemcount];
|
||||
int cols = mbswidth(src->option);
|
||||
if(cols > ns->longitem){
|
||||
ns->longitem = cols;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
using namespace ncpp;
|
||||
|
||||
multiselector_options MultiSelector::default_options = {
|
||||
ncmultiselector_options MultiSelector::default_options = {
|
||||
/* title */ nullptr,
|
||||
/* secondary */ nullptr,
|
||||
/* footer */ nullptr,
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
using namespace ncpp;
|
||||
|
||||
selector_options Selector::default_options = {
|
||||
ncselector_options Selector::default_options = {
|
||||
/* title */ nullptr,
|
||||
/* secondary */ nullptr,
|
||||
/* footer */ nullptr,
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "version.h"
|
||||
|
||||
// http://theboomerbible.com/tbb112.html
|
||||
static struct mselector_item items[] = {
|
||||
static struct ncmselector_item items[] = {
|
||||
{ "1", "Across the Atlantic Ocean, there was a place called North America", .selected = false, },
|
||||
{ "2", "Discovered by an Italian in the employ of the queen of Spain", .selected = false, },
|
||||
{ "3", "Colonized extensively by the Spanish and the French", .selected = false, },
|
||||
@ -61,7 +61,7 @@ int main(void){
|
||||
notcurses_stop(nc);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
multiselector_options sopts;
|
||||
ncmultiselector_options sopts;
|
||||
memset(&sopts, 0, sizeof(sopts));
|
||||
sopts.maxdisplay = 10;
|
||||
sopts.items = items;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <notcurses/notcurses.h>
|
||||
#include "version.h"
|
||||
|
||||
static struct selector_item items[] = {
|
||||
static struct ncselector_item items[] = {
|
||||
#define SITEM(short, long) { short, long, 0, 0, }
|
||||
SITEM("first", "this is the first option"),
|
||||
SITEM("2nd", "this is the second option"),
|
||||
@ -61,7 +61,7 @@ int main(void){
|
||||
notcurses_stop(nc);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
selector_options sopts;
|
||||
ncselector_options sopts;
|
||||
memset(&sopts, 0, sizeof(sopts));
|
||||
sopts.maxdisplay = 4;
|
||||
sopts.items = items;
|
||||
|
@ -18,7 +18,7 @@ TEST_CASE("Selectors") {
|
||||
REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
||||
|
||||
SUBCASE("EmptySelector") {
|
||||
struct selector_options opts{};
|
||||
struct ncselector_options opts{};
|
||||
struct ncselector* ncs = ncselector_create(nc_, 0, 0, &opts);
|
||||
REQUIRE(nullptr != ncs);
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
@ -33,7 +33,7 @@ TEST_CASE("Selectors") {
|
||||
}
|
||||
|
||||
SUBCASE("TitledSelector") {
|
||||
struct selector_options opts{};
|
||||
struct ncselector_options opts{};
|
||||
opts.title = strdup("hey hey whaddya say");
|
||||
struct ncselector* ncs = ncselector_create(nc_, 0, 0, &opts);
|
||||
REQUIRE(nullptr != ncs);
|
||||
@ -48,7 +48,7 @@ TEST_CASE("Selectors") {
|
||||
}
|
||||
|
||||
SUBCASE("SecondarySelector") {
|
||||
struct selector_options opts{};
|
||||
struct ncselector_options opts{};
|
||||
opts.secondary = strdup("this is not a title, but it's not *not* a title");
|
||||
struct ncselector* ncs = ncselector_create(nc_, 0, 0, &opts);
|
||||
REQUIRE(nullptr != ncs);
|
||||
@ -63,7 +63,7 @@ TEST_CASE("Selectors") {
|
||||
}
|
||||
|
||||
SUBCASE("FooterSelector") {
|
||||
struct selector_options opts{};
|
||||
struct ncselector_options opts{};
|
||||
opts.footer = strdup("i am a lone footer, little old footer");
|
||||
struct ncselector* ncs = ncselector_create(nc_, 0, 0, &opts);
|
||||
REQUIRE(nullptr != ncs);
|
||||
@ -78,12 +78,12 @@ TEST_CASE("Selectors") {
|
||||
}
|
||||
|
||||
SUBCASE("PopulatedSelector") {
|
||||
selector_item items[] = {
|
||||
ncselector_item items[] = {
|
||||
{ strdup("op1"), strdup("this is option 1"), 0, 0, },
|
||||
{ strdup("2ndop"), strdup("this is option #2"), 0, 0, },
|
||||
{ strdup("tres"), strdup("option the third"), 0, 0, },
|
||||
};
|
||||
struct selector_options opts{};
|
||||
struct ncselector_options opts{};
|
||||
opts.items = items;
|
||||
opts.itemcount = sizeof(items) / sizeof(*items);
|
||||
struct ncselector* ncs = ncselector_create(nc_, 0, 0, &opts);
|
||||
@ -99,7 +99,7 @@ TEST_CASE("Selectors") {
|
||||
}
|
||||
|
||||
SUBCASE("EmptySelectorMovement") {
|
||||
struct selector_options opts{};
|
||||
struct ncselector_options opts{};
|
||||
struct ncselector* ncs = ncselector_create(nc_, 0, 0, &opts);
|
||||
REQUIRE(nullptr != ncs);
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
@ -115,12 +115,12 @@ TEST_CASE("Selectors") {
|
||||
}
|
||||
|
||||
SUBCASE("SelectorMovement") {
|
||||
selector_item items[] = {
|
||||
ncselector_item items[] = {
|
||||
{ strdup("op1"), strdup("this is option 1"), 0, 0, },
|
||||
{ strdup("2ndop"), strdup("this is option #2"), 0, 0, },
|
||||
{ strdup("tres"), strdup("option the third"), 0, 0, },
|
||||
};
|
||||
struct selector_options opts{};
|
||||
struct ncselector_options opts{};
|
||||
opts.items = items;
|
||||
opts.itemcount = sizeof(items) / sizeof(*items);
|
||||
struct ncselector* ncs = ncselector_create(nc_, 0, 0, &opts);
|
||||
@ -152,12 +152,12 @@ TEST_CASE("Selectors") {
|
||||
|
||||
// Provide three items, limited to 1 shown at a time
|
||||
SUBCASE("ScrollingSelectorOne") {
|
||||
selector_item items[] = {
|
||||
ncselector_item items[] = {
|
||||
{ strdup("op1"), strdup("this is option 1"), 0, 0, },
|
||||
{ strdup("2ndop"), strdup("this is option #2"), 0, 0, },
|
||||
{ strdup("tres"), strdup("option the third"), 0, 0, },
|
||||
};
|
||||
struct selector_options opts{};
|
||||
struct ncselector_options opts{};
|
||||
opts.maxdisplay = 1;
|
||||
opts.items = items;
|
||||
opts.itemcount = sizeof(items) / sizeof(*items);
|
||||
@ -195,12 +195,12 @@ TEST_CASE("Selectors") {
|
||||
|
||||
// Provide three items, limited to 2 shown at a time
|
||||
SUBCASE("ScrollingSelectorTwo") {
|
||||
selector_item items[] = {
|
||||
ncselector_item items[] = {
|
||||
{ strdup("op1"), strdup("this is option 1"), 0, 0, },
|
||||
{ strdup("2ndop"), strdup("this is option #2"), 0, 0, },
|
||||
{ strdup("tres"), strdup("option the third"), 0, 0, },
|
||||
};
|
||||
struct selector_options opts{};
|
||||
struct ncselector_options opts{};
|
||||
opts.maxdisplay = 2;
|
||||
opts.items = items;
|
||||
opts.itemcount = sizeof(items) / sizeof(*items);
|
||||
|
Loading…
Reference in New Issue
Block a user