Struct Button

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

Widget wich have a text and can be pressed by user.

Example (but you’re better to use macros insted):

let slot_button_clicked = SlotImpl::new();
let button = Button::new("PushMe".to_owned());
button.signal_clicked().connect_slot(&slot_button_clicked);

§Macros

You may be interested in u_button! macros to simplify Button creation. Better example with macros:

use uniui_widget_button::prelude::*;

let slot_button_clicked = SlotImpl::new();

let button = u_buton! {
    text: "PushMe".to_owned(),
    signal_clicked: &slot_button_clicked,
};

Implementations§

Source§

impl Button

Source

pub fn new(text: String) -> Self

Creates new Button with predefined text on it

Source

pub fn signal_clicked(&mut self) -> &mut Signal<()>

The signal will be triggered every time user clicks the button.

You can connect your slots to the signal to receive notification about user clicks.

Trait Implementations§

Source§

impl DataProcessor for Button

Source§

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

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

impl Widget for Button

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 Freeze for Button

§

impl !RefUnwindSafe for Button

§

impl !Send for Button

§

impl !Sync for Button

§

impl Unpin for Button

§

impl !UnwindSafe for Button

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.