TabbedState

Struct TabbedState 

Source
pub struct TabbedState {
    pub area: Rect,
    pub block_area: Rect,
    pub widget_area: Rect,
    pub tab_title_area: Rect,
    pub tab_title_areas: Vec<Rect>,
    pub tab_title_close_areas: Vec<Rect>,
    pub selected: Option<usize>,
    pub focus: FocusFlag,
    pub mouse: MouseFlagsN,
}
Expand description

State & event-handling.

Fields§

§area: Rect

Total area. readonly. renewed for each render.

§block_area: Rect

Area for drawing the Block inside the tabs. readonly. renewed for each render.

§widget_area: Rect

Area used to render the content of the tab. Use this area to render the current tab content. readonly. renewed for each render.

§tab_title_area: Rect

Total area reserved for tabs. readonly. renewed for each render.

§tab_title_areas: Vec<Rect>

Area of each tab. readonly. renewed for each render.

§tab_title_close_areas: Vec<Rect>

Area for ‘Close Tab’ interaction. readonly. renewed for each render.

§selected: Option<usize>

Selected Tab, only ever is None if there are no tabs. Otherwise, set to 0 on render. read+write_

§focus: FocusFlag

Focus read+write

§mouse: MouseFlagsN

Mouse flags read+write

Implementations§

Source§

impl TabbedState

Source

pub fn new() -> Self

New initial state.

Source

pub fn named(name: &str) -> Self

State with a focus name.

Source

pub fn selected(&self) -> Option<usize>

Source

pub fn select(&mut self, selected: Option<usize>)

Source

pub fn next_tab(&mut self) -> bool

Selects the next tab. Stops at the end.

Source

pub fn prev_tab(&mut self) -> bool

Selects the previous tab. Stops at the end.

Trait Implementations§

Source§

impl Clone for TabbedState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TabbedState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TabbedState

Source§

fn default() -> TabbedState

Returns the “default value” for a type. Read more
Source§

impl HandleEvent<Event, MouseOnly, TabbedOutcome> for TabbedState

Source§

fn handle(&mut self, event: &Event, _qualifier: MouseOnly) -> TabbedOutcome

Handle an event. Read more
Source§

impl HandleEvent<Event, Regular, TabbedOutcome> for TabbedState

Handle the regular events for Tabbed.

Source§

fn handle(&mut self, event: &Event, _qualifier: Regular) -> TabbedOutcome

Handle an event. Read more
Source§

impl HasFocus for TabbedState

Source§

fn build(&self, builder: &mut FocusBuilder)

Build the focus-structure for the container.
Source§

fn focus(&self) -> FocusFlag

Access to the flag for the rest.
Source§

fn area(&self) -> Rect

Area for mouse focus. Read more
Source§

fn navigable(&self) -> Navigation

Declares how the widget interacts with focus. Read more
Source§

fn id(&self) -> usize

Provide a unique id for the widget.
Source§

fn area_z(&self) -> u16

Z value for the area. Read more
Source§

fn is_focused(&self) -> bool

Focused?
Source§

fn lost_focus(&self) -> bool

Just lost focus.
Source§

fn gained_focus(&self) -> bool

Just gained focus.
Source§

impl RelocatableState for TabbedState

Source§

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)

Relocate only popup areas. As rendering the popups is a separate render, this has to be separate too.
Source§

fn relocate_popup_hidden(&mut self)

Relocate all popup areas to a clip-rect (0,0+0x0).
Source§

fn relocate_hidden(&mut self)

Relocate all areas to a clip-rect (0,0+0x0).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.