Trait gtk::prelude::ToolButtonExt
source · [−]pub trait ToolButtonExt: 'static {
Show 17 methods
fn icon_name(&self) -> Option<GString>;
fn icon_widget(&self) -> Option<Widget>;
fn label(&self) -> Option<GString>;
fn label_widget(&self) -> Option<Widget>;
fn uses_underline(&self) -> bool;
fn set_icon_name(&self, icon_name: Option<&str>);
fn set_icon_widget(&self, icon_widget: Option<&impl IsA<Widget>>);
fn set_label(&self, label: Option<&str>);
fn set_label_widget(&self, label_widget: Option<&impl IsA<Widget>>);
fn set_use_underline(&self, use_underline: bool);
fn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn emit_clicked(&self);
fn connect_icon_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_icon_widget_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_label_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_label_widget_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 name of the themed icon for the tool button,
see set_icon_name()
.
Returns
the icon name or None
if the tool button has
no themed icon
fn icon_widget(&self) -> Option<Widget>
fn icon_widget(&self) -> Option<Widget>
Return the widget used as icon widget on self
.
See set_icon_widget()
.
Returns
The widget used as icon
on self
, or None
.
fn label_widget(&self) -> Option<Widget>
fn label_widget(&self) -> Option<Widget>
Returns the widget used as label on self
.
See set_label_widget()
.
Returns
The widget used as label
on self
, or None
.
fn uses_underline(&self) -> bool
fn uses_underline(&self) -> bool
Returns whether underscores in the label property are used as mnemonics
on menu items on the overflow menu. See set_use_underline()
.
Returns
true
if underscores in the label property are used as
mnemonics on menu items on the overflow menu.
fn set_icon_name(&self, icon_name: Option<&str>)
fn set_icon_name(&self, icon_name: Option<&str>)
Sets the icon for the tool button from a named themed icon.
See the docs for IconTheme
for more details.
The property::ToolButton::icon-name
property only has an effect if not
overridden by non-None
property::ToolButton::label-widget
,
property::ToolButton::icon-widget
and property::ToolButton::stock-id
properties.
icon_name
the name of the themed icon
fn set_icon_widget(&self, icon_widget: Option<&impl IsA<Widget>>)
fn set_icon_widget(&self, icon_widget: Option<&impl IsA<Widget>>)
Sets icon
as the widget used as icon on self
. If icon_widget
is
None
the icon is determined by the property::ToolButton::stock-id
property. If the
property::ToolButton::stock-id
property is also None
, self
will not have an icon.
icon_widget
the widget used as icon, or None
Sets label
as the label used for the tool button. The property::ToolButton::label
property only has an effect if not overridden by a non-None
property::ToolButton::label-widget
property. If both the property::ToolButton::label-widget
and property::ToolButton::label
properties are None
, the label is determined by the
property::ToolButton::stock-id
property. If the property::ToolButton::stock-id
property is
also None
, self
will not have a label.
label
a string that will be used as label, or None
.
fn set_label_widget(&self, label_widget: Option<&impl IsA<Widget>>)
fn set_label_widget(&self, label_widget: Option<&impl IsA<Widget>>)
Sets label_widget
as the widget that will be used as the label
for self
. If label_widget
is None
the property::ToolButton::label
property is used
as label. If property::ToolButton::label
is also None
, the label in the stock item
determined by the property::ToolButton::stock-id
property is used as label. If
property::ToolButton::stock-id
is also None
, self
does not have a label.
label_widget
the widget used as label, or None
fn set_use_underline(&self, use_underline: bool)
fn set_use_underline(&self, use_underline: bool)
If set, an underline in the label property indicates that the next character
should be used for the mnemonic accelerator key in the overflow menu. For
example, if the label property is “_Open” and use_underline
is true
,
the label on the tool button will be “Open” and the item on the overflow
menu will have an underlined “O”.
Labels shown on tool buttons never have mnemonics on them; this property only affects the menu item on the overflow menu.
use_underline
whether the button label has the form “_Open”
fn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
This signal is emitted when the tool button is clicked with the mouse or activated with the keyboard.