1notcurses_multiselector(3)                          notcurses_multiselector(3)
2
3
4

NAME

6       notcurses_multiselector - high level widget for selecting from a set
7

SYNOPSIS

9       #include <notcurses/notcurses.h>
10
11              struct ncplane;
12              struct notcurses;
13              struct ncmultiselector;
14
15              struct ncmselector_item {
16                char* option;
17                char* desc;
18                bool selected;
19              };
20
21              typedef struct ncmultiselector_options {
22                char* title; // title may be NULL, inhibiting riser
23                char* secondary; // secondary may be NULL
24                char* footer; // footer may be NULL
25                struct ncmselector_item* items; // initial items, statuses
26                // default item (selected at start)
27                unsigned defidx;
28                // maximum number of options to display at once
29                unsigned maxdisplay;
30                // exhaustive styling options
31                uint64_t opchannels;   // option channels
32                uint64_t descchannels; // description channels
33                uint64_t titlechannels;// title channels
34                uint64_t footchannels; // secondary and footer channels
35                uint64_t boxchannels;  // border channels
36                uint64_t flags;        // bitfield over NCMULTISELECTOR_OPTION_*
37              } ncmultiselector_options;
38
39       struct ncmultiselector* ncmultiselector_create(struct ncplane* n, const
40       ncmultiselector_options* opts);
41
42       int ncmultiselector_selected(bool* selected, unsigned n);
43
44       struct ncplane* ncmultiselector_plane(struct ncmultiselector* n);
45
46       bool ncmultiselector_offer_input(struct ncmultiselector* n, const ncin‐
47       put* nc);
48
49       void ncmultiselector_destroy(struct ncmultiselector* n);
50

DESCRIPTION

NOTES

53       The  ncplane n provided to ncmultiselector_create must not be NULL.  It
54       will be freely resized by the new ncmultiselector.
55
56       ncmultiselector_selected returns the  index  of  the  option  currently
57       highlighted.   It  stores  to  the  n-ary bitmap pointed to by selected
58       based on the currently-selected options.
59
60       ncmultiselector_plane will return the ncplane on which  the  widget  is
61       drawn.
62
63       Input  should be run through ncmultiselector_offer_input to take advan‐
64       tage of common controls.  It will handle the up and down arrows,  along
65       with  PageUp  and PageDown.  If the mouse is enabled, the mouse scroll‐
66       wheel and mouse clicks on the scroll arrows will be handled.
67
68       ncmultiselector_destroy destroys the backing ncplane, as does ncmultis‐
69       elector_create in the event of any error.
70

RETURN VALUES

72       ncmultiselector_create  returns  NULL  on  an  error, in which case the
73       passed ncplane is destroyed.
74
75       ncmultiselector_selected returns -1 if there are no items, or if  n  is
76       not  equal  to  the number of items.  It otherwise returns the index of
77       the currently highlighted option, and writes a bitmap to selected based
78       off the selected items.
79

SEE ALSO

81       notcurses(3),  notcurses_input(3),  notcurses_plane(3) notcurses_selec‐
82       tor(3)
83

AUTHORS

85       nick black <nickblack@linux.com>.
86
87
88
89                                    v2.3.1          notcurses_multiselector(3)
Impressum