// -*- c++ -*-
//  Generated by gtkmmproc from ./../box.gen_h -- DO NOT MODIFY!
#include <gtk--/box.h>
#include <gtk--/private/box_p.h>
namespace Gtk
{

#include <gtk--/base.h>


HBox::HBox(bool homogeneous, gint spacing)
  :     Box((GtkBox*)(gtk_object_new(get_type(),0)))
{
  initialize_class();
  GtkHBox *hbox;

  hbox = (GtkHBox*)gtkobject;

  GTK_BOX (hbox)->spacing = spacing;
  GTK_BOX (hbox)->homogeneous = homogeneous;

}

VBox::VBox(bool homogeneous, gint spacing)
  :     Box((GtkBox*)(gtk_object_new(get_type(),0)))
{
  initialize_class();
  GtkVBox *vbox;

  vbox = (GtkVBox*)gtkobject;

  GTK_BOX (vbox)->spacing = spacing;
  GTK_BOX (vbox)->homogeneous = homogeneous;

}

Widget* Box_Helpers::Child::get_widget() const
{
  return wrap(gtkobj()->widget);
}

/**************************************************************************/

typedef Box_Helpers::BoxList::iterator box_iterator;

box_iterator Box_Helpers::BoxList::insert(box_iterator position, const Element& e)
{
  iterator i;
  if (e.pack_==GTK_PACK_START)
    gtk_box_pack_start(parent_->gtkobj(),(e.widget_?e.widget_->gtkobj():0),
                       e.expand_,e.fill_,e.padding_);
  else
    gtk_box_pack_end(parent_->gtkobj(),(e.widget_?e.widget_->gtkobj():0),
                       e.expand_,e.fill_,e.padding_);

  i=--end();
  if (position!=end()) reorder(i,position);
  return i;
}

// Non-standard
void Box_Helpers::BoxList::reorder(box_iterator loc,box_iterator pos)
{
  int position=g_list_position(glist(),pos.node);
  gtk_box_reorder_child(parent_->gtkobj(),(*loc)->gtkobj()->widget,position);
}

}

namespace Gtk {
Gtk::Box *wrap (GtkBox *o)
  {
    return static_cast<Gtk::Box *> (Gtk::wrap_auto ((GtkObject *) (o)));
  }
}

namespace Gtk {
Box_Class Box::box_class = {0};

Object* Box_Class::wrap_new(GtkObject* o)
  {
    Object* cpp=manage(new Box((GtkBox*)(o)));
    return cpp;
  }

bool Box::isA( Object *checkcast)
  {
    return GTK_IS_BOX(checkcast->gtkobj());
  }

GtkType Box::get_type()
  {
    return box_class.get_type();
  }

GtkType Box_Class::get_type()
  {
    if (!type)
      {
        CppClassParent::CppObjectType::get_type();
        GtkTypeInfo info =
          {
            "Gtk__Box",
            sizeof(BaseObjectType),
            sizeof(BaseClassType),
            (GtkClassInitFunc) class_init_function,
            (GtkObjectInitFunc) object_init_function,
            /* reserved_1 */ NULL,
            /* reserved_2 */ NULL,
            /*base_class_init_func */ (GtkClassInitFunc) NULL
          };
        type=gtk_type_unique(gtk_box_get_type(), &info);
      }
    return type;
  }

const char* const Box::signal_names[]={
   0};

void Box::initialize_class()
  {

  }

void Box_Class::class_init_function(GtkBoxClass *klass)
  {
    CppClassParent::class_init_function((BaseClassParent*)klass);
  }

void Box_Class::object_init_function(GtkBox *)
  {}

}

Gtk::Box_Helpers::BoxList::iterator Gtk::Box_Helpers::BoxList::find(const_reference w)
{
  iterator i=begin();
  for (i=begin();i!=end()&&*i!=w;i++);
  return i;
}

Gtk::Box_Helpers::BoxList::iterator Gtk::Box_Helpers::BoxList::find(Widget& w)
{
  iterator i;
  for (i=begin();i!=end()&&(*i)->get_widget()!=&w;i++);
  return i;
}

void Gtk::Box_Helpers::BoxList::remove(const_reference child)
{
  g_return_if_fail(child!=0);
  gtk_container_remove(parent_->Container::gtkobj(),
                       (GtkWidget*)(child->get_widget()->gtkobj()));
}

void Gtk::Box_Helpers::BoxList::remove(Widget &w)
{
  gtk_container_remove(parent_->Container::gtkobj(),(GtkWidget*)(w.gtkobj()));
}

Gtk::Box_Helpers::BoxList::iterator Gtk::Box_Helpers::BoxList::erase(iterator position)
{
  if (!position.node||position==end()) return end();
  iterator next=position;
  next++;

  gtk_container_remove(parent_->Container::gtkobj(),
      (GtkWidget*)((*position)->get_widget()->gtkobj()));
  return next;
}

GList*& Gtk::Box_Helpers::BoxList::glist() const
{ return parent_->gtkobj()->children; }

Gtk::Box_Helpers::BoxList::iterator Gtk::Box_Helpers::BoxList::begin_() const
{return iterator(glist(),glist());}

Gtk::Box_Helpers::BoxList::iterator Gtk::Box_Helpers::BoxList::end_() const
{return iterator(glist(),(GList*)0);}

