libnotcurses_sys/widgets/progbar/mod.rs
1//! `NcProgbar` widget.
2
3// functions already exported by bindgen : 5
4// -----------------------------------------
5// (#) test: 0
6// (W) wrap: 5 / 0
7// -----------------------------------------
8//W ncprogbar_create,
9//W ncprogbar_destroy,
10//W ncprogbar_plane,
11//W ncprogbar_progress,
12//W ncprogbar_set_progress,
13
14use crate::c_api::ffi;
15
16mod methods;
17
18/// Progress bars. They proceed linearly in any of four directions.
19///
20/// The entirety of the plane will be used -- any border should be provided by
21/// the caller on another plane.
22///
23/// The plane will not be erased; text preloaded into the plane will be consumed
24/// by the progress indicator.
25///
26/// The bar is redrawn for each provided progress report (a double between 0
27/// and 1), and can regress with lower values.
28///
29/// The procession will take place along the longer dimension at the time of each
30/// redraw, with the horizontal length scaled by 2 for purposes of comparison.
31/// I.e. for a plane of 20 rows and 50 columns, the progress will be to the
32/// right (50 > 40), or left with
33/// [NcProgBarOptions::RETROGRADE][NcProgBarOptions#associatedconstant.RETROGRADE].
34///
35/// `type in C: ncprogbar (struct)`
36///
37pub type NcProgBar = ffi::ncprogbar;
38
39/// Options struct for [`NcProgBar`]
40///
41/// `type in C: ncprogbar_options (struct)`
42///
43pub type NcProgBarOptions = ffi::ncprogbar_options;
44
45impl NcProgBarOptions {
46 /// proceeds left/down
47 pub const RETROGRADE: u32 = c_api::NCPROGBAR_OPTION_RETROGRADE;
48}
49
50pub(crate) mod c_api {
51 use super::ffi;
52
53 /// [`NcProgBarOptions`][super::NcProgBarOptions] flag
54 /// to indicate proceeding left/down.
55 pub const NCPROGBAR_OPTION_RETROGRADE: u32 = ffi::NCPROGBAR_OPTION_RETROGRADE;
56}