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 uint32_t ulchannel; // upper-left channel. in the context of a progress bar,
17 uint32_t urchannel; // "up" is the direction we are progressing towards, and
18 uint32_t blchannel; // "bottom" is the direction of origin. for monochromatic
19 uint32_t brchannel; // bar, all four channels ought be the same.
20 uint64_t flags;
21 } ncprogbar_options;
22
23 struct ncprogbar* ncprogbar_create(struct ncplane* n, const ncprog‐
24 bar_options* opts)
25
26 struct ncplane* ncprogbar_plane(struct ncprogbar* n)
27
28 int ncprogbar_set_progress(struct ncprogbar* n, double p)
29
30 double ncprogbar_progress(const struct ncprogbar* n)
31
32 void ncprogbar_destroy(struct ncprogbar* n)
33
35 These functions draw progress bars in any of four directions. The
36 progress measure is a double between zero and one, inclusive, provided
37 to ncprogbar_set_progress. This will be scaled to the size of the pro‐
38 vided ncplane n. The axis of progression is the longer element of the
39 plane's geometry. Horizontal bars proceed to the right by default, and
40 vertical bars proceed up. This can be changed with NCPROGBAR_OP‐
41 TION_RETROGRADE.
42
44 ncprogbar_create takes ownership of n in all cases. On failure, n will
45 be destroyed immediately. It is otherwise destroyed by ncprogbar_de‐
46 stroy.
47
49 ncprogbar_plane returns the ncplane on which the progress bar is drawn.
50 ncprogbar_progress returns the current progress, a value between zero
51 and one, inclusive. They cannot fail.
52
53 ncprogbar_set_progress returns -1 if p is less than zero or greater
54 than one, or if there is an internal error redrawing the progress bar.
55 It returns 0 otherwise.
56
58 Whether progression is to the left or right by default probably ought
59 be an aspect of the current locale.
60
62 notcurses(3), notcurses_plane(3), notcurses_visual(3)
63
65 nick black <nickblack@linux.com>.
66
67
68
69 v2.0.11 notcurses_progbar(3)