// Generated by gmmproc 2.80.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gtkmm/flowbox.h>
#include <gtkmm/private/flowbox_p.h>


/* Copyright (C) 2014 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 <gtk/gtk.h>
#include <gtkmm/adjustment.h>

namespace
{
extern "C"
{
static void FuncProxy_Foreach_gtk_callback(GtkFlowBox* box, GtkFlowBoxChild* child, void* data)
{
  auto the_slot = static_cast<Gtk::FlowBox::SlotSelectedForeach*>(data);

  try
  {
    (*the_slot)(Glib::wrap(box), Glib::wrap(child));
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
}

static gboolean SignalProxy_Filter_gtk_callback(GtkFlowBoxChild* child, void* data)
{
  auto the_slot = static_cast<Gtk::FlowBox::SlotFilter*>(data);

  try
  {
    return (*the_slot)(Glib::wrap(child));
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
    return FALSE;
  }
}

static void SignalProxy_Filter_gtk_callback_destroy(void* data)
{
  delete static_cast<Gtk::FlowBox::SlotFilter*>(data);
}

static int SignalProxy_Sort_gtk_callback(GtkFlowBoxChild* child1, GtkFlowBoxChild* child2, void* data)
{
  auto the_slot = static_cast<Gtk::FlowBox::SlotSort*>(data);

  try
  {
    return (*the_slot)(Glib::wrap(child1), Glib::wrap(child2));
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
    return 0;
  }
}

static void SignalProxy_Sort_gtk_callback_destroy(void* data)
{
  delete static_cast<Gtk::FlowBox::SlotSort*>(data);
}

static GtkWidget* proxy_bind_model_create_widget_callback(void* item, void* data)
{
  auto& slot = *static_cast<Gtk::FlowBox::SlotCreateWidget<Glib::Object>*>(data);
  auto cobject = static_cast<GObject*>(item);

  try
  {
    // take_copy is true here, because wrap() returns a Glib::RefPtr<Glib::Object>.
    // cobject will be unreferenced when the RefPtr is deleted.
    Gtk::Widget* widget = slot(Glib::wrap(cobject, true));
    if (widget)
      return widget->gobj();
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
  return nullptr;
}

static void proxy_bind_model_create_widget_callback_destroy(void* data)
{
  delete static_cast<Gtk::FlowBox::SlotCreateWidget<Glib::Object>*>(data);
}
} // extern "C"
} // anonymous namespace

namespace Gtk
{
extern "C"
{
// A function with external linkage and C linkage does not get a mangled name.
// Even though gtkmm_FlowBox_create_widget_callback() is declared in a named
// namespace, the linker does not see the namespace name.
// Therefore the function name shall have a prefix, hopefully unique.
GtkWidget* gtkmm_FlowBox_create_widget_callback(void* item, void* data)
{
  auto create_widget_data = reinterpret_cast<FlowBoxCreateWidgetData*>(data);
  return (*create_widget_data->func)(item, create_widget_data->data);
}

void gtkmm_FlowBox_create_widget_callback_destroy(void* data)
{
  auto create_widget_data = reinterpret_cast<FlowBoxCreateWidgetData*>(data);
  // Delete the slot.
  (*create_widget_data->destroy_func)(create_widget_data->data);
  // Delete the FlowBoxCreateWidgetData.
  delete create_widget_data;
}
} // extern "C"

void FlowBox::selected_foreach(const SlotSelectedForeach& slot)
{
  SlotSelectedForeach slot_local_copy(slot);

  gtk_flow_box_selected_foreach(gobj(),
    &FuncProxy_Foreach_gtk_callback, &slot_local_copy);
}

void FlowBox::set_filter_func(const SlotFilter& slot)
{
  // Create a copy of the slot object. A pointer to this will be passed
  // through the callback's data parameter. It will be deleted
  // when SignalProxy_Filter_gtk_callback_destroy() is called.
  auto slot_copy = new SlotFilter(slot);

  gtk_flow_box_set_filter_func(gobj(),
    &SignalProxy_Filter_gtk_callback, slot_copy,
    &SignalProxy_Filter_gtk_callback_destroy);
}

void FlowBox::unset_filter_func()
{
  gtk_flow_box_set_filter_func(gobj(), nullptr, nullptr, nullptr);
}

void FlowBox::set_sort_func(const SlotSort& slot)
{
  // Create a copy of the slot object. A pointer to this will be passed
  // through the callback's data parameter. It will be deleted
  // when SignalProxy_Sort_gtk_callback_destroy() is called.
  auto slot_copy = new SlotSort(slot);

  gtk_flow_box_set_sort_func(gobj(),
    &SignalProxy_Sort_gtk_callback, slot_copy,
    &SignalProxy_Sort_gtk_callback_destroy);
}

void FlowBox::unset_sort_func()
{
  gtk_flow_box_set_sort_func(gobj(), nullptr, nullptr, nullptr);
}

void FlowBox::bind_model(const Glib::RefPtr<Gio::ListModel>& model,
  const SlotCreateWidget<Glib::Object>& slot_create_widget)
{
  // Create a copy of the slot.
  // It will be deleted by proxy_bind_model_create_widget_callback_destroy().
  auto slot_copy = new SlotCreateWidget<Glib::Object>(slot_create_widget);

  gtk_flow_box_bind_model(gobj(), Glib::unwrap(model), &proxy_bind_model_create_widget_callback,
    slot_copy, &proxy_bind_model_create_widget_callback_destroy);
}

} //namespace Gtk


namespace
{


extern "C" {
static void FlowBox_signal_child_activated_connect_callback(GtkFlowBox* self, GtkFlowBoxChild* p0,void* data)
{
  using namespace Gtk;
  using SlotType = sigc::slot<void(FlowBoxChild*)>;

  auto obj = dynamic_cast<FlowBox*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
);
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }
}
} // extern "C"

static const Glib::SignalProxyInfo FlowBox_signal_child_activated_info =
{
  "child-activated",
  (GCallback) &FlowBox_signal_child_activated_connect_callback,
  (GCallback) &FlowBox_signal_child_activated_connect_callback
};


static const Glib::SignalProxyInfo FlowBox_signal_selected_children_changed_info =
{
  "selected-children-changed",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


} // anonymous namespace


namespace Glib
{

Gtk::FlowBox* wrap(GtkFlowBox* object, bool take_copy)
{
  return dynamic_cast<Gtk::FlowBox *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}

} /* namespace Glib */

