summaryrefslogtreecommitdiff
path: root/src/widgets/menu.rs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-02-10 20:37:02 +0100
committertomsmeding <tom.smeding@gmail.com>2019-02-10 20:37:02 +0100
commit3bc00f5f3f030acc8dbbf8018f6c2a99561ca709 (patch)
treee8f0298cc59a9ad235d3b746732e887c00474212 /src/widgets/menu.rs
parent42c70e05335f00dfe720860917819135f8a207b9 (diff)
Update organisation and documentHEADmaster
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,