diff options
author | Alexandre Bury <alexandre.bury@gmail.com> | 2022-01-12 14:37:27 -0500 |
---|---|---|
committer | Alexandre Bury <alexandre.bury@gmail.com> | 2022-01-12 14:37:27 -0500 |
commit | 00e8147473c01767a000070b9dada5c965ff92a0 (patch) | |
tree | c997c6895c094a071b633ddf77086b128cbb2cb1 /src/views.rs | |
parent | 27092d042cfdf656e8a13d4c6fa4a2c1275974ec (diff) |
Update to cursive 0.17
Diffstat (limited to 'src/views.rs')
-rw-r--r-- | src/views.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/views.rs b/src/views.rs index ca4f757..1bda8a8 100644 --- a/src/views.rs +++ b/src/views.rs @@ -1,7 +1,7 @@ use cursive::direction::Direction; use cursive::event::{Event, EventResult, Key}; use cursive::theme::{ColorStyle, Effect, Style}; -use cursive::view::View; +use cursive::view::{CannotFocus, View}; use cursive::{Printer, Vec2}; use chrono::prelude::*; @@ -16,7 +16,7 @@ use crate::CONFIGURATION; pub trait ShadowView { fn draw(&self, printer: &Printer); fn required_size(&mut self, _: Vec2) -> Vec2; - fn take_focus(&mut self, _: Direction) -> bool; + fn take_focus(&mut self, _: Direction) -> Result<EventResult, CannotFocus>; fn on_event(&mut self, e: Event) -> EventResult; } @@ -151,8 +151,8 @@ where (25, 6).into() } - fn take_focus(&mut self, _: Direction) -> bool { - true + fn take_focus(&mut self, _: Direction) -> Result<EventResult, CannotFocus> { + Ok(EventResult::consumed()) } fn on_event(&mut self, e: Event) -> EventResult { @@ -183,7 +183,7 @@ macro_rules! auto_view_impl { fn required_size(&mut self, x: Vec2) -> Vec2 { ShadowView::required_size(self, x) } - fn take_focus(&mut self, d: Direction) -> bool { + fn take_focus(&mut self, d: Direction) -> Result<EventResult, CannotFocus> { ShadowView::take_focus(self, d) } fn on_event(&mut self, e: Event) -> EventResult { |