namespace Gtk
{


/* The *_Class implementation: */

const Glib::Class& FlowBox_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &FlowBox_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(gtk_flow_box_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:
  Orientable::add_interface(get_type());

  }

  return *this;
}


void FlowBox_Class::class_init_function(void* g_class, void* class_data)
{
  const auto klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);


}


Glib::ObjectBase* FlowBox_Class::wrap_new(GObject* o)
{
  return manage(new FlowBox((GtkFlowBox*)(o)));

}


/* The implementation: */

FlowBox::FlowBox(const Glib::ConstructParams& construct_params)
:
  Gtk::Widget(construct_params)
{
  }

FlowBox::FlowBox(GtkFlowBox* castitem)
:
  Gtk::Widget((GtkWidget*)(castitem))
{
  }


FlowBox::FlowBox(FlowBox&& src) noexcept
: Gtk::Widget(std::move(src))
  , Orientable(std::move(src))
{}

FlowBox& FlowBox::operator=(FlowBox&& src) noexcept
{
  Gtk::Widget::operator=(std::move(src));
  Orientable::operator=(std::move(src));
  return *this;
}

FlowBox::~FlowBox() noexcept
{
  destroy_();
}

FlowBox::CppClassType FlowBox::flowbox_class_; // initialize static member

GType FlowBox::get_type()
{
  return flowbox_class_.init().get_type();
}


GType FlowBox::get_base_type()
{
  return gtk_flow_box_get_type();
}


FlowBox::FlowBox()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(nullptr),
  Gtk::Widget(Glib::ConstructParams(flowbox_class_.init()))
{
  

}

void FlowBox::set_homogeneous(bool homogeneous)
{
  gtk_flow_box_set_homogeneous(gobj(), static_cast<int>(homogeneous));
}

