pub struct TabStack<W: Widget> { /* private fields */ }
Expand description

A tabbed stack of widgets

A stack consists a set of child widgets, “pages”, all of equal size. Only a single page is visible at a time. The page is “turned” via tab handles or calling Self::set_active.

Type parameter D controls the position of tabs relative to the stack; default value is Direction::Up: tabs are positioned above the stack. Within the bar, items are always left-to-right (TODO: support for vertical bars).

This may only be parametrised with a single widget type, thus usually it will be necessary to box children (this is what BoxTabStack is).

See also the main implementing widget: Stack.

Implementations

Construct a new, empty instance

Set the position of tabs relative to content

Default value: Direction::Up

Limit the number of pages considered by Layout::size_rules

By default, this is usize::MAX: all pages affect the result. If this is set to 1 then only the active page will affect the result. If this is n > 1, then min(n, num_pages) pages (including active) will be used. (If this is set to 0 it is silently replaced with 1.)

Using a limit lower than the number of pages has two effects: (1) resizing is faster and (2) calling Self::set_active may cause a full-window resize.

Get the index of the active page

Set the active page (inline)

Unlike Self::set_active, this does not update anything; it is assumed that sizing happens afterwards.

Set the active page

Behaviour depends on whether SizeRules were already solved for index (see Self::set_size_limit and note that methods like Self::push do not solve rules for new pages). Case:

Get a direct reference to the active child widget, if any

True if there are no pages

Returns the number of pages

Remove all pages

This does not change the active page index.

Get a page

Get a page

Get a tab

Get a tab

Append a page (inline)

Does not configure or size child.

Append a page (inline)

Does not configure or size child.

Append a page

The new page is configured immediately. If it becomes the active page and then TkAction::RESIZE will be triggered.

Returns the new page’s index.

Remove the last child widget (if any) and return

If this page was active then the previous page becomes active.

Inserts a child widget position index

Panics if index > len.

The new child is configured immediately. The active page does not change.

Removes the child widget at position index

Panics if index is out of bounds.

If the active page is removed then the previous page (if any) becomes active.

Replace the child at index

Panics if index is out of bounds.

The new child is configured immediately. If it replaces the active page, then TkAction::RESIZE is triggered.

Append child widgets from an iterator

New children are configured immediately. If a new page becomes active, then TkAction::RESIZE is triggered.

Trait Implementations

Get size rules for the given axis Read more

Set size and position Read more

Translate a coordinate to a WidgetId Read more

Draw a widget and its children Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Converts to this type from the input type.

Get size rules for the given axis Read more

Set size and position Read more

Translate a coordinate to a WidgetId Read more

Draw a widget and its children Read more

Navigation in spatial order Read more

Handler for messages from children/descendants Read more

Pre-configuration Read more

Configure widget Read more

Is this widget navigable via Tab key? Read more

Get translation of children relative to this widget Read more

Handle an event sent to this widget Read more

Potentially steal an event before it reaches a child Read more

Handle an event sent to child index but left unhandled Read more

Handler for scrolling Read more

Get the number of child widgets Read more

Get a reference to a child widget by index, or None if the index is out of bounds. Read more

Mutable variant of get Read more

Find the child which is an ancestor of this id, if any Read more

Make an identifier for a child Read more

Get the widget’s identifier Read more

Get the widget’s region, relative to its parent.

Get the name of the widget struct

Erase type

Erase type

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Cast from Self to T Read more

Try converting from Self to T Read more

Try approximate conversion from Self to T Read more

Cast approximately from Self to T Read more

Cast to integer, truncating Read more

Cast to the nearest integer Read more

Cast the floor to an integer Read more

Cast the ceiling to an integer Read more

Try converting to integer with truncation Read more

Try converting to the nearest integer Read more

Try converting the floor to an integer Read more

Try convert the ceiling to an integer Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Get the widget’s identifier Read more

Test widget identifier for equality Read more

Display as “StructName#WidgetId”

Check whether id is self or a descendant Read more

Check whether id is not self and is a descendant Read more

Find the descendant with this id, if any

Find the descendant with this id, if any