pub struct MenuLineState {
pub area: Rect,
pub inner: Rect,
pub item_areas: Vec<Rect>,
pub navchar: Vec<Option<char>>,
pub disabled: Vec<bool>,
pub selected: Option<usize>,
pub focus: FocusFlag,
pub mouse: MouseFlags,
pub non_exhaustive: NonExhaustive,
}Expand description
State & event handling.
Fields§
§area: RectArea for the whole widget. readonly. renewed for each render.
inner: RectArea inside the block. read only. renewed for each render.
item_areas: Vec<Rect>Areas for each item. readonly. renewed for each render.
Hot keys readonly. renewed for each render.
disabled: Vec<bool>Disable menu-items. readonly. renewed for each render.
selected: Option<usize>Selected item. read+write
focus: FocusFlagCurrent focus state. read+write
mouse: MouseFlagsFlags for mouse handling. used for mouse interaction
non_exhaustive: NonExhaustiveImplementations§
Source§impl MenuLineState
impl MenuLineState
pub fn new() -> Self
Select by hotkey
Sourcepub fn select_at(&mut self, pos: (u16, u16)) -> bool
pub fn select_at(&mut self, pos: (u16, u16)) -> bool
Select item at position. Only reports a change if the selection actually changed. Reports no change before the first render and if no item was hit.
Sourcepub fn select_at_always(&mut self, pos: (u16, u16)) -> bool
pub fn select_at_always(&mut self, pos: (u16, u16)) -> bool
Select item at position. Reports a change even if the same menu item has been selected. Reports no change before the first render and if no item was hit.
Trait Implementations§
Source§impl Clone for MenuLineState
impl Clone for MenuLineState
Source§impl Debug for MenuLineState
impl Debug for MenuLineState
Source§impl Default for MenuLineState
impl Default for MenuLineState
Source§impl HandleEvent<Event, MouseOnly, MenuOutcome> for MenuLineState
impl HandleEvent<Event, MouseOnly, MenuOutcome> for MenuLineState
Source§impl HandleEvent<Event, Regular, MenuOutcome> for MenuLineState
impl HandleEvent<Event, Regular, MenuOutcome> for MenuLineState
Source§impl HasFocus for MenuLineState
impl HasFocus for MenuLineState
Source§fn build(&self, builder: &mut FocusBuilder)
fn build(&self, builder: &mut FocusBuilder)
Build the focus-structure for the container.
Declares how the widget interacts with focus. Read more
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Focused?
Source§fn lost_focus(&self) -> bool
fn lost_focus(&self) -> bool
Just lost focus.
Source§fn gained_focus(&self) -> bool
fn gained_focus(&self) -> bool
Just gained focus.
Source§impl HasScreenCursor for MenuLineState
impl HasScreenCursor for MenuLineState
Source§impl RelocatableState for MenuLineState
impl RelocatableState for MenuLineState
Source§fn relocate(&mut self, shift: (i16, i16), clip: Rect)
fn relocate(&mut self, shift: (i16, i16), clip: Rect)
Relocate the areas in this widgets state. Read more
Source§fn relocate_popup(&mut self, shift: (i16, i16), clip: Rect)
fn relocate_popup(&mut self, shift: (i16, i16), clip: Rect)
Relocate only popup areas.
As rendering the popups is a separate render,
this has to be separate too.
Relocate all popup areas to a clip-rect (0,0+0x0).
Relocate all areas to a clip-rect (0,0+0x0).
Auto Trait Implementations§
impl !Freeze for MenuLineState
impl !RefUnwindSafe for MenuLineState
impl !Send for MenuLineState
impl !Sync for MenuLineState
impl Unpin for MenuLineState
impl !UnwindSafe for MenuLineState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more