org.gnome.gtk

## Class Toolbar

- Object
- - org.freedesktop.bindings.Pointer
  - - org.freedesktop.bindings.Proxy
    - - org.gnome.glib.Object
      - - org.gnome.gtk.Widget
        - - org.gnome.gtk.Container
          - - org.gnome.gtk.Toolbar

- All Implemented Interfaces:
    Orientable

      public class Toolbar
      extends Container
      implements Orientable

  A Toolbar is a broad horizontal bar with several controls (usually largish graphical buttons) intended to provide a fast and convenient access to operations commonly used in an application.

  In most cases, you will want to add some `ToolButton`s to the Toolbar, but you can also add other elements as well by creating a `ToolItem` and adding your own customized elements to it.

  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 cluttered appearance.

  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 `>` Menus & Toolbars which runs the `gnome-ui-properties` program.

  Since:
    4.0.4
  Author:
    Vreixo Formoso, Andrew Cowie

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.gnome.gtk.Widget

      `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.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Toolbar()` Create a new, empty, Toolbar.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Widget w)` Add a child Widget to this Container.
    `Orientation` | `getOrientation()` Get the orientation of this Orientable.
    `void` | `insert(ToolItem item, int pos)` Insert a ToolItem in the Toolbar at a given position.
    `void` | `setOrientation(Orientation orientation)` Sets the orientation of the Toolbar on screen.
    `void` | `setStyle(ToolbarStyle style)` Set the appearance of a Toolbar.

    - ### Methods inherited from class org.gnome.gtk.Container

      `getChildren, remove, setBorderWidth`

    - ### Methods inherited from class org.gnome.gtk.Widget

      `activate, addEvents, 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`

    - ### Methods inherited from class org.freedesktop.bindings.Pointer

      `toString`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Toolbar

          public Toolbar()

      Create a new, empty, Toolbar.

  - ### Method Detail

    - #### add

          public void add(Widget w)

      Description copied from class: `Container`
      Add a child Widget to this Container. This works for all the various Container types, of course, but most offer more specialized packing methods that allow you to control the positioning of the Widget being added with greater finesse.
      Overrides:
        `add` in class `Container`

    - #### getOrientation

          public Orientation getOrientation()

      Description copied from interface: `Orientable`
      Get the orientation of this Orientable.
      Specified by:
        `getOrientation` in interface `Orientable`

    - #### insert

          public void insert(ToolItem item,
                    int pos)

      Insert a ToolItem in the Toolbar at a given position.
      Parameters:
        `item` - The new item to add to the Toolbar.
        `pos` - The position where the new item will be inserted. You can use `0` to prepend the item at the beginning of the Toolbar, or a negative value to append the item at the end.

    - #### setOrientation

          public void setOrientation(Orientation orientation)

      Sets the orientation of the Toolbar on screen.

      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.

      Specified by:
        `setOrientation` in interface `Orientable`
      Since:
        4.1.1

    - #### setStyle

          public void setStyle(ToolbarStyle style)

      Set the appearance of a Toolbar.

      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 `ICONS` only 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.

      Since:
        4.0.12