Logo Search packages:      
Sourcecode: ardour version File versions  Download package

packer.cc

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

void gtkmm_packer_add(GtkPacker* p,GtkWidget* w,GtkSideType side,
                     GtkAnchorType anchor,
                     guint options,
                     guint border_widthx,
                     guint pad_x,
                     guint pad_y,
                     guint i_pad_x,
                     guint i_pad_y)
{
  g_return_if_fail (p != NULL);

  if (border_widthx==GTKMM_PACKER_DEFAULT) border_widthx=p->default_border_width;
  if (pad_x==GTKMM_PACKER_DEFAULT) pad_x=p->default_pad_x;
  if (pad_y==GTKMM_PACKER_DEFAULT) pad_y=p->default_pad_y;
  if (i_pad_x==GTKMM_PACKER_DEFAULT) i_pad_x=p->default_i_pad_x;
  if (i_pad_y==GTKMM_PACKER_DEFAULT) i_pad_y=p->default_i_pad_y;

  gtk_packer_add(p, w,
             side, anchor, GtkPackerOptions(options), border_widthx,
             pad_x, pad_y, i_pad_x, i_pad_y);
}

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

void Packer_Helpers::Child::redraw()
  {
    if (GTK_WIDGET_VISIBLE (gtkobj()->widget) && GTK_WIDGET_VISIBLE (parent()))
            gtk_widget_queue_resize (gtkobj()->widget);
  }

void Packer_Helpers::Child::set_packing(
                         GtkSideType s,
                         GtkAnchorType a,
                         guint o,
                         guint b,
                         guint x,guint y,
                         guint ix,guint iy)
{
  if (b==GTKMM_PACKER_DEFAULT) b=parent()->default_border_width;
  if (x==GTKMM_PACKER_DEFAULT) x=parent()->default_pad_x;
  if (y==GTKMM_PACKER_DEFAULT) y=parent()->default_pad_y;
  if (ix==GTKMM_PACKER_DEFAULT) ix=parent()->default_i_pad_x;
  if (iy==GTKMM_PACKER_DEFAULT) iy=parent()->default_i_pad_y;

  gtkobj()->anchor=a;
  gtkobj()->side=s;
  gtkobj()->options=GtkPackerOptions(o);
  gtkobj()->border_width=b;
  gtkobj()->pad_x = x;
  gtkobj()->pad_y = y;
  gtkobj()->i_pad_x = ix;
  gtkobj()->i_pad_y = iy;

  redraw();
}

// These are our own
void Packer_Helpers::Child::set_anchor(GtkAnchorType a)
{ gtkobj()->anchor=a; redraw(); }
void Packer_Helpers::Child::set_side(GtkSideType s)
{ gtkobj()->side=s; redraw(); }
void Packer_Helpers::Child::set_options(guint o)
{ gtkobj()->options=GtkPackerOptions(o); redraw(); }
void Packer_Helpers::Child::set_border_width(guint b)
{ gtkobj()->border_width=b; redraw(); }
void Packer_Helpers::Child::set_pad(guint x,guint y)
{ gtkobj()->pad_x=x; gtkobj()->pad_y=y;redraw(); }
void Packer_Helpers::Child::set_ipad(guint x,guint y)
{ gtkobj()->i_pad_x=x; gtkobj()->i_pad_y=y;redraw(); }

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

Packer_Helpers::Element::Element(Widget &child,
                             GtkSideType side,
                             GtkAnchorType anchor,
                             guint options,
                             guint border_width,
                             guint pad_x,
                             guint pad_y,
                             guint i_pad_x,
                             guint i_pad_y)
    : child_(&child),
      side_(side),anchor_(anchor),options_(options),border_width_(border_width),
      pad_x_(pad_x),pad_y_(pad_y),i_pad_x_(i_pad_x),i_pad_y_(i_pad_y)
{}

/**********************************************************************/
typedef Packer_Helpers::PackerList::iterator packer_iterator;

