Spinbox

Struct Spinbox 

Source
pub struct Spinbox<T> {
    pub value: T,
    pub textbox: Entity,
    pub increment: Entity,
    pub decrement: Entity,
    pub increment_value: T,
    pub decrement_value: T,
    pub min: T,
    pub max: T,
    /* private fields */
}

Fields§

§value: T§textbox: Entity§increment: Entity§decrement: Entity§increment_value: T§decrement_value: T§min: T§max: T

Implementations§

Source§

impl<T> Spinbox<T>

Source

pub fn new(initial_value: T) -> Self

Source

pub fn with_increment(self, increment_value: T) -> Self

Set the increment value of the spinbox

Source

pub fn with_decrement(self, decrement_value: T) -> Self

Set the decrement value of the spinbox

Source

pub fn with_min(self, min_value: T) -> Self

Set the minimum value of the spinbox

Source

pub fn with_max(self, max_value: T) -> Self

Set the maximum value of the spinbox

Source

pub fn on_increment<F>(self, callback: F) -> Self
where F: Fn(&mut Self, &mut State, Entity) + 'static,

Set callback triggered when the spinbox is incremented

Source

pub fn on_decrement<F>(self, callback: F) -> Self
where F: Fn(&mut Self, &mut State, Entity) + 'static,

Set callback triggered when the spinbox is decremented

Source

pub fn on_change<F>(self, callback: F) -> Self
where F: 'static + Fn(&mut Self, &mut State, Entity),

Source

pub fn on_max<F>(self, callback: F) -> Self
where F: 'static + Fn(&mut Self, &mut State, Entity),

Source

pub fn on_min<F>(self, callback: F) -> Self
where F: 'static + Fn(&mut Self, &mut State, Entity),

Trait Implementations§

Source§

impl<T> Widget for Spinbox<T>

Source§

type Ret = Entity

Source§

type Data = T

Source§

fn on_build(&mut self, state: &mut State, entity: Entity) -> Self::Ret

Source§

fn on_event(&mut self, state: &mut State, entity: Entity, event: &mut Event)

Source§

fn widget_name(&self) -> String

Source§

fn build<F>( self, state: &mut State, parent: impl AsEntity, builder: F, ) -> Self::Ret
where F: FnMut(Builder<'_, Self>) -> Builder<'_, Self>, Self: Sized + 'static,

Adds the widget into state and returns the associated type Ret - an entity id or a tuple of entity ids
Source§

fn bind<L, F>(self, lens: L, converter: F) -> Wrapper<L, Self>
where L: Lens, F: 'static + Fn(&<L as Lens>::Target) -> Self::Data,

Source§

fn bind2<L>(self, lens: L) -> LensWrap<L, Self>
where L: Lens,

Source§

fn on_update(&mut self, state: &mut State, entity: Entity, data: &Self::Data)

Source§

fn on_style( &mut self, state: &mut State, entity: Entity, property: (String, PropType), )

Source§

fn on_draw( &mut self, state: &mut State, entity: Entity, canvas: &mut Canvas<OpenGl>, )

Auto Trait Implementations§

§

impl<T> Freeze for Spinbox<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for Spinbox<T>

§

impl<T> !Send for Spinbox<T>

§

impl<T> !Sync for Spinbox<T>

§

impl<T> Unpin for Spinbox<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Spinbox<T>

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> EventHandler for T
where T: Widget + 'static,

Source§

fn widget_name(&self) -> String

Source§

fn on_update( &mut self, state: &mut State, entity: Entity, node: &(dyn Node + 'static), )

Source§

fn on_event_(&mut self, state: &mut State, entity: Entity, event: &mut Event)

Source§

fn on_style( &mut self, state: &mut State, entity: Entity, property: (String, PropType), )

Source§

fn on_draw_( &mut self, state: &mut State, entity: Entity, canvas: &mut Canvas<OpenGl>, )

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.
Source§

impl<T> Node for T
where T: 'static,