Skip to main content

Label

Struct Label 

Source
pub struct Label { /* private fields */ }
Expand description

Shows text on the screen.

let label = Label::new("Hello world".to_owned());
lable.slot_set_text_alignment().exec_for(TextAlignment::Center);

§Macros

You can use [u_label!] to simplify Label creation/setup:

let label = u_label! {
    text: "Hello world!".to_owned(),
    text_alignment: TextAlignment::Center,
};

Implementations§

Source§

impl Label

Source

pub fn new(text: String) -> Label

Creates new Label with provided text. You may be interested in [u_label!] to simplify Label creation/setup.

let label = Label::new("Hello".to_owned());
Source

pub fn slot_set_text(&self) -> &dyn Slot<String>

Label’s text can be changed via provided slot

let label = u_label!{
    text: "Hello".to_owned(),
};

let mut signal = Signal::new();
signal.connect_slot(label.slot_set_text);

// <...>

// Changes label's text to "Goodbye"
signal.emit("Goodbye".to_owned());
Source

pub fn slot_set_text_alignment(&self) -> &dyn Slot<TextAlignment>

Label’s text alignment can be changed via provided slot

let label = u_lable!{
	text: "Hello".to_owned(),
};

let mut signal = Signal::new();
signal.connect_slot(label.slot_set_text_alignment());

// <...>

// Changes text alignemnt
signal.emit(TextAligment::Center);

Trait Implementations§

Source§

impl DataProcessor for Label

Source§

fn process_data(&mut self, _: i64, _: &mut dyn UiPageContext)

Will be called by crate::Application time to time Read more
Source§

impl Widget for Label

Source§

fn to_native( &mut self, widget_generator: &mut dyn WidgetGenerator, ) -> Result<NativeWidget, ()>

Generate native widget
Source§

fn draw(&mut self)

Allows drawing on top of generated NativeWidget

Auto Trait Implementations§

§

impl !RefUnwindSafe for Label

§

impl !Send for Label

§

impl !Sync for Label

§

impl !UnwindSafe for Label

§

impl Freeze for Label

§

impl Unpin for Label

§

impl UnsafeUnpin for Label

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> 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, 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.