/* Copyright (C) 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/container_p.h)

#include <gtkmm/container.h>
#include <gtkmm/orientable.h>
#include <gtk/gtk.h>  /* For _GtkBoxChild */


namespace Gtk
{

/** Packing options for adding child widgets to a Box with pack_start() and pack_end().
 * @ingroup gtkmmEnums
 */
enum PackOptions
{
  PACK_SHRINK, /**< Space is contracted to the child widget size. */
  PACK_EXPAND_PADDING, /**< Space is expanded, with extra space filled with padding. */
  PACK_EXPAND_WIDGET /**< Space is expanded, with extra space filled by increasing the child widget size. */
};

/** The Box widget organizes child widgets into a rectangular area.
 *
 * The rectangular area of a Box is organized into either a single row
 * or a single column of child widgets depending upon the orientation.
 * Thus, all children of a Box are allocated one dimension in common,
 * which is the height of a row, or the width of a column.
 *
 * Gtk::Box uses a notion of packing. Packing refers to adding widgets with
 * reference to a particular position in a Gtk::Container. There are two
 * reference positions: the start and the end of the box. For a vertical Box, the start
 * is defined as the top of the box and the end is defined as the bottom.  For
 * a horizontal Box the start is defined as the left side and the end is defined as the
 * right side.  Use repeated calls to pack_start() to pack widgets into a
 * Gtk::Box from start to end. Use pack_end() to add widgets from end to start.
 * You may intersperse these calls and add widgets from both ends of the same
 * Gtk::Box. The last widget added with pack_start() will be placed just before
 * the last widget added with pack_end()
 *
 * Because Gtk::Box is a Gtk::Container, you may also use Gtk::Container::add()
 * to insert widgets, and they will be packed as if with pack_start(). Use
 * Gtk::Container::remove() to remove widgets.
 *
 * Use set_homogeneous() to specify whether or not all children of the Gtk::Box
 * occupy the same amount of space.
 *
 * Use set_spacing() to determine the minimum
 * space placed between all children in the Gtk::Box.  Note that
 * spacing is added between the children, while
 * padding added by gtk_box_pack_start() or gtk_box_pack_end() is added
 * on either side of the widget it belongs to.
 *
 * Use reorder_child() to
 * move a child widget to a different place in the box.
 *
 * Use
 * set_child_packing() to reset the pack options and padding attributes of any
 * Gtk::Box child. Use query_child_packing() to query these fields.
 */
class Box
  : public Container,
    public Orientable
{
  _CLASS_GTKOBJECT(Box,GtkBox,GTK_BOX,Gtk::Container,GtkContainer)
  _IMPLEMENTS_INTERFACE(Orientable)
  _IGNORE(gtk_box_set_child_packing, gtk_box_query_child_packing)
public:

  //Note that we try to use the same defaul parameter value as the default property value.
  /** Creates a new horizontal box.
   * @param orientation The box's orientation.
   * @param spacing Determines the space in pixels between child widgets.
   */
  _WRAP_CTOR(Box(Orientation orientation = ORIENTATION_HORIZONTAL, int spacing = 0), gtk_box_new)

  _WRAP_METHOD(void pack_start(Widget& child, bool expand, bool fill), gtk_box_pack_start)

  /** Left side insert a widget to a box.
   * @param child A Widget to be added to box.
   * @param options Controls how the widget expands to fill space, and how the space around them is used.
   */
  void pack_start(Widget& child, PackOptions options = PACK_EXPAND_WIDGET);

  _WRAP_METHOD(void pack_end(Widget& child, bool expand, bool fill), gtk_box_pack_end)

  /** Right side insert a widget to a box.
   * @param child A Widget to be added to box.
   * @param options Controls how the widget expands to fill space, and how the space around them is used.
   */
  void pack_end(Widget& child, PackOptions options = PACK_EXPAND_WIDGET);

  _WRAP_METHOD(void set_homogeneous(bool homogeneous = true), gtk_box_set_homogeneous)
  _WRAP_METHOD(bool get_homogeneous() const, gtk_box_get_homogeneous)

  _WRAP_METHOD(void set_spacing(int spacing), gtk_box_set_spacing)
  _WRAP_METHOD(int get_spacing() const, gtk_box_get_spacing)

  _WRAP_METHOD(void set_baseline_position(BaselinePosition position), gtk_box_set_baseline_position)
  _WRAP_METHOD(BaselinePosition get_baseline_position() const, gtk_box_get_baseline_position)

  _WRAP_METHOD(void reorder_child(Widget& child, int position), gtk_box_reorder_child)

  _WRAP_METHOD(void set_center_widget(Widget& widget), gtk_box_set_center_widget)

  /** Unset the center_widget.
   * See set_center_widget().
   */
  void unset_center_widget();
  _WRAP_METHOD(Widget* get_center_widget(), gtk_box_get_center_widget) //transfer none
  _WRAP_METHOD(const Widget* get_center_widget() const, gtk_box_get_center_widget, constversion) //transfer none

  _WRAP_PROPERTY("spacing", int)
  _WRAP_PROPERTY("homogeneous", bool)
  _WRAP_PROPERTY("baseline-position", BaselinePosition)

  _WRAP_CHILD_PROPERTY("expand", bool)
  _WRAP_CHILD_PROPERTY("fill", bool)
  _WRAP_CHILD_PROPERTY("pack-type", PackType)
  _WRAP_CHILD_PROPERTY("position", int)
};

} // namespace Gtk
