Skip to main content

Tab

Struct Tab 

Source
pub struct Tab { /* private fields */ }

Implementations§

Source§

impl Tab

Source

pub fn new<S: ToString>(name: S, content: WindowRef) -> Self

Creates an unique tab for a window - the name will be shown in the tab itself

Examples found in repository?
examples/tabview.rs (line 47)
31	fn default() -> Self {
32		let label = WindowFactory::create::<Label>();
33		label.borrow_mut().set_text("Lorem ipsum");
34		let label2 = WindowFactory::create::<Label>();
35		label2.borrow_mut().set_text("Bibsum loram");
36		let label3 = WindowFactory::create::<Label>();
37		label3.borrow_mut().set_text("Epsum larel");
38		let label4 = WindowFactory::create::<Label>();
39		label4.borrow_mut().set_text("Ipsel Aarel");
40
41		let tabview = WindowFactory::create::<TabView>();
42		{
43			let mut brw = tabview.borrow_mut();
44			brw.enable_tab_enumeration();
45			brw.set_highlight_fg_color(Some(Color::Grey));
46			brw.set_highlight_bg_color(Some(Color::Blue));
47			brw.add_item(Tab::new("WIP Tab Number. 1", label));
48			brw.add_item(Tab::new("WIP Tab Number. 2", label2));
49			brw.add_item(Tab::new("WIP Tab Number. 3", label3));
50			brw.add_item(Tab::new("WIP Tab Number. 4", label4));
51		}
52
53		Self {
54			uid: WindowUID::new(),
55			tabview,
56			running: true,
57		}
58	}
Source

pub fn content(&self) -> &WindowRef

Returns the window inside the Tab

Trait Implementations§

Source§

impl ItemCollection<Tab> for TabView

Source§

type Index = usize

Type used to index the underlying collection
Source§

fn add_item(&mut self, item: Tab)

Adds an item to the underlying collection
Source§

fn remove_item(&mut self, item: &Tab)

Removes an item from the underlying collection
Source§

fn remove_at(&mut self, index: Self::Index) -> Tab

Removes an item at the given index from the underlying collection Might panic if index is invalid
Source§

fn get_item(&mut self, index: Self::Index) -> Option<&Tab>

Returns an item from the collection by its index
Source§

fn clear_items(&mut self)

Clears all items in the underlying collection
Source§

fn items(&self) -> Self::Index

Returns the number of items in the underlying collection
Source§

impl PartialEq for Tab

This will only compare the internal unique IDs

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Tab

§

impl !Send for Tab

§

impl !Sync for Tab

§

impl !UnwindSafe for Tab

§

impl Freeze for Tab

§

impl Unpin for Tab

§

impl UnsafeUnpin for Tab

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> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Source§

fn type_name(&self) -> &'static str

Gets the type name of self
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> Downcast for T
where T: AsAny + ?Sized,

Source§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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, 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.