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

notebook.cc

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

Notebook::Page* Notebook::get_current() const
{
   return reinterpret_cast<Notebook::Page*>(gtkobj()->cur_page);
}

Widget*
Notebook::get_current_child()
{
  GtkNotebookPage* page = gtkobj()->cur_page;
  return wrap(GTK_WIDGET(page->child));
}

/*********************************************************************
***** Page Properties
*********************************************************************/

Widget* Notebook_Helpers::Page::get_child() {return wrap(gtkobj()->child);}
bool Notebook_Helpers::Page::get_expand()       {return gtkobj()->expand;}
bool Notebook_Helpers::Page::get_fill()         {return gtkobj()->fill;}
GtkPackType Notebook_Helpers::Page::get_pack()  {return GtkPackType(gtkobj()->pack);}
Widget* Notebook_Helpers::Page::get_tab()
{
  if (gtkobj()->default_tab) return 0;
  return wrap(gtkobj()->tab_label);
}
Widget* Notebook_Helpers::Page::get_menu()
{
  if (gtkobj()->default_menu) return 0;
  return wrap(gtkobj()->menu_label);
}

void Notebook_Helpers::Page::set_tab (Widget* tab)
{
  gtk_notebook_set_tab_label(parent(),gtkobj()->child,(tab?tab->gtkobj():0));
}

void Notebook_Helpers::Page::set_tab (Widget& tab)
{
  gtk_notebook_set_tab_label(parent(),gtkobj()->child,tab.gtkobj());
}

string Notebook_Helpers::Page::get_tab_text()
{
  GtkWidget* w=gtk_notebook_get_tab_label(parent(),gtkobj()->child);
  char *s=0;
  if (w&& GTK_IS_LABEL (w))
    s=GTK_LABEL(w)->label;
  if (s) return s;
  return "";
}

void Notebook_Helpers::Page::set_tab_text(const nstring& str)
{
  gtk_notebook_set_tab_label_text(parent(),gtkobj()->child,str.gc_str());
}

void Notebook_Helpers::Page::set_menu(Widget* menu)
{
  gtk_notebook_set_menu_label(parent(),gtkobj()->child,(menu?menu->gtkobj():0));
}

void Notebook_Helpers::Page::set_menu(Widget& menu)
{
  gtk_notebook_set_menu_label(parent(),gtkobj()->child,menu.gtkobj());
}

void Notebook_Helpers::Page::set_tab_packing(bool expand,bool fill,GtkPackType pack_type)
{
  gtk_notebook_set_tab_label_packing(parent(),gtkobj()->child,expand,fill,pack_type);
}

/*********************************************************************
***** List properties
*********************************************************************/
typedef Notebook_Helpers::PageList::iterator page_iterator;

page_iterator Notebook_Helpers::PageList::insert(page_iterator position,const Element& e)
{
  int pos;

  // locate the items desired position
  if (!position.node)
    pos=-1;
  else
    pos=g_list_position(glist(),position.node);

  // give item to gtk+
  gtk_notebook_insert_page_menu(
                             parent_->gtkobj(),
                             ((e.child_)?e.child_->gtkobj():0),
                             ((e.tab_)?e.tab_->gtkobj():0),
                             ((e.menu_)?e.menu_->gtkobj():0),
                             pos);

  // return the right iterator
  if (pos==0)
    return begin();
  if (!position.node)
    return --end();
  return --position;
}

void Notebook_Helpers::PageList::reorder(page_iterator pos,page_iterator page)
{
  int position=g_list_position(glist(),pos.node);
  gtk_notebook_reorder_child(parent_->gtkobj(),(*page)->gtkobj()->child,position);
}


}

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

namespace Gtk {
Notebook_Class Notebook::notebook_class = {0};

Object* Notebook_Class::wrap_new(GtkObject* o)
  {
    Object* cpp=manage(new Notebook((GtkNotebook*)(o)));
    return cpp;
  }

bool Notebook::isA( Object *checkcast)
  {
    return GTK_IS_NOTEBOOK(checkcast->gtkobj());
  }

GtkType Notebook::get_type()
  {
    return notebook_class.get_type();
  }

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

const char* const Notebook::signal_names[]={
   "switch_page",
   0};

void Notebook::initialize_class()
  {

     notebook_self=this;

  }

void Notebook_Class::class_init_function(GtkNotebookClass *klass)
  {
    CppClassParent::class_init_function((BaseClassParent*)klass);
    klass->switch_page=switch_page_callback;
  }

void Notebook_Class::object_init_function(GtkNotebook *)
  {}

}

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

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

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

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

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

Gtk::Notebook_Helpers::PageList::iterator Gtk::Notebook_Helpers::PageList::find(Widget& w)
{
  iterator i;
  for (i=begin();i!=end()&&(*i)->get_child()!=&w;i++);
  return i;
}

Gtk::Notebook_Helpers::PageList::value_type Gtk::Notebook_Helpers::PageList::operator[](size_type l) const
          { size_type j; iterator i; for (i=begin(),j=0;i!=end(),j<l;++i,++j);
            return (*i);
          }

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

Gtk::Notebook_Helpers::PageList::iterator Gtk::Notebook_Helpers::PageList::begin_() const
{return iterator(glist(),glist());}

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

Gtk::Notebook_Helpers::PageList::size_type Gtk::Notebook_Helpers::PageList::size() const
  { return g_list_length(glist()); }

void Gtk::Notebook_Helpers::PageList::clear()
{ erase(begin(),end()); }

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


Gtk::Notebook::Notebook(GtkNotebook *castitem)
  :     Gtk::Container((GtkContainer*)(castitem))
  {
    initialize_class();
  }

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

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

gint Gtk::Notebook::get_current_page_num() const
  {
    return gtk_notebook_get_current_page(const_cast<GtkNotebook*>(gtkobj()));
  }

