org.gnome.gtk

## Class ButtonBox

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

- All Implemented Interfaces:
    Orientable
  Direct Known Subclasses:
    HButtonBox, VButtonBox

      public abstract class ButtonBox
      extends Box

  Provide a consistent layout of Buttons throughout your application. Use an `HButtonBox` to lay buttons out horizontally or a `VButtonBox` to lay buttons out vertically.

  Buttons are packed into a ButtonBox the same way widgets are added to any other Container, using `add()`. You can also use Box's `packStart()` or `packEnd()`, but for ButtonBoxes both these functions work just like `add()`, ie., they pack the button in a way that depends on the current layout style and on whether the button has had `setChildSecondary()` called for it.

  The layout/spacing can be altered in a programmatic way in order to alter the 'feel' of a program to a small degree, although in general overriding the defaults used by every other application on the desktop will impact the user's experience and so is not recommended. If you do need to make adjustments, the arrangement and layout of the Buttons can be changed with `setLayout()`.

  Since:
    4.0.4
  Author:
    Nat Pryce, 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`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `getChildSecondary(Widget child)` Returns whether child should appear in a secondary group of children.
    `ButtonBoxStyle` | `getLayout()` Returns the method currently being used to govern arrangement child Buttons in this ButtonBox.
    `void` | `setChildSecondary(Widget child, boolean isSecondary)` Sets whether `child` should appear in the "secondary" group of children.
    `void` | `setLayout(ButtonBoxStyle layout)` Change the way the child Buttons are arranged in this ButtonBox.

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

      `getOrientation, getSpacing, packEnd, packStart, reorderChild, setOrientation, setSpacing`

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

      `add, 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`

- - ### Method Detail

    - #### getChildSecondary

          public boolean getChildSecondary(Widget child)

      Returns whether child should appear in a secondary group of children.
      Parameters:
        `child` - a widget that is a child of this button box
      Returns:
        whether child should appear in a secondary group of children

    - #### getLayout

          public ButtonBoxStyle getLayout()

      Returns the method currently being used to govern arrangement child Buttons in this ButtonBox.

    - #### setChildSecondary

          public void setChildSecondary(Widget child,
                               boolean isSecondary)

      Sets whether `child` should appear in the "secondary" group of children. A typical use of the secondary child mechanism is to place the 'Help' Button in a Dialog; placing it on the far left side while the 'Ok' and 'Cancel' Buttons are on the far right.

      The secondary group appears after the other children if the ButtonBoxStyle is `START`, `SPREAD`, or `EDGE`, and before the other children if the it is `END`. For horizontal ButtonBoxes, the definition of before/after depends on direction in place (see `setDirection()` on Widget). If the style is `START` or `END`, then the secondary children are aligned at the other end of the ButtonBox from the main children. For the other styles, they appear immediately next to the main children.

      Parameters:
        `child` - a Widget that is a child of this ButtonBox
        `isSecondary` - if `true`, the child appears in a secondary group of the ButtonBox

    - #### setLayout

          public void setLayout(ButtonBoxStyle layout)

      Change the way the child Buttons are arranged in this ButtonBox. See `ButtonBoxStyle` for the list of possible constants; and see also `setChildSecondary()` for discussion of the impact of these different possibilities.