|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
xmlns:its="http://www.w3.org/2005/11/its"
|
|
Packit |
1470ea |
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
Packit |
1470ea |
type="guide" style="task"
|
|
Packit |
1470ea |
id="toolbar.py">
|
|
Packit |
1470ea |
<info>
|
|
Packit |
1470ea |
<title type="text">Toolbar (Python)</title>
|
|
Packit |
1470ea |
<link type="guide" xref="beginner.py#menu-combo-toolbar"/>
|
|
Packit |
1470ea |
<link type="seealso" xref="grid.py"/>
|
|
Packit |
1470ea |
<link type="next" xref="tooltip.py"/>
|
|
Packit |
1470ea |
<revision version="0.1" date="2012-06-05" status="draft"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Marta Maria Casetti</name>
|
|
Packit |
1470ea |
<email its:translate="no">mmcasetti@gmail.com</email>
|
|
Packit |
1470ea |
<years>2012</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<desc>A bar of buttons and other widgets</desc>
|
|
Packit |
1470ea |
</info>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<title>Toolbar</title>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<media type="image" mime="image/png" src="media/toolbar.png"/>
|
|
Packit |
1470ea |
An example of toolbar with buttons (from stock icons).
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<links type="section" />
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<section id="code">
|
|
Packit |
1470ea |
<title>Code used to generate this example</title>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<xi:include href="samples/toolbar.py" parse="text"><xi:fallback/></xi:include>
|
|
Packit |
1470ea |
</section>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<section id="methods">
|
|
Packit |
1470ea |
<title>Useful methods for a Toolbar widget</title>
|
|
Packit |
1470ea |
In line 32 the signal "activate" from the action undo_action is connected to the callback function undo_callback() using action.connect(signal, callback function) . See <link xref="signals-callbacks.py"/> for a more detailed explanation.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<list>
|
|
Packit |
1470ea |
<item>Use insert(tool_item, position) to insert the tool_item at position . If position is negative, the item is appended at the end of the toolbar. </item>
|
|
Packit |
1470ea |
<item>get_item_index(tool_item) retrieves the position of tool_item on the toolbar. </item>
|
|
Packit |
1470ea |
<item>get_n_items() returns the number of items on the toolbar; get_nth_item(position) returns the item in position position . </item>
|
|
Packit |
1470ea |
<item>If the toolbar does not have room for all the menu items, and set_show_arrow(True) , the items that do not have room are shown through an overflow menu. </item>
|
|
Packit |
1470ea |
<item>set_icon_size(icon_size) sets the size of icons in the toolbar; icon_size can be one of Gtk.IconSize.INVALID, Gtk.IconSize.MENU, Gtk.IconSize.SMALL_TOOLBAR, Gtk.IconSize.LARGE_TOOLBAR, Gtk.IconSize.BUTTON, Gtk.IconSize.DND, Gtk.IconSize.DIALOG . This should be used only for special-purpose toolbars, normal application toolbars should respect user preferences for the size of icons. unset_icon_size() unsets the preferences set with set_icon_size(icon_size) , so that user preferences are used to determine the icon size. </item>
|
|
Packit |
1470ea |
<item>set_style(style) , where style is one of Gtk.ToolbarStyle.ICONS, Gtk.ToolbarStyle.TEXT, Gtk.ToolbarStyle.BOTH, Gtk.ToolbarStyle.BOTH_HORIZ , sets if the toolbar shows only icons, only text, or both (vertically stacked or alongside each other). To let user preferences determine the toolbar style, and unset a toolbar style so set, use unset_style() . </item>
|
|
Packit |
1470ea |
</list>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
</section>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<section id="reference">
|
|
Packit |
1470ea |
<title>API References</title>
|
|
Packit |
1470ea |
In this sample we used the following:
|
|
Packit |
1470ea |
<list>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gtk3/unstable/GtkToolbar.html">GtkToolbar</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gtk3/unstable/GtkToolButton.html">GtkToolButton</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gtk3/unstable/GtkToolItem.html">GtkToolItem</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gtk3/unstable/gtk3-Stock-Items.html">Stock Items</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gtk3/unstable/GtkActionable.html">GtkActionable</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gtk3/unstable/GtkWidget.html">GtkWidget</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gdk3/unstable/gdk3-Event-Structures.html#GdkEventWindowState">Event Structures</link> </item>
|
|
Packit |
1470ea |
</list>
|
|
Packit |
1470ea |
</section>
|
|
Packit |
1470ea |
</page>
|