summaryrefslogtreecommitdiff
path: root/src/widgets/menu.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/menu.rs')
-rw-r--r--src/widgets/menu.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/widgets/menu.rs b/src/widgets/menu.rs
index fe899e3..f90e62b 100644
--- a/src/widgets/menu.rs
+++ b/src/widgets/menu.rs
@@ -1,3 +1,9 @@
+//! A selection menu.
+//!
+//! The configuration for a menu is encapsulated in a `Data` struct, which
+//! contains some number of `Item` structs which describe the individual items
+//! to be chosen between.
+
use std::ffi::c_void;
use crate::bindings;
@@ -46,10 +52,15 @@ impl Menu {
}
}
+ /// Called automatically; should only be needed if something else overwrote
+ /// the widget.
pub fn redraw(&self) {
unsafe { bindings::menu_redraw(self.ptr); }
}
+ /// Process the given key in the context of the menu.
+ ///
+ /// The key should be a return value from `Keyboard::get_key()`.
pub fn handle_key(&mut self, key: i32) -> KeyResult {
match unsafe { bindings::menu_handlekey(self.ptr, key) } {
bindings::Menukey_MENUKEY_HANDLED => KeyResult::Handled,