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

#include <vector>

#include <glibmm/object.h>
#include <gtkmm/widget.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)


namespace Gtk
{

_CC_INCLUDE(gtk/gtk.h)

/** Gtk::SizeGroup provides a mechanism for grouping a number of widgets together so they all request the same amount of space.
 * This is typically useful when you want a column of widgets to have the same size, but you can't use a Gtk::Grid widget.
 *
 * In detail, the size requested for each widget in a Gtk::SizeGroup is the maximum of the sizes that would have been
 * requested for each widget in the size group if they were not in the size group. The mode of the size group (see
 * set_mode()) determines whether this applies to the horizontal size, the vertical size, or both sizes.
 *
 * Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If
 * you want the widgets in a GtkSizeGroup to actually be the same size, you need to pack them in such a way that they
 * get the size they request and not more. For example, if you are packing your widgets into a table, you would not
 * include the Gtk::FILL flag.
 *
 * Widgets can be part of multiple size groups; GTK+ will compute the horizontal size of a widget from the horizontal
 * requisition of all widgets that can be reached from the widget by a chain of size groups of type
 * Gtk::SizeGroup::Mode::HORIZONTAL or Gtk::SizeGroup::Mode::BOTH, and the vertical size from the vertical requisition of all widgets
 * that can be reached from the widget by a chain of size groups of type Gtk::SizeGroup::Mode::VERTICAL or Gtk::SizeGroup::Mode::BOTH.
 */
class GTKMM_API SizeGroup
  : public Glib::Object,
    public Buildable
{
  _CLASS_GOBJECT(SizeGroup,GtkSizeGroup,GTK_SIZE_GROUP,Glib::Object,GObject, , , GTKMM_API)
  _IMPLEMENTS_INTERFACE(Buildable)
public:
  _WRAP_ENUM(Mode, GtkSizeGroupMode, decl_prefix GTKMM_API)

protected:
  explicit SizeGroup(Mode mode);

public:


  _WRAP_CREATE(Mode mode)

  _WRAP_METHOD(void set_mode(Mode mode), gtk_size_group_set_mode)
  _WRAP_METHOD(Mode get_mode() const, gtk_size_group_get_mode)

  _WRAP_METHOD(void add_widget(Widget& widget), gtk_size_group_add_widget)
  _WRAP_METHOD(void remove_widget(Widget& widget), gtk_size_group_remove_widget)

#m4 _CONVERSION(`GSList*',`std::vector<Widget*>',`Glib::SListHandler<Widget*>::slist_to_vector($3, Glib::OWNERSHIP_NONE)')
  _WRAP_METHOD(std::vector<Widget*> get_widgets(), gtk_size_group_get_widgets)
#m4 _CONVERSION(`GSList*',`std::vector<const Widget*>',`Glib::SListHandler<const Widget*>::slist_to_vector($3, Glib::OWNERSHIP_NONE)')
  _WRAP_METHOD(std::vector<const Widget*> get_widgets() const, gtk_size_group_get_widgets)

  _WRAP_PROPERTY("mode", Mode)
};

} //namespace Gtk