Gtk::Box_Helpers::BoxList::size_type Gtk::Box_Helpers::BoxList::size() const
  { return g_list_length(glist()); }

void Gtk::Box_Helpers::BoxList::clear()
{ erase(begin(),end()); }

void Gtk::Box_Helpers::BoxList::erase(iterator start, iterator stop)
{ while(start != stop) start=erase(start); }


Gtk::Box::Box(GtkBox *castitem)
  :     Gtk::Container((GtkContainer*)(castitem))
  {
    initialize_class();
  }

Gtk::Box::~Box() { destroy_(); }

void Gtk::Box::pack_start(Gtk::Widget& child,bool expand,bool fill,guint padding)
  {
    gtk_box_pack_start(gtkobj(),child.gtkobj(),(gboolean)expand,(gboolean)fill,padding);
  }

void Gtk::Box::pack_end(Gtk::Widget& child,bool expand,bool fill,guint padding)
  {
    gtk_box_pack_end(gtkobj(),child.gtkobj(),(gboolean)expand,(gboolean)fill,padding);
  }

void Gtk::Box::set_homogeneous(bool homogeneous)
  {
    gtk_box_set_homogeneous(gtkobj(),(gboolean)homogeneous);
  }

void Gtk::Box::set_spacing(gint spacing)
  {
    gtk_box_set_spacing(gtkobj(),spacing);
  }

void Gtk::Box::reorder_child(Gtk::Widget& child,gint pos)
  {
    gtk_box_reorder_child(gtkobj(),child.gtkobj(),pos);
  }

Gtk::Box::Box()
  :     Gtk::Container((GtkContainer*)(gtk_object_new(get_type(),0)))
  {
    initialize_class();
  }


namespace Gtk {
Gtk::VBox *wrap (GtkVBox *o)
  {
    return static_cast<Gtk::VBox *> (Gtk::wrap_auto ((GtkObject *) (o)));
  }
}

namespace Gtk {
VBox_Class VBox::vbox_class = {0};

Object* VBox_Class::wrap_new(GtkObject* o)
  {
    Object* cpp=manage(new VBox((GtkVBox*)(o)));
    return cpp;
  }

bool VBox::isA( Object *checkcast)
  {
    return GTK_IS_VBOX(checkcast->gtkobj());
  }

GtkType VBox::get_type()
  {
    return vbox_class.get_type();
  }

GtkType VBox_Class::get_type()
  {
    if (!type)
      {
        CppClassParent::CppObjectType::get_type();
        GtkTypeInfo info =
          {
            "Gtk__VBox",
            sizeof(BaseObjectType),
            sizeof(BaseClassType),
            (GtkClassInitFunc) class_init_function,
            (GtkObjectInitFunc) object_init_function,
            /* reserved_1 */ NULL,
            /* reserved_2 */ NULL,
            /*base_class_init_func */ (GtkClassInitFunc) NULL
          };
        type=gtk_type_unique(gtk_vbox_get_type(), &info);
      }
    return type;
  }

const char* const VBox::signal_names[]={
   0};

void VBox::initialize_class()
  {

  }

void VBox_Class::class_init_function(GtkVBoxClass *klass)
  {
    CppClassParent::class_init_function((BaseClassParent*)klass);
  }

void VBox_Class::object_init_function(GtkVBox *)
  {}

}

Gtk::VBox::VBox(GtkVBox *castitem)
  :     Gtk::Box((GtkBox*)(castitem))
  {
    initialize_class();
  }

Gtk::VBox::~VBox() { destroy_(); }


namespace Gtk {
Gtk::HBox *wrap (GtkHBox *o)
  {
    return static_cast<Gtk::HBox *> (Gtk::wrap_auto ((GtkObject *) (o)));
  }
}

namespace Gtk {
HBox_Class HBox::hbox_class = {0};

Object* HBox_Class::wrap_new(GtkObject* o)
  {
    Object* cpp=manage(new HBox((GtkHBox*)(o)));
    return cpp;
  }

bool HBox::isA( Object *checkcast)
  {
    return GTK_IS_HBOX(checkcast->gtkobj());
  }

GtkType HBox::get_type()
  {
    return hbox_class.get_type();
  }

GtkType HBox_Class::get_type()
  {
    if (!type)
      {
        CppClassParent::CppObjectType::get_type();
        GtkTypeInfo info =
          {
            "Gtk__HBox",
            sizeof(BaseObjectType),
            sizeof(BaseClassType),
            (GtkClassInitFunc) class_init_function,
            (GtkObjectInitFunc) object_init_function,
            /* reserved_1 */ NULL,
            /* reserved_2 */ NULL,
            /*base_class_init_func */ (GtkClassInitFunc) NULL
          };
        type=gtk_type_unique(gtk_hbox_get_type(), &info);
      }
    return type;
  }

const char* const HBox::signal_names[]={
   0};

void HBox::initialize_class()
  {

  }

void HBox_Class::class_init_function(GtkHBoxClass *klass)
  {
    CppClassParent::class_init_function((BaseClassParent*)klass);
  }

void HBox_Class::object_init_function(GtkHBox *)
  {}

}

Gtk::HBox::HBox(GtkHBox *castitem)
  :     Gtk::Box((GtkBox*)(castitem))
  {
    initialize_class();
  }

Gtk::HBox::~HBox() { destroy_(); }
