libnotcurses_sys/widgets/menu/mod.rs
1//! `NcMenu` widget
2
3// functions already exported by bindgen : 13
4// ------------------------------------------
5// (#) test: 0
6// (W) wrap: 13
7// ------------------------------------------
8//W ncmenu_create
9//W ncmenu_destroy
10//W ncmenu_item_set_status
11//W ncmenu_mouse_selected
12//W ncmenu_nextitem
13//W ncmenu_nextsection
14//W ncmenu_offer_input
15//W ncmenu_plane
16//W ncmenu_previtem
17//W ncmenu_prevsection
18//W ncmenu_rollup
19//W ncmenu_selected
20//W ncmenu_unroll
21
22use crate::c_api::ffi;
23
24mod methods;
25
26/// menus on the top or bottom rows
27///
28/// An [Nc][crate::Nc] instance supports menu bars on the top or bottom row
29/// of the true screen.
30///
31/// An NcMenu is composed of [`NcMenuSection`]s, which are in turn composed of
32/// [`NcMenuItem`]s.
33///
34/// Either no sections are visible, and the menu is rolled up, or exactly one
35/// section is unrolled.
36///
37/// - [rollup()][NcMenu#method.rollup]
38/// places an `NcMenu` in the rolled up state.
39/// - [unroll()][NcMenu#method.unroll]
40/// rolls up any unrolled section and unrolls the specified one.
41/// - [destroy()][NcMenu#method.destroy]
42/// removes a menu bar, and frees all associated resources.
43///
44/// `type in C: ncmenu (struct)`
45pub type NcMenu = ffi::ncmenu;
46
47/// Options struct for [`NcMenu`].
48pub type NcMenuOptions = ffi::ncmenu_options;
49
50/// Item for [`NcMenu`].
51pub type NcMenuItem = ffi::ncmenu_item;
52
53/// Section for [`NcMenu`].
54pub type NcMenuSection = ffi::ncmenu_section;
55
56impl NcMenuOptions {
57 /// [`NcMenuOptions`] flag: Bottom row (as opposed to top row).
58 pub const BOTTOM: u64 = c_api::NCMENU_OPTION_BOTTOM;
59
60 /// [`NcMenuOptions`] flag: Hides the menu when not unrolled.
61 pub const HIDING: u64 = c_api::NCMENU_OPTION_HIDING;
62}
63
64pub(crate) mod c_api {
65 use super::ffi;
66 #[allow(unused_imports)]
67 use super::NcMenuOptions;
68
69 /// [`NcMenuOptions`] flag: Bottom row (as opposed to top row).
70 pub const NCMENU_OPTION_BOTTOM: u64 = ffi::NCMENU_OPTION_BOTTOM as u64;
71
72 /// [`NcMenuOptions`] flag: Hides the menu when not unrolled.
73 pub const NCMENU_OPTION_HIDING: u64 = ffi::NCMENU_OPTION_HIDING as u64;
74}