Trait gtk::prelude::ToolItemExt
source · [−]pub trait ToolItemExt: 'static {
Show 30 methods
fn ellipsize_mode(&self) -> EllipsizeMode;
fn expands(&self) -> bool;
fn is_homogeneous(&self) -> bool;
fn icon_size(&self) -> IconSize;
fn is_important(&self) -> bool;
fn orientation(&self) -> Orientation;
fn proxy_menu_item(&self, menu_item_id: &str) -> Option<Widget>;
fn relief_style(&self) -> ReliefStyle;
fn text_alignment(&self) -> f32;
fn text_orientation(&self) -> Orientation;
fn text_size_group(&self) -> Option<SizeGroup>;
fn toolbar_style(&self) -> ToolbarStyle;
fn uses_drag_window(&self) -> bool;
fn is_visible_horizontal(&self) -> bool;
fn is_visible_vertical(&self) -> bool;
fn rebuild_menu(&self);
fn retrieve_proxy_menu_item(&self) -> Option<Widget>;
fn set_expand(&self, expand: bool);
fn set_homogeneous(&self, homogeneous: bool);
fn set_is_important(&self, is_important: bool);
fn set_proxy_menu_item(
&self,
menu_item_id: &str,
menu_item: Option<&impl IsA<Widget>>
);
fn set_use_drag_window(&self, use_drag_window: bool);
fn set_visible_horizontal(&self, visible_horizontal: bool);
fn set_visible_vertical(&self, visible_vertical: bool);
fn toolbar_reconfigured(&self);
fn connect_create_menu_proxy<F: Fn(&Self) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_is_important_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_visible_horizontal_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_visible_vertical_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
fn ellipsize_mode(&self) -> EllipsizeMode
fn ellipsize_mode(&self) -> EllipsizeMode
Returns the ellipsize mode used for self
. Custom subclasses of
ToolItem
should call this function to find out how text should
be ellipsized.
Returns
a pango::EllipsizeMode
indicating how text in self
should be ellipsized.
Returns whether self
is allocated extra space.
See set_expand()
.
Returns
true
if self
is allocated extra space.
fn is_homogeneous(&self) -> bool
fn is_homogeneous(&self) -> bool
Returns whether self
is the same size as other homogeneous
items. See set_homogeneous()
.
Returns
true
if the item is the same size as other homogeneous
items.
fn is_important(&self) -> bool
fn is_important(&self) -> bool
Returns whether self
is considered important. See
set_is_important()
Returns
true
if self
is considered important.
fn orientation(&self) -> Orientation
fn orientation(&self) -> Orientation
Returns the orientation used for self
. Custom subclasses of
ToolItem
should call this function to find out what size icons
they should use.
Returns
a Orientation
indicating the orientation
used for self
If menu_item_id
matches the string passed to
set_proxy_menu_item()
return the corresponding MenuItem
.
Custom subclasses of ToolItem
should use this function to
update their menu item when the ToolItem
changes. That the
menu_item_ids
must match ensures that a ToolItem
will not inadvertently change a menu item that they did not create.
menu_item_id
a string used to identify the menu item
Returns
The MenuItem
passed to
set_proxy_menu_item()
, if the menu_item_ids
match.
fn relief_style(&self) -> ReliefStyle
fn relief_style(&self) -> ReliefStyle
Returns the relief style of self
. See ButtonExt::set_relief()
.
Custom subclasses of ToolItem
should call this function in the handler
of the signal::ToolItem::toolbar_reconfigured
signal to find out the
relief style of buttons.
Returns
a ReliefStyle
indicating the relief style used
for self
.
fn text_alignment(&self) -> f32
fn text_alignment(&self) -> f32
fn text_orientation(&self) -> Orientation
fn text_orientation(&self) -> Orientation
Returns the text orientation used for self
. Custom subclasses of
ToolItem
should call this function to find out how text should
be orientated.
Returns
a Orientation
indicating the text orientation
used for self
fn text_size_group(&self) -> Option<SizeGroup>
fn text_size_group(&self) -> Option<SizeGroup>
fn toolbar_style(&self) -> ToolbarStyle
fn toolbar_style(&self) -> ToolbarStyle
Returns the toolbar style used for self
. Custom subclasses of
ToolItem
should call this function in the handler of the
GtkToolItem::toolbar_reconfigured signal to find out in what style
the toolbar is displayed and change themselves accordingly
Possibilities are:
ToolbarStyle::Both
, meaning the tool item should show both an icon and a label, stacked verticallyToolbarStyle::Icons
, meaning the toolbar shows only iconsToolbarStyle::Text
, meaning the tool item should only show textToolbarStyle::BothHoriz
, meaning the tool item should show both an icon and a label, arranged horizontally
Returns
A ToolbarStyle
indicating the toolbar style used
for self
.
fn uses_drag_window(&self) -> bool
fn uses_drag_window(&self) -> bool
Returns whether self
has a drag window. See
set_use_drag_window()
.
Returns
true
if self
uses a drag window.
fn is_visible_horizontal(&self) -> bool
fn is_visible_horizontal(&self) -> bool
fn is_visible_vertical(&self) -> bool
fn is_visible_vertical(&self) -> bool
Returns whether self
is visible when the toolbar is docked vertically.
See set_visible_vertical()
.
Returns
Whether self
is visible when the toolbar is docked vertically
Calling this function signals to the toolbar that the
overflow menu item for self
has changed. If the
overflow menu is visible when this function it called,
the menu will be rebuilt.
The function must be called when the tool item changes what it
will do in response to the signal::ToolItem::create-menu-proxy
signal.
Returns the MenuItem
that was last set by
set_proxy_menu_item()
, ie. the MenuItem
that is going to appear in the overflow menu.
Returns
The MenuItem
that is going to appear in the
overflow menu for self
.
fn set_expand(&self, expand: bool)
fn set_expand(&self, expand: bool)
Sets whether self
is allocated extra space when there
is more room on the toolbar then needed for the items. The
effect is that the item gets bigger when the toolbar gets bigger
and smaller when the toolbar gets smaller.
expand
Whether self
is allocated extra space
fn set_homogeneous(&self, homogeneous: bool)
fn set_homogeneous(&self, homogeneous: bool)
Sets whether self
is to be allocated the same size as other
homogeneous items. The effect is that all homogeneous items will have
the same width as the widest of the items.
homogeneous
whether self
is the same size as other homogeneous items
fn set_is_important(&self, is_important: bool)
fn set_is_important(&self, is_important: bool)
Sets whether self
should be considered important. The ToolButton
class uses this property to determine whether to show or hide its label
when the toolbar style is ToolbarStyle::BothHoriz
. The result is that
only tool buttons with the “is_important” property set have labels, an
effect known as “priority text”
is_important
whether the tool item should be considered important
Sets the MenuItem
used in the toolbar overflow menu. The
menu_item_id
is used to identify the caller of this function and
should also be used with proxy_menu_item()
.
See also signal::ToolItem::create-menu-proxy
.
menu_item_id
a string used to identify menu_item
menu_item
fn set_use_drag_window(&self, use_drag_window: bool)
fn set_use_drag_window(&self, use_drag_window: bool)
Sets whether self
has a drag window. When true
the
toolitem can be used as a drag source through WidgetExtManual::drag_source_set()
.
When self
has a drag window it will intercept all events,
even those that would otherwise be sent to a child of self
.
use_drag_window
Whether self
has a drag window.
fn set_visible_horizontal(&self, visible_horizontal: bool)
fn set_visible_horizontal(&self, visible_horizontal: bool)
Sets whether self
is visible when the toolbar is docked horizontally.
visible_horizontal
Whether self
is visible when in horizontal mode
fn set_visible_vertical(&self, visible_vertical: bool)
fn set_visible_vertical(&self, visible_vertical: bool)
Sets whether self
is visible when the toolbar is docked
vertically. Some tool items, such as text entries, are too wide to be
useful on a vertically docked toolbar. If visible_vertical
is false
self
will not appear on toolbars that are docked vertically.
visible_vertical
whether self
is visible when the toolbar
is in vertical mode
fn toolbar_reconfigured(&self)
fn toolbar_reconfigured(&self)
This signal is emitted when the toolbar needs information from tool_item
about whether the item should appear in the toolbar overflow menu. In
response the tool item should either
-
call
set_proxy_menu_item()
with aNone
pointer and returntrue
to indicate that the item should not appear in the overflow menu -
call
set_proxy_menu_item()
with a new menu item and returntrue
, or -
return
false
to indicate that the signal was not handled by the item. This means that the item will not appear in the overflow menu unless a later handler installs a menu item.
The toolbar may cache the result of this signal. When the tool item changes
how it will respond to this signal it must call rebuild_menu()
to invalidate the cache and ensure that the toolbar rebuilds its overflow
menu.
Returns
fn connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
This signal is emitted when some property of the toolbar that the
item is a child of changes. For custom subclasses of ToolItem
,
the default handler of this signal use the functions
ToolShellExt::orientation()
ToolShellExt::style()
ToolShellExt::icon_size()
ToolShellExt::relief_style()
to find out what the toolbar should look like and change themselves accordingly.