mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
remove AppFocus
This commit is contained in:
parent
3273c85630
commit
e4027619e8
14 changed files with 127 additions and 140 deletions
|
|
@ -238,14 +238,6 @@ impl Debug for PhrasePlayerModel {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum AppFocus<T: Copy + Debug + PartialEq> {
|
||||
/// The menu bar is focused
|
||||
Menu,
|
||||
/// The app content is focused
|
||||
Content(T)
|
||||
}
|
||||
|
||||
pub trait FocusWrap<T> {
|
||||
fn wrap <'a, W: Widget<Engine = Tui>> (self, focus: T, content: &'a W)
|
||||
-> impl Widget<Engine = Tui> + 'a;
|
||||
|
|
@ -254,7 +246,7 @@ pub trait FocusWrap<T> {
|
|||
#[macro_export] macro_rules! impl_focus {
|
||||
($Struct:ident $Focus:ident $Grid:expr) => {
|
||||
impl HasFocus for $Struct {
|
||||
type Item = AppFocus<$Focus>;
|
||||
type Item = $Focus;
|
||||
/// Get the currently focused item.
|
||||
fn focused (&self) -> Self::Item {
|
||||
self.focus.inner()
|
||||
|
|
@ -285,8 +277,7 @@ pub trait FocusWrap<T> {
|
|||
fn focus_cursor_mut (&mut self) -> &mut (usize, usize) {
|
||||
&mut self.cursor
|
||||
}
|
||||
fn focus_layout (&self) -> &[&[AppFocus<$Focus>]] {
|
||||
use AppFocus::*;
|
||||
fn focus_layout (&self) -> &[&[$Focus]] {
|
||||
use $Focus::*;
|
||||
&$Grid
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue