pub trait ButtonExt:
IsA<Button>
+ Sealed
+ 'static {
Show 24 methods
// Provided methods
fn clicked(&self) { ... }
fn must_always_show_image(&self) -> bool { ... }
fn event_window(&self) -> Option<Window> { ... }
fn image(&self) -> Option<Widget> { ... }
fn image_position(&self) -> PositionType { ... }
fn label(&self) -> Option<GString> { ... }
fn relief(&self) -> ReliefStyle { ... }
fn uses_underline(&self) -> bool { ... }
fn set_always_show_image(&self, always_show: bool) { ... }
fn set_image(&self, image: Option<&impl IsA<Widget>>) { ... }
fn set_image_position(&self, position: PositionType) { ... }
fn set_label(&self, label: &str) { ... }
fn set_relief(&self, relief: ReliefStyle) { ... }
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_always_show_image_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_image_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_image_position_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_label_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_relief_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_use_underline_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}Expand description
Trait containing all Button methods.
§Implementors
Button, ColorButton, FontButton, LinkButton, LockButton, ModelButton, ScaleButton, ToggleButton
Provided Methods§
Sourcefn must_always_show_image(&self) -> bool
fn must_always_show_image(&self) -> bool
Returns whether the button will ignore the gtk-button-images
setting and always show the image, if available.
§Returns
true if the button will always show the image
Sourcefn event_window(&self) -> Option<Window>
fn event_window(&self) -> Option<Window>
Sourcefn image(&self) -> Option<Widget>
fn image(&self) -> Option<Widget>
Gets the widget that is currenty set as the image of self.
This may have been explicitly set by set_image()
or constructed by gtk_button_new_from_stock().
§Returns
Sourcefn image_position(&self) -> PositionType
fn image_position(&self) -> PositionType
Sourcefn label(&self) -> Option<GString>
fn label(&self) -> Option<GString>
Fetches the text from the label of the button, as set by
set_label(). If the label text has not
been set 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 relief(&self) -> ReliefStyle
fn relief(&self) -> ReliefStyle
Sourcefn uses_underline(&self) -> bool
fn uses_underline(&self) -> bool
Sourcefn set_always_show_image(&self, always_show: bool)
fn set_always_show_image(&self, always_show: bool)
If true, the button will ignore the gtk-button-images
setting and always show the image, if available.
Use this property if the button would be useless or hard to use without the image.
§always_show
true if the menuitem should always show the image
Sourcefn set_image(&self, image: Option<&impl IsA<Widget>>)
fn set_image(&self, image: Option<&impl IsA<Widget>>)
Set the image of self to the given widget. The image will be
displayed if the label text is None or if
always-show-image is true. You don’t have to call
WidgetExt::show() on image yourself.
§image
a widget to set as the image for the button, or None to unset
Sourcefn set_image_position(&self, position: PositionType)
fn set_image_position(&self, position: PositionType)
Sourcefn set_label(&self, label: &str)
fn set_label(&self, label: &str)
Sets the text of the label of the button to str. This text is
also used to select the stock item if gtk_button_set_use_stock()
is used.
This will also clear any previously set labels.
§label
a string
Sourcefn set_relief(&self, relief: ReliefStyle)
fn set_relief(&self, relief: ReliefStyle)
Sets the relief style of the edges of the given Button widget.
Two styles exist, ReliefStyle::Normal and ReliefStyle::None.
The default style is, as one can guess, ReliefStyle::Normal.
The deprecated value ReliefStyle::Half behaves the same as
ReliefStyle::Normal.
§relief
The GtkReliefStyle as described above
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
The ::activate signal on GtkButton is an action signal and
emitting it causes the button to animate press then release.
Applications should never connect to this signal, but use the
clicked signal.
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_always_show_image_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_image_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_image_position_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_relief_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".