pub struct ButtonBuilder { /* private fields */ }Expand description
Button builder is used to create Button widget instances.
Implementations§
Source§impl ButtonBuilder
impl ButtonBuilder
Sourcepub fn new(widget_builder: WidgetBuilder) -> ButtonBuilder
pub fn new(widget_builder: WidgetBuilder) -> ButtonBuilder
Creates a new button builder with a widget builder instance.
Sourcepub fn with_text(self, text: &str) -> ButtonBuilder
pub fn with_text(self, text: &str) -> ButtonBuilder
Sets the content of the button to be ButtonContent::Text (text with the default font).
Sourcepub fn with_text_and_font(
self,
text: &str,
font: Resource<Font>,
) -> ButtonBuilder
pub fn with_text_and_font( self, text: &str, font: Resource<Font>, ) -> ButtonBuilder
Sets the content of the button to be ButtonContent::Text (text with a custom font).
Sourcepub fn with_text_and_font_size(
self,
text: &str,
font: Resource<Font>,
size: StyledProperty<f32>,
) -> ButtonBuilder
pub fn with_text_and_font_size( self, text: &str, font: Resource<Font>, size: StyledProperty<f32>, ) -> ButtonBuilder
Sets the content of the button to be ButtonContent::Text (text with a custom font and size).
Sourcepub fn with_content(self, node: Handle<UiNode>) -> ButtonBuilder
pub fn with_content(self, node: Handle<UiNode>) -> ButtonBuilder
Sets the content of the button to be ButtonContent::Node (arbitrary widget handle).
Sourcepub fn with_back(self, decorator: Handle<UiNode>) -> ButtonBuilder
pub fn with_back(self, decorator: Handle<UiNode>) -> ButtonBuilder
Specifies the widget that will be used as a content holder of the button. By default it is an
instance of crate::decorator::Decorator widget. Usually, this widget should respond to mouse
events to highlight button state (hovered, pressed, etc.)
Sourcepub fn with_repeat_clicks_on_hold(self, repeat: bool) -> ButtonBuilder
pub fn with_repeat_clicks_on_hold(self, repeat: bool) -> ButtonBuilder
Set the flag, that defines whether the button should repeat click message when being hold or not.
Default is false (disabled).
Sourcepub fn with_repeat_interval(self, interval: f32) -> ButtonBuilder
pub fn with_repeat_interval(self, interval: f32) -> ButtonBuilder
Sets the desired click repetition interval (in seconds) of the button. Default is 0.1s
Sourcepub fn build_node(self, ctx: &mut BuildContext<'_>) -> UiNode
pub fn build_node(self, ctx: &mut BuildContext<'_>) -> UiNode
Finishes building a button.
Sourcepub fn build(self, ctx: &mut BuildContext<'_>) -> Handle<UiNode>
pub fn build(self, ctx: &mut BuildContext<'_>) -> Handle<UiNode>
Finishes button build and adds to the user interface and returns its handle.
Auto Trait Implementations§
impl Freeze for ButtonBuilder
impl !RefUnwindSafe for ButtonBuilder
impl Send for ButtonBuilder
impl Sync for ButtonBuilder
impl Unpin for ButtonBuilder
impl !UnwindSafe for ButtonBuilder
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.