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

DESCRIPTION

51       A multiselector widget presents a list of items (possibly more than can
52       be displayed at once).  It facilitates a choice of zero, one, or multi‐
53       ple items from the list.  Items can be selected and deselected before a
54       final choice is made.
55

NOTES

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

RETURN VALUES

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

SEE ALSO

85       notcurses(3), notcurses_input(3),  notcurses_plane(3)  notcurses_selec‐
86       tor(3)
87

AUTHORS

89       nick black <nickblack@linux.com>.
90
91
92
93                                    v3.0.8          notcurses_multiselector(3)
Impressum