1notcurses_multiselector(3) notcurses_multiselector(3)
2
3
4
6 notcurses_multiselector - high level widget for selecting from a set
7
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
52 The ncplane n provided to ncmultiselector_create must not be NULL. It
53 will be freely resized by the new ncmultiselector.
54
55 ncmultiselector_selected returns the index of the option currently
56 highlighted. It stores to the n-ary bitmap pointed to by selected
57 based on the currently-selected options.
58
59 ncmultiselector_plane will return the ncplane on which the widget is
60 drawn.
61
62 Input should be run through ncmultiselector_offer_input to take advan‐
63 tage of common controls. It will handle the up and down arrows, along
64 with PageUp and PageDown. If the mouse is enabled, the mouse scroll‐
65 wheel and mouse clicks on the scroll arrows will be handled.
66
67 ncmultiselector_destroy destroys the backing ncplane, as does ncmultis‐
68 elector_create in the event of any error.
69
71 ncmultiselector_create returns NULL on an error, in which case the
72 passed ncplane is destroyed.
73
74 ncmultiselector_selected returns -1 if there are no items, or if n is
75 not equal to the number of items. It otherwise returns the index of
76 the currently highlighted option, and writes a bitmap to selected based
77 off the selected items.
78
80 notcurses(3), notcurses_input(3), notcurses_plane(3) notcurses_selec‐
81 tor(3)
82
84 nick black <nickblack@linux.com>.
85
86
87
88 v2.4.9 notcurses_multiselector(3)