2020-03-09 19:17:41 +00:00
|
|
|
% notcurses_multiselector(3)
|
|
|
|
% nick black <nickblack@linux.com>
|
2020-08-16 14:06:33 +00:00
|
|
|
% v1.6.14
|
2020-03-09 19:17:41 +00:00
|
|
|
|
|
|
|
# NAME
|
|
|
|
|
|
|
|
notcurses_multiselector - high level widget for selecting from a set
|
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
2020-04-19 22:46:32 +00:00
|
|
|
**#include <notcurses/notcurses.h>**
|
2020-03-09 19:17:41 +00:00
|
|
|
|
|
|
|
```c
|
2020-04-27 23:11:00 +00:00
|
|
|
struct ncinput;
|
|
|
|
struct ncplane;
|
|
|
|
struct notcurses;
|
|
|
|
struct ncmultiselector;
|
2020-03-09 19:17:41 +00:00
|
|
|
|
2020-05-09 00:56:39 +00:00
|
|
|
struct ncmselector_item {
|
2020-03-09 19:17:41 +00:00
|
|
|
char* option;
|
|
|
|
char* desc;
|
|
|
|
bool selected;
|
|
|
|
};
|
|
|
|
|
2020-05-09 00:56:39 +00:00
|
|
|
typedef struct ncmultiselector_options {
|
2020-03-09 19:17:41 +00:00
|
|
|
char* title; // title may be NULL, inhibiting riser
|
|
|
|
char* secondary; // secondary may be NULL
|
|
|
|
char* footer; // footer may be NULL
|
2020-05-09 00:56:39 +00:00
|
|
|
struct ncmselector_item* items; // initial items, statuses
|
2020-03-09 19:17:41 +00:00
|
|
|
// default item (selected at start)
|
|
|
|
unsigned defidx;
|
|
|
|
// maximum number of options to display at once
|
|
|
|
unsigned maxdisplay;
|
|
|
|
// exhaustive styling options
|
|
|
|
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
|
|
|
|
uint64_t bgchannels; // background channels for body
|
2020-05-29 18:53:53 +00:00
|
|
|
unsigned flags; // bitfield over NCMULTISELECTOR_OPTION_*
|
2020-05-09 00:56:39 +00:00
|
|
|
} ncmultiselector_options;
|
2020-03-09 19:17:41 +00:00
|
|
|
```
|
|
|
|
|
2020-05-09 11:51:23 +00:00
|
|
|
**struct ncmultiselector* ncmultiselector_create(struct ncplane* n, int y, int x, const ncmultiselector_options* opts);**
|
2020-03-09 19:17:41 +00:00
|
|
|
|
2020-05-09 01:01:22 +00:00
|
|
|
**int ncmultiselector_selected(bool* selected, unsigned n);**
|
2020-03-09 19:30:23 +00:00
|
|
|
|
2020-03-09 19:17:41 +00:00
|
|
|
**struct ncplane* ncmultiselector_plane(struct ncmultiselector* n);**
|
|
|
|
|
|
|
|
**bool ncmultiselector_offer_input(struct ncmultiselector* n, const struct ncinput* nc);**
|
|
|
|
|
2020-07-29 01:39:24 +00:00
|
|
|
**void ncmultiselector_destroy(struct ncmultiselector* n);**
|
2020-03-09 19:17:41 +00:00
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
|
|
|
# NOTES
|
|
|
|
|
2020-08-16 10:02:00 +00:00
|
|
|
Currently, the **ncplane** **n** provided to **ncmultiselector_create**
|
|
|
|
must not be **NULL**, though the **ncmultiselector** will always get its
|
|
|
|
own plane, and this plane will not (currently) be bound to **n**.
|
|
|
|
**ncmultiselector_selected** returns a bitmap corresponding to the
|
|
|
|
currently-selected options.
|
|
|
|
|
|
|
|
**ncmultiselector_plane** will return the **ncplane** on which the widget is
|
|
|
|
drawn.
|
|
|
|
|
|
|
|
While the **ncmultiselector** can be driven entirely by client code,
|
|
|
|
input can be run through **ncmultiselector_offer_input** to take
|
|
|
|
advantage of common controls. It will handle the up and down arrows,
|
|
|
|
along with PageUp and PageDown, and space to select/deselect options.
|
|
|
|
If the mouse is enabled, the mouse scrollwheel and mouse clicks on the scroll
|
|
|
|
arrows will be handled.
|
2020-05-09 11:51:23 +00:00
|
|
|
|
2020-03-09 19:17:41 +00:00
|
|
|
# RETURN VALUES
|
|
|
|
|
|
|
|
# SEE ALSO
|
|
|
|
|
|
|
|
**notcurses(3)**,
|
|
|
|
**notcurses_input(3)**,
|
2020-05-09 00:56:39 +00:00
|
|
|
**notcurses_plane(3)**
|
2020-03-09 19:17:41 +00:00
|
|
|
**notcurses_selector(3)**
|