pub trait ButtonExt:
IsA<Button>
+ Sealed
+ 'static {
Show 22 methods
// Provided methods
fn can_shrink(&self) -> bool { ... }
fn child(&self) -> Option<Widget> { ... }
fn has_frame(&self) -> bool { ... }
fn icon_name(&self) -> Option<GString> { ... }
fn label(&self) -> Option<GString> { ... }
fn uses_underline(&self) -> bool { ... }
fn set_can_shrink(&self, can_shrink: bool) { ... }
fn set_child(&self, child: Option<&impl IsA<Widget>>) { ... }
fn set_has_frame(&self, has_frame: bool) { ... }
fn set_icon_name(&self, icon_name: &str) { ... }
fn set_label(&self, label: &str) { ... }
fn set_use_underline(&self, use_underline: bool) { ... }
fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn emit_activate(&self) { ... }
fn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn emit_clicked(&self) { ... }
fn connect_can_shrink_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_child_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_has_frame_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_icon_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_label_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_use_underline_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
Sourcefn can_shrink(&self) -> bool
Available on crate feature v4_12
only.
fn can_shrink(&self) -> bool
v4_12
only.Retrieves whether the button can be smaller than the natural size of its contents.
§Returns
true if the button can shrink, and false otherwise
Sourcefn icon_name(&self) -> Option<GString>
fn icon_name(&self) -> Option<GString>
Returns the icon name of the button.
If the icon name has not been set with set_icon_name()
the return value will be None
. This will be the case if you create
an empty button with Button::new()
to use as a container.
§Returns
The icon name set via set_icon_name()
Sourcefn label(&self) -> Option<GString>
fn label(&self) -> Option<GString>
Fetches the text from the label of the button.
If the label text has not been set with set_label()
the return value will be None
. This will be the case if you create
an empty button with Button::new()
to use as a container.
§Returns
The text of the label widget. This string is owned by the widget and must not be modified or freed.
Sourcefn uses_underline(&self) -> bool
fn uses_underline(&self) -> bool
gets whether underlines are interpreted as mnemonics.
See set_use_underline()
.
§Returns
true
if an embedded underline in the button label
indicates the mnemonic accelerator keys.
Sourcefn set_can_shrink(&self, can_shrink: bool)
Available on crate feature v4_12
only.
fn set_can_shrink(&self, can_shrink: bool)
v4_12
only.Sets whether the button size can be smaller than the natural size of its contents.
For text buttons, setting @can_shrink to true will ellipsize the label.
For icons and custom children, this function has no effect.
§can_shrink
whether the button can shrink
Sourcefn set_child(&self, child: Option<&impl IsA<Widget>>)
fn set_child(&self, child: Option<&impl IsA<Widget>>)
Sets the child widget of @self.
Note that by using this API, you take full responsibility for setting up the proper accessibility label and description information for @self. Most likely, you’ll either set the accessibility label or description for @self explicitly, or you’ll set a labelled-by or described-by relations from @child to @self.
§child
the child widget
Sourcefn set_has_frame(&self, has_frame: bool)
fn set_has_frame(&self, has_frame: bool)
Sets the style of the button.
Buttons can have a flat appearance or have a frame drawn around them.
§has_frame
whether the button should have a visible frame
Sourcefn set_icon_name(&self, icon_name: &str)
fn set_icon_name(&self, icon_name: &str)
Sourcefn set_label(&self, label: &str)
fn set_label(&self, label: &str)
Sets the text of the label of the button to @label.
This will also clear any previously set labels.
§label
a string
Sourcefn set_use_underline(&self, use_underline: bool)
fn set_use_underline(&self, use_underline: bool)
Sourcefn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted to animate press then release.
This is an action signal. Applications should never connect
to this signal, but use the clicked
signal.
The default bindings for this signal are all forms of the ␣ and Enter keys.
fn emit_activate(&self)
Sourcefn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the button has been activated (pressed and released).
fn emit_clicked(&self)
fn connect_can_shrink_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
v4_12
only.fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_has_frame_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_icon_name_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_use_underline_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.