bool FlowBox::get_homogeneous() const
{
  return gtk_flow_box_get_homogeneous(const_cast<GtkFlowBox*>(gobj()));
}

void FlowBox::set_row_spacing(guint spacing)
{
  gtk_flow_box_set_row_spacing(gobj(), spacing);
}

guint FlowBox::get_row_spacing() const
{
  return gtk_flow_box_get_row_spacing(const_cast<GtkFlowBox*>(gobj()));
}

void FlowBox::set_column_spacing(guint spacing)
{
  gtk_flow_box_set_column_spacing(gobj(), spacing);
}

guint FlowBox::get_column_spacing() const
{
  return gtk_flow_box_get_column_spacing(const_cast<GtkFlowBox*>(gobj()));
}

void FlowBox::set_min_children_per_line(guint n_children)
{
  gtk_flow_box_set_min_children_per_line(gobj(), n_children);
}

guint FlowBox::get_min_children_per_line() const
{
  return gtk_flow_box_get_min_children_per_line(const_cast<GtkFlowBox*>(gobj()));
}

void FlowBox::set_max_children_per_line(guint n_children)
{
  gtk_flow_box_set_max_children_per_line(gobj(), n_children);
}

guint FlowBox::get_max_children_per_line() const
{
  return gtk_flow_box_get_max_children_per_line(const_cast<GtkFlowBox*>(gobj()));
}

void FlowBox::set_activate_on_single_click(bool single)
{
  gtk_flow_box_set_activate_on_single_click(gobj(), static_cast<int>(single));
}

bool FlowBox::get_activate_on_single_click() const
{
  return gtk_flow_box_get_activate_on_single_click(const_cast<GtkFlowBox*>(gobj()));
}

void FlowBox::prepend(Widget& child)
{
  gtk_flow_box_prepend(gobj(), (child).gobj());
}

void FlowBox::append(Widget& child)
{
  gtk_flow_box_append(gobj(), (child).gobj());
}

void FlowBox::insert(Widget& widget, int position)
{
  gtk_flow_box_insert(gobj(), (widget).gobj(), position);
}

void FlowBox::remove(Widget& widget)
{
  gtk_flow_box_remove(gobj(), (widget).gobj());
}

void FlowBox::remove_all()
{
  gtk_flow_box_remove_all(gobj());
}

FlowBoxChild* FlowBox::get_child_at_index(int idx)
{
  return Glib::wrap(gtk_flow_box_get_child_at_index(gobj(), idx));
}

const FlowBoxChild* FlowBox::get_child_at_index(int idx) const
{
  return const_cast<FlowBox*>(this)->get_child_at_index(idx);
}

FlowBoxChild* FlowBox::get_child_at_pos(int x, int y)
{
  return Glib::wrap(gtk_flow_box_get_child_at_pos(gobj(), x, y));
}

const FlowBoxChild* FlowBox::get_child_at_pos(int x, int y) const
{
  return const_cast<FlowBox*>(this)->get_child_at_pos(x, y);
}

std::vector< Gtk::FlowBoxChild*> FlowBox::get_selected_children()
{
  return Glib::ListHandler< Gtk::FlowBoxChild* >::list_to_vector(gtk_flow_box_get_selected_children(gobj()), Glib::OWNERSHIP_SHALLOW);
}

std::vector< const Gtk::FlowBoxChild*> FlowBox::get_selected_children() const
{
  return Glib::ListHandler< const Gtk::FlowBoxChild* >::list_to_vector(gtk_flow_box_get_selected_children(const_cast<GtkFlowBox*>(gobj())), Glib::OWNERSHIP_SHALLOW);
}

void FlowBox::select_child(FlowBoxChild& child)
{
  gtk_flow_box_select_child(gobj(), (child).gobj());
}

void FlowBox::unselect_child(FlowBoxChild& child)
{
  gtk_flow_box_unselect_child(gobj(), (child).gobj());
}

void FlowBox::select_all()
{
  gtk_flow_box_select_all(gobj());
}

void FlowBox::unselect_all()
{
  gtk_flow_box_unselect_all(gobj());
}

