public class Toolbar extends Container implements Orientable
You can also group related items together by using a
SeparatorToolItem to the Toolbar to create a separation between
them. Don't overdo that, however - too many separators result in a
Note that the actual on screen appearance of the Toolbar is governed by the
user's theme and how they have configured Toolbars to appear. The choices
of "Text below Icons" (the usual default), "Text beside
Icons", "Icons only", and "Text only" are
available from the GNOME panel menu at System
& Toolbars which runs the
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
|Constructor and Description|
Create a new, empty, Toolbar.
|Modifier and Type||Method and Description|
Add a child Widget to this Container.
Get the orientation of this Orientable.
Insert a ToolItem in the Toolbar at a given position.
Sets the orientation of the Toolbar on screen.
Set the appearance of a Toolbar.
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
public void add(Widget w)
public Orientation getOrientation()
public void insert(ToolItem item, int pos)
item- The new item to add to the Toolbar.
pos- The position where the new item will be inserted. You can use
0to prepend the item at the beginning of the Toolbar, or a negative value to append the item at the end.
public void setOrientation(Orientation orientation)
Horizontal Toolbars are commonly used. Usually you shouldn't use a vertical Toolbar it is more difficult to search for the user to find a specific control. When your application has several Toolbars, however, a vertical orientation can become useful as a technique to make a better usage of the available screen real estate.
public void setStyle(ToolbarStyle style)
Toolbars buttons can be customized to display either an icon, a text label, or both. As explained above, in the documentation for this class, the appearance of Toolbars is configured by the user as a desktop setting. This method will override those settings, so in most cases you should not use this method, and just let the user choose the appearance (s)he prefers.
However, some really complex applications might need several Toolbars and many buttons on each one, so configuring a compact Toolbar style can help to save screen space. In such cases this method may be useful, but the general advice is to use this with care, and avoid overriding of user settings unless you have a strong reason.
Finally, note that if you choose for example an
appearance, and a given ToolButton has no icon, its Label will be shown
instead, so GTK engine will do its best to keep Toolbar usable.