1notcurses_progbar(3) notcurses_progbar(3)
2
3
4
6 notcurses_progbar - high level widget for progress bars
7
9 #include <notcurses/notcurses.h>
10
11 struct ncprogbar;
12
13 #define NCPROGBAR_OPTION_RETROGRADE 0x0001u // proceed left/down
14
15 typedef struct ncprogbar_options {
16 uint64_t maxchannels;
17 uint64_t minchannels;
18 uint64_t flags;
19 } ncprogbar_options;
20
21 struct ncprogbar* ncprogbar_create(struct ncplane* n, const ncprog‐
22 bar_options* opts)
23
24 struct ncplane* ncprogbar_plane(struct ncprogbar* n)
25
26 int ncprogbar_set_progress(struct ncprogbar* n, double p)
27
28 double ncprogbar_progress(const struct ncprogbar* n)
29
30 void ncprogbar_destroy(struct ncprogbar* n)
31
33 These functions draw progress bars in any of four directions. The
34 progress measure is a double between zero and one, inclusive, provided
35 to ncprogbar_set_progress. This will be scaled to the size of the pro‐
36 vided ncplane n. The axis of progression is the longer element of the
37 plane's geometry. Horizontal bars proceed to the right by default, and
38 vertical bars proceed up. This can be changed with NCPROGBAR_OP‐
39 TION_RETROGRADE.
40
42 ncprogbar_create takes ownership of n in all cases. On failure, n will
43 be destroyed immediately. It is otherwise destroyed by ncprogbar_de‐
44 stroy.
45
47 ncprogbar_plane returns the ncplane on which the progress bar is drawn.
48 ncprogbar_progress returns the current progress, a value between zero
49 and one, inclusive. They cannot fail.
50
51 ncprogbar_set_progress returns -1 if p is less than zero or greater
52 than one, or if there is an internal error redrawing the progress bar.
53 It returns 0 otherwise.
54
56 Whether progression is to the left or right by default probably ought
57 be an aspect of the current locale.
58
60 notcurses(3), notcurses_plane(3), notcurses_visual(3)
61
63 nick black <nickblack@linux.com>.
64
65
66
67 v2.0.11 notcurses_progbar(3)