/* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
 */

#include <gtkmm/layoutmanager.h>
#include <gtkmm/orientable.h>

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

namespace Gtk
{

/** %Layout manager for placing all children in a single row or column.
 *
 * A %Gtk::BoxLayout is a layout manager that arranges the children of any
 * widget using it into a single row or column, depending on the value
 * of its Gtk::Orientable::property_orientation(). Within the other dimension
 * all children all allocated the same size. The %Gtk::BoxLayout will respect
 * Gtk::Widget::property_halign() and Gtk::Widget::property_valign() of each
 * child widget.
 *
 * If you want all children to be assigned the same size, you can use
 * property_homogeneous().
 *
 * If you want to specify the amount of space placed between each child,
 * you can use the property_spacing().
 *
 * @newin{3,96}
 */
class GTKMM_API BoxLayout : public LayoutManager, public Orientable
{
  _CLASS_GOBJECT(BoxLayout, GtkBoxLayout, GTK_BOX_LAYOUT, LayoutManager, GtkLayoutManager, , , GTKMM_API)
  _IMPLEMENTS_INTERFACE(Orientable)
  _DO_NOT_DERIVE_GTYPE dnl// GtkBoxLayout is a final type
  _ABI_AS_WITH_DERIVED_GTYPE dnl// Remove when we can break ABI
  _STRUCT_NOT_HIDDEN

protected:
  _WRAP_CTOR(BoxLayout(Orientation orientation = Orientation::HORIZONTAL), gtk_box_layout_new)

public:
  _WRAP_CREATE(Orientation orientation = Orientation::HORIZONTAL)

  _WRAP_METHOD(void set_homogeneous(bool homogeneous = true), gtk_box_layout_set_homogeneous)
  _WRAP_METHOD(bool get_homogeneous() const, gtk_box_layout_get_homogeneous)

  _WRAP_METHOD(void set_spacing(guint spacing), gtk_box_layout_set_spacing)
  _WRAP_METHOD(guint get_spacing() const, gtk_box_layout_get_spacing)

  _WRAP_METHOD(void set_baseline_position(BaselinePosition position), gtk_box_layout_set_baseline_position)
  _WRAP_METHOD(BaselinePosition get_baseline_position() const, gtk_box_layout_get_baseline_position)

  _WRAP_METHOD(void set_baseline_child(int child), gtk_box_layout_set_baseline_child)
  _WRAP_METHOD(int get_baseline_child() const, gtk_box_layout_get_baseline_child)

  // spacing is int in property_spacing(), but guint in set/get_spacing().
  // That's how it's done in gtk.
  _WRAP_PROPERTY("homogeneous", bool)
  _WRAP_PROPERTY("spacing", int)
  _WRAP_PROPERTY("baseline-child", int)
  _WRAP_PROPERTY("baseline-position", BaselinePosition)

  // There are no signals or vfuncs.
};

} // namespace Gtk