packer_iterator Packer_Helpers::PackerList::insert(packer_iterator position, const Element& e)
{
  iterator i;
  gtkmm_packer_add(parent_->gtkobj(),
     (e.child_?e.child_->gtkobj():0), e.side_, e.anchor_, e.options_,
     e.border_width_, e.pad_x_, e.pad_y_, e.i_pad_x_, e.i_pad_y_);

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

// Non-standard
void Packer_Helpers::PackerList::reorder(packer_iterator loc,packer_iterator pos)
{
  gint position=g_list_position(glist(),pos.node);
  gtk_packer_reorder_child(parent_->gtkobj(),(*loc)->gtkobj()->widget,position);
}

Widget* Packer_Helpers::Child::get_widget() const { return wrap(gtkobj()->widget);}
GtkSideType Packer_Helpers::Child::get_side() const   { return gtkobj()->side; }
GtkAnchorType Packer_Helpers::Child::get_anchor() const   { return gtkobj()->anchor; }
guint Packer_Helpers::Child::get_options() const      { return gtkobj()->options; }
guint Packer_Helpers::Child::get_border_width() const { return gtkobj()->border_width; }
guint Packer_Helpers::Child::get_pad_x() const        { return gtkobj()->pad_x; }
guint Packer_Helpers::Child::get_pad_y() const        { return gtkobj()->pad_y; }
guint Packer_Helpers::Child::get_ipad_x() const       { return gtkobj()->i_pad_x; }
guint Packer_Helpers::Child::get_ipad_y() const       { return gtkobj()->i_pad_y; }

}

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

namespace Gtk {
Packer_Class Packer::packer_class = {0};

Object* Packer_Class::wrap_new(GtkObject* o)
  {
    Object* cpp=manage(new Packer((GtkPacker*)(o)));
    return cpp;
  }

bool Packer::isA( Object *checkcast)
  {
    return GTK_IS_PACKER(checkcast->gtkobj());
  }

GtkType Packer::get_type()
  {
    return packer_class.get_type();
  }

GtkType Packer_Class::get_type()
  {
    if (!type)
      {
        CppClassParent::CppObjectType::get_type();
        GtkTypeInfo info =
          {
            "Gtk__Packer",
            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_packer_get_type(), &info);
      }
    return type;
  }

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

void Packer::initialize_class()
  {

  }

void Packer_Class::class_init_function(GtkPackerClass *klass)
  {
    CppClassParent::class_init_function((BaseClassParent*)klass);
  }

void Packer_Class::object_init_function(GtkPacker *)
  {}

}

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

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

Gtk::Packer_Helpers::PackerList::iterator Gtk::Packer_Helpers::PackerList::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;
}

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

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

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

Gtk::Packer_Helpers::PackerList::iterator Gtk::Packer_Helpers::PackerList::begin_() const
{return iterator(glist(),glist());}

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

Gtk::Packer_Helpers::PackerList::size_type Gtk::Packer_Helpers::PackerList::size() const
  { return g_list_length(glist()); }

void Gtk::Packer_Helpers::PackerList::clear()
{ erase(begin(),end()); }

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


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

Gtk::Packer::Packer(GtkPacker *castitem)
  :     Gtk::Container((GtkContainer*)(castitem))
  {
    initialize_class();
  }

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

void Gtk::Packer::add(Gtk::Widget& child,GtkSideType side,GtkAnchorType anchor,guint options,guint border_width,guint pad_x,guint pad_y,guint i_pad_x,guint i_pad_y)
  {
    gtkmm_packer_add(gtkobj(),child.gtkobj(),side,anchor,options,border_width,pad_x,pad_y,i_pad_x,i_pad_y);
  }

void Gtk::Packer::set_spacing(guint spacing)
  {
    gtk_packer_set_spacing(gtkobj(),spacing);
  }

void Gtk::Packer::set_default_border_width(guint border)
  {
    gtk_packer_set_default_border_width(gtkobj(),border);
  }

void Gtk::Packer::set_default_pad(guint pad_x,guint pad_y)
  {
    gtk_packer_set_default_pad(gtkobj(),pad_x,pad_y);
  }

void Gtk::Packer::set_default_ipad(guint i_pad_x,guint i_pad_y)
  {
    gtk_packer_set_default_ipad(gtkobj(),i_pad_x,i_pad_y);
  }

guint Gtk::Packer::get_spacing() const
  { return gtkobj()->spacing; }

guint Gtk::Packer::get_default_border_width() const
  { return gtkobj()->default_border_width; }

guint Gtk::Packer::get_default_pad_x() const
  { return gtkobj()->default_pad_x; }

guint Gtk::Packer::get_default_pad_y() const
  { return gtkobj()->default_pad_y; }

guint Gtk::Packer::get_default_ipad_x() const
  { return gtkobj()->default_i_pad_x; }

guint Gtk::Packer::get_default_ipad_y() const
  { return gtkobj()->default_i_pad_y; }

Generated by  Doxygen 1.6.0   Back to index