[][src]Struct druid::widget::Tabs

pub struct Tabs<TP: TabsPolicy> { /* fields omitted */ }

A tabs widget.

The tabs can be provided up front, using Tabs::new() and add_tab()/with_tab().

Or, the tabs can be derived from the input data by implementing TabsPolicy, and providing it to Tabs::from_policy()

use druid::widget::{Tabs, Label, WidgetExt};
use druid::{Data, Lens};

#[derive(Data, Clone, Lens)]
struct AppState{
    name: String
}

let tabs = Tabs::new()
    .with_tab("Connection", Label::new("Connection information"))
    .with_tab("Proxy", Label::new("Proxy settings"))
    .lens(AppState::name);

Implementations

impl<T: Data> Tabs<StaticTabs<T>>[src]

pub fn new() -> Self[src]

Create a new Tabs widget, using the static tabs policy. Use with_tab or add_tab to configure the set of tabs available.

impl<TP: TabsPolicy> Tabs<TP>[src]

pub fn for_policy(tabs: TP) -> Self[src]

Create a Tabs widget using the provided policy. This is useful for tabs derived from data.

pub fn with_axis(self, axis: Axis) -> Self[src]

Lay out the tab bar along the provided axis.

pub fn with_edge(self, edge: TabsEdge) -> Self[src]

Put the tab bar on the specified edge of the cross axis.

pub fn with_transition(self, transition: TabsTransition) -> Self[src]

Use the provided transition when tabs change

pub fn with_tab(
    self,
    name: impl Into<LabelText<TP::Input>>,
    child: impl Widget<TP::Input> + 'static
) -> Tabs<TP> where
    TP: AddTab, 
[src]

Available when the policy implements AddTab - e.g StaticTabs. Return this Tabs widget with the named tab added.

pub fn add_tab(
    &mut self,
    name: impl Into<LabelText<TP::Input>>,
    child: impl Widget<TP::Input> + 'static
) where
    TP: AddTab, 
[src]

Available when the policy implements AddTab - e.g StaticTabs. Return this Tabs widget with the named tab added.

Trait Implementations

impl<T: Data> Default for Tabs<StaticTabs<T>>[src]

impl<TP: TabsPolicy> Widget<<TP as TabsPolicy>::Input> for Tabs<TP>[src]

Auto Trait Implementations

impl<TP> !RefUnwindSafe for Tabs<TP>[src]

impl<TP> !Send for Tabs<TP>[src]

impl<TP> !Sync for Tabs<TP>[src]

impl<TP> Unpin for Tabs<TP> where
    TP: Unpin,
    <TP as TabsPolicy>::Build: Unpin,
    <TP as TabsPolicy>::Input: Unpin
[src]

impl<TP> !UnwindSafe for Tabs<TP>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.