[][src]Trait druid::widget::TabsPolicy

pub trait TabsPolicy: Data {
    type Key: Hash + Eq + Clone;
    type Input: Data;
    type BodyWidget: Widget<Self::Input>;
    type LabelWidget: Widget<Self::Input>;
    type Build;
    pub fn tabs_changed(
        &self,
        old_data: &Self::Input,
        data: &Self::Input
    ) -> bool;
pub fn tabs(&self, data: &Self::Input) -> Vec<Self::Key>;
pub fn tab_info(
        &self,
        key: Self::Key,
        data: &Self::Input
    ) -> TabInfo<Self::Input>;
pub fn tab_body(
        &self,
        key: Self::Key,
        data: &Self::Input
    ) -> Self::BodyWidget;
pub fn tab_label(
        &self,
        key: Self::Key,
        info: TabInfo<Self::Input>,
        data: &Self::Input
    ) -> Self::LabelWidget; pub fn close_tab(&self, key: Self::Key, data: &mut Self::Input) { ... }
pub fn build(build: Self::Build) -> Self { ... }
pub fn default_make_label(info: TabInfo<Self::Input>) -> Label<Self::Input> { ... } }

A policy that determines how a Tabs instance derives its tabs from its app data.

Associated Types

type Key: Hash + Eq + Clone[src]

The identity of a tab.

type Input: Data[src]

The input data that will: a) be used to determine the tabs present b) be the input data for all of the child widgets.

type BodyWidget: Widget<Self::Input>[src]

The common type for all body widgets in this set of tabs. A flexible default is Box<dyn WidgetSelf::Input>

type LabelWidget: Widget<Self::Input>[src]

The common type for all label widgets in this set of tabs Usually this would be LabelSelf::Input

type Build[src]

The information required to build up this policy. This is to support policies where at least some tabs are provided up front during widget construction. If the Build type implements the AddTab trait, the add_tab and with_tab methods will be available on the Tabs instance to allow the It can be filled in with () by implementations that do not require it.

Loading content...

Required methods

pub fn tabs_changed(&self, old_data: &Self::Input, data: &Self::Input) -> bool[src]

Examining the input data, has the set of tabs present changed? Expected to be cheap, eg pointer or numeric comparison.

pub fn tabs(&self, data: &Self::Input) -> Vec<Self::Key>[src]

From the input data, return the new set of tabs

pub fn tab_info(
    &self,
    key: Self::Key,
    data: &Self::Input
) -> TabInfo<Self::Input>
[src]

For this tab key, return the relevant tab information that will drive label construction

pub fn tab_body(&self, key: Self::Key, data: &Self::Input) -> Self::BodyWidget[src]

For this tab key, return the body widget

pub fn tab_label(
    &self,
    key: Self::Key,
    info: TabInfo<Self::Input>,
    data: &Self::Input
) -> Self::LabelWidget
[src]

Label widget for the tab. Usually implemented with a call to default_make_label ( can't default here because Self::LabelWidget isn't determined)

Loading content...

Provided methods

pub fn close_tab(&self, key: Self::Key, data: &mut Self::Input)[src]

Change the data to reflect the user requesting to close a tab.

pub fn build(build: Self::Build) -> Self[src]

Construct an instance of this TabsFromData from its Build type. The main use case for this is StaticTabs, where the tabs are provided by the app developer up front.

pub fn default_make_label(info: TabInfo<Self::Input>) -> Label<Self::Input>[src]

A default implementation for make label, if you do not wish to construct a custom widget.

Loading content...

Implementors

Loading content...