.\" Automatically generated by Pandoc 3.1.8 .\" .TH "notcurses_progbar" "3" "v2.0.11" "" "" .SH NAME notcurses_progbar - high level widget for progress bars .SH SYNOPSIS \f[B]#include \f[R] .IP .EX struct ncprogbar; #define NCPROGBAR_OPTION_RETROGRADE 0x0001u // proceed left/down typedef struct ncprogbar_options { uint32_t ulchannel; // upper-left channel. in the context of a progress bar, uint32_t urchannel; // \[dq]up\[dq] is the direction we are progressing towards, and uint32_t blchannel; // \[dq]bottom\[dq] is the direction of origin. for monochromatic uint32_t brchannel; // bar, all four channels ought be the same. uint64_t flags; } ncprogbar_options; .EE .PP \f[B]struct ncprogbar* ncprogbar_create(struct ncplane* \f[R]\f[I]n\f[R]\f[B], const ncprogbar_options* \f[R]\f[I]opts\f[R]\f[B])\f[R] .PP \f[B]struct ncplane* ncprogbar_plane(struct ncprogbar* \f[R]\f[I]n\f[R]\f[B])\f[R] .PP \f[B]int ncprogbar_set_progress(struct ncprogbar* \f[R]\f[I]n\f[R]\f[B], double \f[R]\f[I]p\f[R]\f[B])\f[R] .PP \f[B]double ncprogbar_progress(const struct ncprogbar* \f[R]\f[I]n\f[R]\f[B])\f[R] .PP \f[B]void ncprogbar_destroy(struct ncprogbar* \f[R]\f[I]n\f[R]\f[B])\f[R] .SH DESCRIPTION These functions draw progress bars in any of four directions. The progress measure is a \f[B]double\f[R] between zero and one, inclusive, provided to \f[B]ncprogbar_set_progress\f[R]. This will be scaled to the size of the provided ncplane \f[B]\f[BI]n\f[B]\f[R]. The axis of progression is the longer element of the plane\[aq]s geometry. Horizontal bars proceed to the right by default, and vertical bars proceed up. This can be changed with \f[B]NCPROGBAR_OPTION_RETROGRADE\f[R]. .SH NOTES \f[B]ncprogbar_create\f[R] takes ownership of \f[B]\f[BI]n\f[B]\f[R] in all cases. On failure, \f[B]\f[BI]n\f[B]\f[R] will be destroyed immediately. It is otherwise destroyed by \f[B]ncprogbar_destroy\f[R]. .SH RETURN VALUES \f[B]ncprogbar_plane\f[R] returns the \f[B]ncplane\f[R] on which the progress bar is drawn. \f[B]ncprogbar_progress\f[R] returns the current progress, a value between zero and one, inclusive. They cannot fail. .PP \f[B]ncprogbar_set_progress\f[R] returns -1 if \f[B]\f[BI]p\f[B]\f[R] is less than zero or greater than one, or if there is an internal error redrawing the progress bar. It returns 0 otherwise. .SH BUGS Whether progression is to the left or right by default probably ought be an aspect of the current locale. .SH SEE ALSO \f[B]notcurses(3)\f[R], \f[B]notcurses_plane(3)\f[R], \f[B]notcurses_visual(3)\f[R] .SH AUTHORS nick black .