void FlowBox::set_selection_mode(SelectionMode mode)
{
  gtk_flow_box_set_selection_mode(gobj(), static_cast<GtkSelectionMode>(mode));
}

SelectionMode FlowBox::get_selection_mode() const
{
  return static_cast<SelectionMode>(gtk_flow_box_get_selection_mode(const_cast<GtkFlowBox*>(gobj())));
}

void FlowBox::set_hadjustment(const Glib::RefPtr<Adjustment>& adjustment)
{
  gtk_flow_box_set_hadjustment(gobj(), Glib::unwrap(adjustment));
}

void FlowBox::set_vadjustment(const Glib::RefPtr<Adjustment>& adjustment)
{
  gtk_flow_box_set_vadjustment(gobj(), Glib::unwrap(adjustment));
}

void FlowBox::invalidate_filter()
{
  gtk_flow_box_invalidate_filter(gobj());
}

void FlowBox::invalidate_sort()
{
  gtk_flow_box_invalidate_sort(gobj());
}


Glib::SignalProxy<void(FlowBoxChild*)> FlowBox::signal_child_activated()
{
  return Glib::SignalProxy<void(FlowBoxChild*) >(this, &FlowBox_signal_child_activated_info);
}


Glib::SignalProxy<void()> FlowBox::signal_selected_children_changed()
{
  return Glib::SignalProxy<void() >(this, &FlowBox_signal_selected_children_changed_info);
}


static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<SelectionMode>::value,
  "Type SelectionMode cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< SelectionMode > FlowBox::property_selection_mode() 
{
  return Glib::PropertyProxy< SelectionMode >(this, "selection-mode");
}

Glib::PropertyProxy_ReadOnly< SelectionMode > FlowBox::property_selection_mode() const
{
  return Glib::PropertyProxy_ReadOnly< SelectionMode >(this, "selection-mode");
}

Glib::PropertyProxy< bool > FlowBox::property_activate_on_single_click() 
{
  return Glib::PropertyProxy< bool >(this, "activate-on-single-click");
}

Glib::PropertyProxy_ReadOnly< bool > FlowBox::property_activate_on_single_click() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "activate-on-single-click");
}

Glib::PropertyProxy< bool > FlowBox::property_accept_unpaired_release() 
{
  return Glib::PropertyProxy< bool >(this, "accept-unpaired-release");
}

Glib::PropertyProxy_ReadOnly< bool > FlowBox::property_accept_unpaired_release() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "accept-unpaired-release");
}

Glib::PropertyProxy< bool > FlowBox::property_homogeneous() 
{
  return Glib::PropertyProxy< bool >(this, "homogeneous");
}

Glib::PropertyProxy_ReadOnly< bool > FlowBox::property_homogeneous() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "homogeneous");
}

Glib::PropertyProxy< guint > FlowBox::property_min_children_per_line() 
{
  return Glib::PropertyProxy< guint >(this, "min-children-per-line");
}

Glib::PropertyProxy_ReadOnly< guint > FlowBox::property_min_children_per_line() const
{
  return Glib::PropertyProxy_ReadOnly< guint >(this, "min-children-per-line");
}

Glib::PropertyProxy< guint > FlowBox::property_max_children_per_line() 
{
  return Glib::PropertyProxy< guint >(this, "max-children-per-line");
}

Glib::PropertyProxy_ReadOnly< guint > FlowBox::property_max_children_per_line() const
{
  return Glib::PropertyProxy_ReadOnly< guint >(this, "max-children-per-line");
}

Glib::PropertyProxy< guint > FlowBox::property_row_spacing() 
{
  return Glib::PropertyProxy< guint >(this, "row-spacing");
}

Glib::PropertyProxy_ReadOnly< guint > FlowBox::property_row_spacing() const
{
  return Glib::PropertyProxy_ReadOnly< guint >(this, "row-spacing");
}

Glib::PropertyProxy< guint > FlowBox::property_column_spacing() 
{
  return Glib::PropertyProxy< guint >(this, "column-spacing");
}

Glib::PropertyProxy_ReadOnly< guint > FlowBox::property_column_spacing() const
{
  return Glib::PropertyProxy_ReadOnly< guint >(this, "column-spacing");
}


} // namespace Gtk


