Trait gtk4::prelude::ButtonExt [−][src]
pub trait ButtonExt: 'static {
Show 19 methods
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_child<P: IsA<Widget>>(&self, child: Option<&P>);
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_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
Required methods
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()
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.
fn 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.
fn set_has_frame(&self, has_frame: bool)
fn set_has_frame(&self, has_frame: bool)
Sets the style of the button.
Buttons can has a flat appearance or have a frame drawn around them.
has_frame
whether the button should have a visible frame
fn set_icon_name(&self, icon_name: &str)
fn set_icon_name(&self, icon_name: &str)
Sets the text of the label of the button to label
.
This will also clear any previously set labels.
label
a string
fn set_use_underline(&self, use_underline: bool)
fn set_use_underline(&self, use_underline: bool)
Sets whether to use underlines as mnemonics.
If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.
use_underline
true
if underlines in the text indicate mnemonics
fn 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 signal::Button::clicked
signal.
fn emit_activate(&self)
fn 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).