Gtk::Widget* Gtk::Notebook::get_nth_page(gint page_number)
  {
    return Gtk::wrap(gtk_notebook_get_nth_page(gtkobj(),page_number));
  }

gint Gtk::Notebook::page_num(const Gtk::Widget& child)
  {
    return gtk_notebook_page_num(gtkobj(),const_cast<GtkWidget*>(child.gtkobj()));
  }

void Gtk::Notebook::set_page(gint page_number)
  {
    gtk_notebook_set_page(gtkobj(),page_number);
  }

void Gtk::Notebook::next_page()
  {
    gtk_notebook_next_page(gtkobj());
  }

void Gtk::Notebook::prev_page()
  {
    gtk_notebook_prev_page(gtkobj());
  }

void Gtk::Notebook::set_show_border(bool show_border)
  {
    gtk_notebook_set_show_border(gtkobj(),(gint)show_border);
  }

void Gtk::Notebook::set_show_tabs(bool show_tabs)
  {
    gtk_notebook_set_show_tabs(gtkobj(),(gint)show_tabs);
  }

void Gtk::Notebook::set_tab_pos(GtkPositionType pos)
  {
    gtk_notebook_set_tab_pos(gtkobj(),pos);
  }

void Gtk::Notebook::set_homogeneous_tabs(bool homogeneous)
  {
    gtk_notebook_set_homogeneous_tabs(gtkobj(),(gint)homogeneous);
  }

void Gtk::Notebook::set_tab_border(gint border_width)
  {
    gtk_notebook_set_tab_border(gtkobj(),border_width);
  }

void Gtk::Notebook::set_tab_hborder(guint tab_hborder)
  {
    gtk_notebook_set_tab_hborder(gtkobj(),tab_hborder);
  }

void Gtk::Notebook::set_tab_vborder(guint tab_vborder)
  {
    gtk_notebook_set_tab_vborder(gtkobj(),tab_vborder);
  }

void Gtk::Notebook::set_scrollable(bool scrollable)
  {
    gtk_notebook_set_scrollable(gtkobj(),(gint)scrollable);
  }

void Gtk::Notebook::popup_enable()
  {
    gtk_notebook_popup_enable(gtkobj());
  }

void Gtk::Notebook::popup_disable()
  {
    gtk_notebook_popup_disable(gtkobj());
  }

void gtkmm_notebook_switch_page(GtkNotebook* notebook,GtkNotebookPage* p1,guint p2)
  {
    static guint signum=gtk_signal_lookup("switch_page",gtk_notebook_get_type());
    g_return_if_fail (notebook != NULL);
    g_return_if_fail (GTK_NOTEBOOK (notebook));

    gtk_signal_emit(GTK_OBJECT(notebook),signum,p1,p2);
  }

void Gtk::Notebook::prepend_page(Gtk::Widget& p0,Gtk::Widget& p1)
  {
    gtk_notebook_prepend_page(gtkobj(),p0.gtkobj(),p1.gtkobj());
  }

void Gtk::Notebook::append_page(Gtk::Widget& p0,Gtk::Widget& p1)
  {
    gtk_notebook_append_page(gtkobj(),p0.gtkobj(),p1.gtkobj());
  }

void Gtk::Notebook_Class::switch_page_callback(GtkNotebook* p0,GtkNotebookPage* p1,guint p2)
  {
    CppObjectType *obj=
      static_cast<CppObjectType *>(static_cast<Gtk::Object *>(
        gtk_object_get_data_by_id((GtkObject*)p0,Gtk::quark_)));

    if (obj)
      obj->switch_page_impl((Gtk::Notebook_Helpers::Page*)((void*)(p1)),p2);
    else
      {
        BaseClassType* base=
          static_cast<BaseClassType*>(
            gtk_type_parent_class(((GtkObject*)p0)->klass->type));
        if (base->switch_page)
          (base->switch_page)(p0,p1,p2);
      }

  }

void Gtk::Notebook::switch_page_impl(Gtk::Notebook_Helpers::Page* p0,guint p1)
  {
    BaseClassType* base=
      static_cast<BaseClassType*>(
        gtk_type_parent_class(gtkobject->klass->type));
    if (base->switch_page)
      (base->switch_page)(gtkobj(),(GtkNotebookPage*)((void*)(p0)),p1);

  }

namespace {
static void switch_page_convert_func(SigC::Callback2<void,Gtk::Notebook_Helpers::Page*,guint> *s,GtkNotebookPage* p1,guint p2)
  {
     s->call((Gtk::Notebook_Helpers::Page*)((void*)(p1)),p2);
  }

}

SigC::Connection
Gtk::Notebook::Proxy_switch_page::connect(const SigC::Slot2<void,Gtk::Notebook_Helpers::Page*,guint> &s)
   {
    return BaseType::connect(SigC::convert(s,&switch_page_convert_func));
   }

void Gtk::Notebook::Proxy_switch_page::operator()(Gtk::Notebook_Helpers::Page* p0,guint p1)
  {
     BaseType::emit((GtkNotebookPage*)((void*)(p0)),p1);
  }

void Gtk::Notebook::Proxy_switch_page::emit(Gtk::Notebook_Helpers::Page* p0,guint p1)
  {
     BaseType::emit((GtkNotebookPage*)((void*)(p0)),p1);
  }

GtkPositionType Gtk::Notebook::get_tab_pos() const
  { return (GtkPositionType)gtkobj()->tab_pos; }

bool Gtk::Notebook::get_show_tabs() const
  { return ((gtkobj()->show_tabs)?true:false); }

bool Gtk::Notebook::get_show_border() const
  { return ((gtkobj()->show_border)?true:false); }

Generated by  Doxygen 1.6.0   Back to index