notcurses_progbar(3)

πŸ’… notcurses_progbar: high level widget for progress bars πŸ’…

okay bestie, welcome to the notcurses_progbar manual page β€” yes, the manual name is literally notcurses_progbar, and this is the high-level widget for progress bars. it’s giving β€œI draw bars in four directions” energy, no cap. 🫢

🌸 NAME 🌸

notcurses_progbar β€” high level widget for progress bars πŸ’–

✨ SYNOPSIS ✨

       #include <notcurses/notcurses.h>

              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; // "up" is the direction we are progressing towards, and
                uint32_t blchannel; // "bottom" is the direction of origin. for monochromatic
                uint32_t brchannel; // bar, all four channels ought be the same.
                uint64_t flags;
              } ncprogbar_options;

       struct ncprogbar* ncprogbar_create(struct ncplane* n, const
       ncprogbar_options* opts)

       struct ncplane* ncprogbar_plane(struct ncprogbar* n)

       int ncprogbar_set_progress(struct ncprogbar* n, double p)

       double ncprogbar_progress(const struct ncprogbar* n)

       void ncprogbar_destroy(struct ncprogbar* n)

the one flag rn is NCPROGBAR_OPTION_RETROGRADE (0x0001u) β€” proceed left/down πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

these functions draw progress bars in any of four directions. the progress measure is a double between zero and one, inclusive, provided to ncprogbar_set_progress. this will be scaled to the size of the provided ncplane n. the axis of progression is the longer element of the plane’s geometry. horizontal bars proceed to the right by default, and vertical bars proceed up. this can be changed with NCPROGBAR_OPTION_RETROGRADE. periodt. πŸ’«

πŸŽ€ NOTES πŸŽ€

ncprogbar_create takes ownership of n in all cases. on failure, n will be destroyed immediately. it is otherwise destroyed by ncprogbar_destroy. so yeah, bestie, the ownership rules are not playing around πŸ«‘πŸ’–

⭐ RETURN VALUES ⭐

  • ncprogbar_plane returns the ncplane on which the progress bar is drawn. πŸ’…
  • ncprogbar_progress returns the current progress, a value between zero and one, inclusive. they cannot fail. ✨
  • ncprogbar_set_progress returns -1 if p is less than zero or greater than one, or if there is an internal error redrawing the progress bar. it returns 0 otherwise. 🎯

πŸ’€ BUGS πŸ’€

whether progression is to the left or right by default probably ought be an aspect of the current locale. like… locale said β€œvibes” and left it at that, apparently πŸ™ˆ

🌈 SEE ALSO 🌈

πŸ‘‘ AUTHORS πŸ‘‘

nick black nickblack@linux.com πŸ’œ

xoxo, your notcurses v2.0.11 bestie β€” page notcurses_progbar(3) out πŸ’–

πŸ“¦ where this page comes from