mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Add Cursive::clear_global_callbacks
This commit is contained in:
parent
b4f32b56bb
commit
48514991d2
@ -419,6 +419,28 @@ impl Cursive {
|
||||
.push(Callback::from_fn(cb));
|
||||
}
|
||||
|
||||
/// Removes any callback tied to the given event.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// # extern crate cursive;
|
||||
/// # use cursive::*;
|
||||
/// # fn main() {
|
||||
/// let mut siv = Cursive::new();
|
||||
///
|
||||
/// siv.add_global_callback('q', |s| s.quit());
|
||||
/// siv.clear_global_callbacks('q');
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn clear_global_callbacks<E>(&mut self, event: E)
|
||||
where
|
||||
E: Into<Event>,
|
||||
{
|
||||
let event = event.into();
|
||||
self.global_callbacks.remove(&event);
|
||||
}
|
||||
|
||||
/// Add a layer to the current screen.
|
||||
///
|
||||
/// # Examples
|
||||
|
Loading…
Reference in New Issue
Block a user