gtk.ToolItem — the base class of widgets
that can be added to gtk.Toolbar
(new in PyGTK 2.4)
class gtk.ToolItem(gtk.Bin): |
+--gobject.GObject +-- gtk.Object +-- gtk.Widget +-- gtk.Container +-- gtk.Bin +-- gtk.ToolItem
These properties are available in GTK+ 2.4 and above.
|
gtk.Container Signal Prototypes
def callback( | |
def callback( | |
def callback( |
This widget is available in PyGTK 2.4 and above.
A gtk.ToolItem
is a
widget that can appear on a gtk.Toolbar
. To
create a toolbar item that contains something else than a button, use the
gtk.ToolItem() constructor
then use the gtk.Container.add
()
method to add a child widget to the tool item.
To create and use toolbar items that contain buttons, see the
gtk.ToolButton
,
gtk.ToggleToolButton
and gtk.RadioToolButton
classes. See the gtk.Toolbar
class
for a description of the toolbar widget.
gtk.ToolItem()
Returns : | the new gtk.ToolItem |
This constructor is available in PyGTK 2.4 and above.
Creates a new empty gtk.ToolItem
def set_homogeneous(homogeneous
)
| if True the tool item is the
same size as other homogeneous items |
This method is available in PyGTK 2.4 and above.
The set_homogeneous
() method sets the
homogeneous setting of the tool item to the value of
homogeneous
. If homogeneous
is
True
the tool item 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.
def get_homogeneous()
Returns : | True if the item is the same
size as other homogeneous items. |
This method is available in PyGTK 2.4 and above.
The get_homogeneous
() method returns
the setting of the homogeneous setting of the tool item. If
True
the tool item is the same size as other homogeneous
items. See the set_homogeneous()
method for more detail.
def set_expand(expand
)
| If True the tool item is
allocated extra space when available |
This method is available in PyGTK 2.4 and above.
The set_expand
() method sets the expand
setting of the tool item to the value of expand
. If
expand
is True
the tool item is
allocated extra space when there is more room on the toolbar than needed for
the items. The effect is that the item gets bigger when the toolbar gets
bigger and smaller when the toolbar gets smaller.
def get_expand()
Returns : | True if the tool item is
allocated extra space when available. |
This method is available in PyGTK 2.4 and above.
The get_expand
() method returns the
value of the expand setting of the tool item. If True
the
tool item is allocated extra space. See the gtk.ToolItem.set_expand()
method for more detail.
def set_tooltip(tooltips
, tip_text
=None, tip_private
=None)
| The gtk.Tooltips
object to be used |
| the text to be used as tooltip text for the
tool item or None |
| the text to be used as private tooltip
text or None |
This method is available in PyGTK 2.4 and above.
The set_tooltip
() method sets the gtk.Tooltips
object specified by tooltips
to be used for the tool
item with the tooltip text specified by tip_text
and
the private text specified by tip_private
. See the
gtk.Tooltips.set_tip()
method for more information.
def set_use_drag_window(use_drag_window
)
| if True the tool item has a
drag window. |
This method is available in PyGTK 2.4 and above.
The set_use_drag_window
() method
determines whether the tool item has a drag window according to the value of
use_drag_window
. If
use_drag_window
is True
the
toolitem can be used as a drag source through the gtk.Widget.drag_source_set()
method. When the tool item has a drag window it will intercept all events,
even those that would otherwise be sent to a child of the tool item
def get_use_drag_window()
Returns : | True if the tool item uses a
drag window. |
This method is available in PyGTK 2.4 and above.
The get_use_drag_window
() returns the
setting that determines if the tool item has a drag window. See the set_use_drag_window()
for more information.
def set_visible_horizontal(visible_horizontal
)
| if True the tool item is
visible when in horizontal mode |
This method is available in PyGTK 2.4 and above.
The set_visible_horizontal
() method
sets the "visible-horizontal" property to the value of
visible_horizontal
. If
visible_horizontal
is True
, the
tool item is visible when the toolbar is docked horizontally.
def get_visible_horizontal()
Returns : | True if the tool item is
visible on toolbars that are docked
horizontally. |
This method is available in PyGTK 2.4 and above.
The get_visible_horizontal
() method
returns the value of the "visible-horizontal" property. If
"visible-horizontal" is True
, the tool item is visible on
toolbars that are docked horizontally.
def set_visible_vertical(visible_vertical
)
| if True , the tool item is
visible when the toolbar is in vertical mode |
This method is available in PyGTK 2.4 and above.
The set_visible_vertical
() method sets
the "visible-vertical" property to the value of
visible_vertical
. If
visible_vertical
is True
, the tool
item 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
the tool item will not appear on toolbars that are
docked vertically.
def get_visible_vertical()
Returns : | True if the tool item is visible when the toolbar is docked vertically |
This method is available in PyGTK 2.4 and above.
The get_visible_vertical
() method
returns the value of the "visible-vertical" property. If "visible-vertical"
is True
, the tool item is visible when the toolbar is
docked vertically. See the set_visible_vertical()
method for more information.
def set_is_important(is_important
)
| if True , the tool item
should be considered important |
This method is available in PyGTK 2.4 and above.
The set_is_important
() method sets the
"is-important" property to the value of
is_important
. If is_important
is True
the tool item should be considered important. The
gtk.ToolButton
class uses this property to determine whether to show its label when the
toolbar style is gtk.TOOLBAR_BOTH_HORIZ
. The result is
that only tool buttons with the "is_important" property set have labels, an
effect known as "priority text".
def get_is_important()
Returns : | True if the tool item is
considered important. |
This method is available in PyGTK 2.4 and above.
The get_is_important
() method returns
the value of the "is-important" property. If "is-important" is
True
, the tool item is considered important. See the
set_is_important()
method for more information.
def get_icon_size()
Returns : | the icon size used for the tool item |
This method is available in PyGTK 2.4 and above.
The get_icon_size
() method returns the
icon size used for the tool item. Custom subclasses of gtk.ToolItem
should call this method to find out what size icons they should use. The
return value should be one of: gtk.ICON_SIZE_MENU
,
gtk.ICON_SIZE_SMALL_TOOLBAR
,
gtk.ICON_SIZE_LARGE_TOOLBAR
,
gtk.ICON_SIZE_BUTTON
,
gtk.ICON_SIZE_DND
,
gtk.ICON_SIZE_DIALOG
or an integer value returned from
the gtk.icon_size_register
()
function.
def get_orientation()
Returns : | the orientation used for the tool item |
This method is available in PyGTK 2.4 and above.
The get_orientation
() method returns
the orientation used for the tool item. Custom subclasses of gtk.ToolItem
should call this method to find out what size icons they should use. The
return value should be either gtk.ORIENTATION_HORIZONTAL
or gtk.ORIENTATION_VERTICAL
.
def get_toolbar_style()
Returns : | the toolbar style used for the tool item |
This method is available in PyGTK 2.4 and above.
The get_toolbar_style
() method returns
the toolbar style used for the tool item. Custom subclasses of gtk.ToolItem
should call this method in the "toolbar-reconfigured"
signal handler to find out in what style the toolbar is displayed and change
themselves accordingly.
Possibilities are:
gtk.TOOLBAR_BOTH
, meaning the tool item
should show both an icon and a label, stacked vertically
gtk.TOOLBAR_ICONS
, meaning the toolbar
shows only icons
gtk.TOOLBAR_TEXT
, meaning the tool item
should only show text
gtk.TOOLBAR_BOTH_HORIZ
, meaning the tool
item should show both an icon and a label, arranged horizontally..
def get_relief_style()
Returns : | the relief style used for the tool item |
This method is available in PyGTK 2.4 and above.
The get_relief_style
() method returns
the relief style of the tool item. See the gtk.Button.set_relief
()
method for more information. Custom subclasses of gtk.ToolItem
should call this method in the handler of the gtk.ToolItem
"toolbar-reconfigured"
signal to find out the relief style of buttons.
The return value should be one of:
gtk.RELIEF_NORMAL
, gtk.RELIEF_HALF
or
gtk.RELIEF_NONE
.
def retrieve_proxy_menu_item()
Returns : | The gtk.MenuItem that is going to appear in the
overflow menu for the tool item |
This method is available in PyGTK 2.4 and above.
The retrieve_proxy_menu_item
() method
returns the gtk.MenuItem
that
was last set by the set_proxy_menu_item()
method, i.e. the gtk.MenuItem
that
is going to appear in the overflow menu.
def set_proxy_menu_item(menu_item_id
, menu_item
)
| a string used to identify
menu_item |
| a gtk.MenuItem
to be used in the overflow menu or
None |
This method is available in PyGTK 2.4 and above.
The set_proxy_menu_item
() method sets
the gtk.MenuItem
specified by menu_item
to be used in the toolbar
overflow menu. menu_item_id
is used to identify the
caller of this method and should also be used with the get_proxy_menu_item()
method. If menu_item
is None
the
tool item will not appear in the overflow menu.
def get_proxy_menu_item(menu_item_id
)
| a string used to identify the menu item |
Returns : | The gtk.MenuItem
matching menu_item_id . |
This method is available in PyGTK 2.4 and above.
The get_proxy_menu_item
() method
returns the gtk.MenuItem
corresponding to the string specified by menu_item_id
as passed to the set_proxy_menu_item()
method.
Custom subclasses of gtk.ToolItem
should use this method to update their menu item when the gtk.ToolItem
changes. Forcing a match with menu_item_id
ensures
that a gtk.ToolItem
will
not inadvertently change a menu item that they did not create.
def rebuild_menu()
This method is available in PyGTK 2.6 and above.
The rebuild_menu
() method ignals to the
toolbar that the overflow menu item has changed. If the overflow menu is
visible when this method it called, the menu will be rebuilt. The method
must be called when the tool item changes what it will do in response to the
"create_menu_proxy" signal.
def set_tooltip_markup(markup
)
| markup text to be used as tooltip. |
This method is available in PyGTK 2.12 and above.
The set_tooltip_markup
() method sets the
markup text to be displayed as tooltip on the item. See
gtk.Widget.set_tooltip_markup
().
def set_tooltip_text(text
)
| the text to be used as tooltip. |
This method is available in PyGTK 2.12 and above.
The set_tooltip_text
() method sets the
text to be displayed as tooltip on the item. See
gtk.Widget.set_tooltip_text
().
def toolbar_reconfigured()
This method is available in PyGTK 2.14 and above.
The toolbar_reconfigured
() method emits the signal
"toolbar-reconfigured"
on tool_item.
gtk.ToolBar
and other
gtk.ToolShell
implementations use this method to notify children, when some aspect of their configuration changes.
def get_ellipsize_mode()
Returns : | one of the Pango Ellipsize Mode Constants indicating how text should be ellipsized. |
This method is available in PyGTK 2.22 and above.
The get_ellipsize_mode
() method returns the ellipsize mode used
for the tool item. Custom subclasses of gtk.ToolItem
should call this method to find out how text should be ellipsized.
def get_text_alignment()
Returns : | the horizontal text alignment used for the tool item. |
This method is available in PyGTK 2.22 and above.
The get_text_alignment
() method returns the text alignment used
for the tool item. Custom subclasses of gtk.ToolItem
should call this method to find out how text should be aligned.
def get_text_orientation()
Returns : | the text orientation used for the tool item. |
This method is available in PyGTK 2.22 and above.
The get_text_orientation
() method returns the text orientation used
for the tool item. Custom subclasses of gtk.ToolItem
should call this method to find out how text should be orientated.
def get_text_size_group()
Returns : | a gtk.SizeGroup . |
This method is available in PyGTK 2.22 and above.
The get_text_size_group
() method returns the size group used for labels
in the tool item. Custom subclasses of gtk.ToolItem
should call this method and use the size group for labels.
def callback(toolitem
, user_param1
, ...
)
| the toolitem that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled |
This signal is available in GTK+ 2.4 and above.
The "create-menu-proxy" signal is emitted when the toolbar is
displaying an overflow menu and is trying to determine if
toolitem
should appear in the overflow menu. In
response toolitem
should either
call the set_proxy_menu_item
()
method specifying menu_item
as
None
and return True
to indicate that
the item should not appear in the overflow menu
call the set_proxy_menu_item
()
method with a new menu item and return True
, 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 the rebuild_menu
())
method to invalidate the cache and ensure that the toolbar rebuilds its
overflow menu.
def callback(toolitem
, tooltips
, tip_text
, tip_private
, user_param1
, ...
)
| the toolitem that received the signal |
| the gtk.Tooltips |
| the tooltip text |
| the tooltip private text |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled |
This signal is available in GTK+ 2.4 and above.
The "set-tooltip" signal is emitted when the tool item's tooltip
changes. Application developers can use the set_tooltip
()
method to set the item's tooltip.
def callback(toolitem
, user_param1
, ...
)
| the toolitem that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
This signal is available in GTK+ 2.4 and above.
The "toolbar-reconfigured" signal is emitted when some property
of the toolbar that the item is a child of changes. For custom subclasses of
gtk.ToolItem
, the
default handler of this signal uses the methods:
to find out what the toolbar should look like and change themselves accordingly.