pub struct Button {
pub content: WidgetRef,
pub click: Listener,
pub style: ButtonStyle,
pub padding: Option<[f64; 4]>,
pub is_enabled: bool,
pub is_tab_stop: bool,
pub focus_node: Option<FocusNodeRef>,
pub template: Option<ButtonTemplate>,
pub key: Option<KeyRef>,
}Expand description
XAML Button: Content shown in the style’s bezel, Click raised on activation.
Fields§
§content: WidgetRefContent presented inside the selected control template.
click: ListenerRaised when the button activates.
style: ButtonStyleThe standard source style used when no template override is supplied.
padding: Option<[f64; 4]>Padding between the bezel and the content, in left, top, right, bottom order; the theme’s
ButtonPadding when None, as the style sets it.
is_enabled: boolWhether pointer and keyboard input can activate this button.
is_tab_stop: boolWhether sequential keyboard navigation stops here.
focus_node: Option<FocusNodeRef>Optional caller-owned focus node used by composite controls.
template: Option<ButtonTemplate>An alternate source template, such as TabView’s close button chrome.
key: Option<KeyRef>Identity retained across parent rebuilds.
Implementations§
Source§impl Button
impl Button
Sourcepub fn new<K>(content: impl IntoWidget<K>, click: Listener) -> Button
pub fn new<K>(content: impl IntoWidget<K>, click: Listener) -> Button
Creates a button with content and a Click callback.
Sourcepub fn text(text: impl Into<String>, click: Listener) -> Button
pub fn text(text: impl Into<String>, click: Listener) -> Button
A text Content, as <Button Content="…"/>.
Sourcepub fn style(self, style: ButtonStyle) -> Button
pub fn style(self, style: ButtonStyle) -> Button
Selects one of the standard source styles.
Sourcepub fn is_enabled(self, enabled: bool) -> Button
pub fn is_enabled(self, enabled: bool) -> Button
XAML IsEnabled.
Sourcepub fn is_tab_stop(self, value: bool) -> Self
pub fn is_tab_stop(self, value: bool) -> Self
Sets the source IsTabStop property.
Sourcepub fn focus_node(self, node: FocusNodeRef) -> Self
pub fn focus_node(self, node: FocusNodeRef) -> Self
Uses a focus node whose lifetime is owned by the enclosing control.
Sourcepub fn template(
self,
builder: impl Fn(&mut App, BuildContext, ControlStates, WidgetRef) -> WidgetRef + 'static,
) -> Self
pub fn template( self, builder: impl Fn(&mut App, BuildContext, ControlStates, WidgetRef) -> WidgetRef + 'static, ) -> Self
Replaces presentation while retaining ButtonBase input and activation.
Trait Implementations§
Source§impl StatelessWidget for Button
impl StatelessWidget for Button
Source§fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
this is PreferredSizeWidget: a widget that implements PreferredSizeWidget
answers with itself, which is what a parent asking an erased child for its preferred
size reads.Auto Trait Implementations§
impl !RefUnwindSafe for Button
impl !Send for Button
impl !Sync for Button
impl !UnwindSafe for Button
impl Forget for Button
impl Freeze for Buttonwhere
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
*const RcInner<dyn Fn(&mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze,
NonZero<u32>: Freeze,
*const (): Freeze,
&'static FocusNodeVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, ControlStates, Rc<dyn Widget>) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, ControlStates, Rc<dyn Widget>) -> Rc<dyn Widget>>>: Freeze,
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
impl Move for Button
impl Unpin for Button
impl UnsafeUnpin for Buttonwhere
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
&'static FocusNodeVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, ControlStates, Rc<dyn Widget>) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, ControlStates, Rc<dyn Widget>) -> Rc<dyn Widget>>>: UnsafeUnpin,
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.