// Generated by gtkmmproc -- DO NOT MODIFY!


#include <gtkmm/notebook.h>
#include <gtkmm/private/notebook_p.h>

#include <gtk/gtk.h>
// -*- c++ -*-
/* $Id: notebook.ccg,v 1.6 2006/06/16 21:40:01 murrayc Exp $ */

/* Copyright 1998-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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtk/gtk.h>
#include <gtkmm/label.h>
#include <algorithm>

namespace Gtk
{

int Notebook::prepend_page(Widget& child, const Glib::ustring& tab_label, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  return prepend_page(child, *pLabel);
}

int Notebook::prepend_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  Label* pLabelMenu = Gtk::manage( new Label(menu_label, use_mnemonic) );
  return prepend_page(child, *pLabel, *pLabelMenu);
}

int Notebook::append_page(Widget& child, const Glib::ustring& tab_label, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  return append_page(child, *pLabel);
}

int Notebook::append_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  Label* pLabelMenu = Gtk::manage( new Label(menu_label, use_mnemonic) );
  return append_page(child, *pLabel, *pLabelMenu);
}

int Notebook::insert_page(Widget& child, const Glib::ustring& tab_label, int position, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  return insert_page(child, *pLabel, position);
}

int Notebook::insert_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, int position, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  Label* pLabelMenu = Gtk::manage( new Label(menu_label, use_mnemonic) );
  return insert_page(child, *pLabel, *pLabelMenu, position);
}

void Notebook::remove_page(Widget& child)
{
  int pos = page_num(child);
  if(pos != -1)
    remove_page(pos);
}

int Notebook::prepend_page(Widget& child)
{
  return gtk_notebook_prepend_page(gobj(), child.gobj(), 0 /* see GTK+ docs */);
}

int Notebook::append_page(Widget& child)
{
  return gtk_notebook_append_page(gobj(), child.gobj(), 0 /* see GTK+ docs */);
}

int Notebook::insert_page(Widget& child, int position)
{
  return gtk_notebook_insert_page(gobj(), child.gobj(), 0 /* see GTK+ docs */, position);
}

} //namespace Gtk

namespace
{


static void Notebook_signal_switch_page_callback(GtkNotebook* self, GtkWidget* p0,guint p1,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,Widget*,guint > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
, p1);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Notebook_signal_switch_page_info =
{
  "switch_page",
  (GCallback) &Notebook_signal_switch_page_callback,
  (GCallback) &Notebook_signal_switch_page_callback
};


static void Notebook_signal_page_reordered_callback(GtkNotebook* self, GtkWidget* p0,guint p1,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,Widget*,guint > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
, p1);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Notebook_signal_page_reordered_info =
{
  "page_reordered",
  (GCallback) &Notebook_signal_page_reordered_callback,
  (GCallback) &Notebook_signal_page_reordered_callback
};


static void Notebook_signal_page_removed_callback(GtkNotebook* self, GtkWidget* p0,guint p1,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,Widget*,guint > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
, p1);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Notebook_signal_page_removed_info =
{
  "page_removed",
  (GCallback) &Notebook_signal_page_removed_callback,
  (GCallback) &Notebook_signal_page_removed_callback
};


static void Notebook_signal_page_added_callback(GtkNotebook* self, GtkWidget* p0,guint p1,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,Widget*,guint > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
, p1);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Notebook_signal_page_added_info =
{
  "page_added",
  (GCallback) &Notebook_signal_page_added_callback,
  (GCallback) &Notebook_signal_page_added_callback
};


} // anonymous namespace

// static
GType Glib::Value<Gtk::NotebookTab>::value_type()
{
  return gtk_notebook_tab_get_type();
}


namespace Glib
{

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

} /* namespace Glib */

namespace Gtk
{


/* The *_Class implementation: */

const Glib::Class& Notebook_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_ = &Notebook_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_notebook_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


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


  klass->switch_page = &switch_page_callback;
}


void Notebook_Class::switch_page_callback(GtkNotebook* self, GtkWidget* p0, guint p1)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_switch_page(Glib::wrap(p0)
, p1);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->switch_page)
    (*base->switch_page)(self, p0, p1);
}


Glib::ObjectBase* Notebook_Class::wrap_new(GObject* o)
{
  return manage(new Notebook((GtkNotebook*)(o)));

}


/* The implementation: */

Notebook::Notebook(const Glib::ConstructParams& construct_params)
:
  Gtk::Container(construct_params)
{
  }

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

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

Notebook::CppClassType Notebook::notebook_class_; // initialize static member

GType Notebook::get_type()
{
  return notebook_class_.init().get_type();
}


GType Notebook::get_base_type()
{
  return gtk_notebook_get_type();
}


Notebook::Notebook()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Gtk::Container(Glib::ConstructParams(notebook_class_.init()))
{
  

}

int Notebook::prepend_page(Widget& child, Widget& tab_label)
{
  return gtk_notebook_prepend_page(gobj(), (child).gobj(), (tab_label).gobj());
}

int Notebook::prepend_page(Widget& child, Widget& tab_label, Widget& menu_label)
{
  return gtk_notebook_prepend_page_menu(gobj(), (child).gobj(), (tab_label).gobj(), (menu_label).gobj());
}

int Notebook::append_page(Widget& child, Widget& tab_label)
{
  return gtk_notebook_append_page(gobj(), (child).gobj(), (tab_label).gobj());
}

int Notebook::append_page(Widget& child, Widget& tab_label, Widget& menu_label)
{
  return gtk_notebook_append_page_menu(gobj(), (child).gobj(), (tab_label).gobj(), (menu_label).gobj());
}

int Notebook::insert_page(Widget& child, Widget& tab_label, int position)
{
  return gtk_notebook_insert_page(gobj(), (child).gobj(), (tab_label).gobj(), position);
}

int Notebook::insert_page(Widget& child, Widget& tab_label, Widget& menu_label, int position)
{
  return gtk_notebook_insert_page_menu(gobj(), (child).gobj(), (tab_label).gobj(), (menu_label).gobj(), position);
}

void Notebook::remove_page(int page_num)
{
gtk_notebook_remove_page(gobj(), page_num); 
}

void Notebook::set_group_name(const Glib::ustring& group_name)
{
gtk_notebook_set_group_name(gobj(), group_name.c_str()); 
}

Glib::ustring Notebook::get_group_name() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_notebook_get_group_name(const_cast<GtkNotebook*>(gobj())));
}

int Notebook::get_current_page() const
{
  return gtk_notebook_get_current_page(const_cast<GtkNotebook*>(gobj()));
}

Widget* Notebook::get_nth_page(int page_num)
{
  return Glib::wrap(gtk_notebook_get_nth_page(gobj(), page_num));
}

const Widget* Notebook::get_nth_page(int page_num) const
{
  return const_cast<Notebook*>(this)->get_nth_page(page_num);
}

int Notebook::get_n_pages() const
{
  return gtk_notebook_get_n_pages(const_cast<GtkNotebook*>(gobj()));
}

int Notebook::page_num(const Widget& child) const
{
  return gtk_notebook_page_num(const_cast<GtkNotebook*>(gobj()), const_cast<GtkWidget*>((child).gobj()));
}

void Notebook::set_current_page(int page_num)
{
gtk_notebook_set_current_page(gobj(), page_num); 
}

void Notebook::next_page()
{
gtk_notebook_next_page(gobj()); 
}

void Notebook::prev_page()
{
gtk_notebook_prev_page(gobj()); 
}

void Notebook::set_show_border(bool show_border)
{
gtk_notebook_set_show_border(gobj(), static_cast<int>(show_border)); 
}

bool Notebook::get_show_border() const
{
  return gtk_notebook_get_show_border(const_cast<GtkNotebook*>(gobj()));
}

void Notebook::set_show_tabs(bool show_tabs)
{
gtk_notebook_set_show_tabs(gobj(), static_cast<int>(show_tabs)); 
}

bool Notebook::get_show_tabs() const
{
  return gtk_notebook_get_show_tabs(const_cast<GtkNotebook*>(gobj()));
}

void Notebook::set_tab_pos(PositionType pos)
{
gtk_notebook_set_tab_pos(gobj(), ((GtkPositionType)(pos))); 
}

PositionType Notebook::get_tab_pos() const
{
  return ((PositionType)(gtk_notebook_get_tab_pos(const_cast<GtkNotebook*>(gobj()))));
}

void Notebook::set_scrollable(bool scrollable)
{
gtk_notebook_set_scrollable(gobj(), static_cast<int>(scrollable)); 
}

bool Notebook::get_scrollable() const
{
  return gtk_notebook_get_scrollable(const_cast<GtkNotebook*>(gobj()));
}

guint16 Notebook::get_tab_hborder() const
{
  return gtk_notebook_get_tab_hborder(const_cast<GtkNotebook*>(gobj()));
}

guint16 Notebook::get_tab_vborder() const
{
  return gtk_notebook_get_tab_vborder(const_cast<GtkNotebook*>(gobj()));
}

void Notebook::popup_enable()
{
gtk_notebook_popup_enable(gobj()); 
}

void Notebook::popup_disable()
{
gtk_notebook_popup_disable(gobj()); 
}

Widget* Notebook::get_tab_label(Widget& child)
{
  return Glib::wrap(gtk_notebook_get_tab_label(gobj(), (child).gobj()));
}

const Widget* Notebook::get_tab_label(Widget& child) const
{
  return const_cast<Notebook*>(this)->get_tab_label(child);
}

void Notebook::set_tab_label(Widget& child, Widget& tab_label)
{
gtk_notebook_set_tab_label(gobj(), (child).gobj(), (tab_label).gobj()); 
}

void Notebook::set_tab_label_text(Widget& child, const Glib::ustring& tab_text)
{
gtk_notebook_set_tab_label_text(gobj(), (child).gobj(), tab_text.c_str()); 
}

Glib::ustring Notebook::get_tab_label_text(Widget& child) const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_notebook_get_tab_label_text(const_cast<GtkNotebook*>(gobj()), (child).gobj()));
}

Widget* Notebook::get_menu_label(Widget& child)
{
  return Glib::wrap(gtk_notebook_get_menu_label(gobj(), (child).gobj()));
}

const Widget* Notebook::get_menu_label(Widget& child) const
{
  return const_cast<Notebook*>(this)->get_menu_label(child);
}

void Notebook::set_menu_label(Widget& child, Widget& menu_label)
{
gtk_notebook_set_menu_label(gobj(), (child).gobj(), (menu_label).gobj()); 
}

void Notebook::set_menu_label_text(Widget& child, const Glib::ustring& menu_text)
{
gtk_notebook_set_menu_label_text(gobj(), (child).gobj(), menu_text.c_str()); 
}

Glib::ustring Notebook::get_menu_label_text(Widget& child) const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_notebook_get_menu_label_text(const_cast<GtkNotebook*>(gobj()), (child).gobj()));
}

void Notebook::reorder_child(Widget& child, int position)
{
gtk_notebook_reorder_child(gobj(), (child).gobj(), position); 
}

bool Notebook::get_tab_reorderable(Widget& child) const
{
  return gtk_notebook_get_tab_reorderable(const_cast<GtkNotebook*>(gobj()), (child).gobj());
}

void Notebook::set_tab_reorderable(Widget& child, bool reorderable)
{
gtk_notebook_set_tab_reorderable(gobj(), (child).gobj(), static_cast<int>(reorderable)); 
}

bool Notebook::get_tab_detachable(Widget& child) const
{
  return gtk_notebook_get_tab_detachable(const_cast<GtkNotebook*>(gobj()), (child).gobj());
}

void Notebook::set_tab_detachable(Widget& child, bool detachable)
{
gtk_notebook_set_tab_detachable(gobj(), (child).gobj(), static_cast<int>(detachable)); 
}

Widget* Notebook::get_action_widget(PackType pack_type)
{
  return Glib::wrap(gtk_notebook_get_action_widget(gobj(), ((GtkPackType)(pack_type))));
}

void Notebook::set_action_widget(Widget* widget, PackType pack_type)
{
gtk_notebook_set_action_widget(gobj(), (GtkWidget*)Glib::unwrap(widget), ((GtkPackType)(pack_type))); 
}


Glib::SignalProxy2< void,Widget*,guint > Notebook::signal_switch_page()
{
  return Glib::SignalProxy2< void,Widget*,guint >(this, &Notebook_signal_switch_page_info);
}


Glib::SignalProxy2< void,Widget*,guint > Notebook::signal_page_reordered()
{
  return Glib::SignalProxy2< void,Widget*,guint >(this, &Notebook_signal_page_reordered_info);
}


Glib::SignalProxy2< void,Widget*,guint > Notebook::signal_page_removed()
{
  return Glib::SignalProxy2< void,Widget*,guint >(this, &Notebook_signal_page_removed_info);
}


Glib::SignalProxy2< void,Widget*,guint > Notebook::signal_page_added()
{
  return Glib::SignalProxy2< void,Widget*,guint >(this, &Notebook_signal_page_added_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<PositionType> Notebook::property_tab_pos() 
{
  return Glib::PropertyProxy<PositionType>(this, "tab-pos");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<PositionType> Notebook::property_tab_pos() const
{
  return Glib::PropertyProxy_ReadOnly<PositionType>(this, "tab-pos");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Notebook::property_show_tabs() 
{
  return Glib::PropertyProxy<bool>(this, "show-tabs");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Notebook::property_show_tabs() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "show-tabs");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Notebook::property_show_border() 
{
  return Glib::PropertyProxy<bool>(this, "show-border");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Notebook::property_show_border() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "show-border");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Notebook::property_scrollable() 
{
  return Glib::PropertyProxy<bool>(this, "scrollable");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Notebook::property_scrollable() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "scrollable");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<int> Notebook::property_page() 
{
  return Glib::PropertyProxy<int>(this, "page");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<int> Notebook::property_page() const
{
  return Glib::PropertyProxy_ReadOnly<int>(this, "page");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Glib::ustring> Notebook::property_group_name() 
{
  return Glib::PropertyProxy<Glib::ustring>(this, "group-name");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Glib::ustring> Notebook::property_group_name() const
{
  return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "group-name");
}
#endif //GLIBMM_PROPERTIES_ENABLED


void Gtk::Notebook::on_switch_page(Widget* page, guint page_num)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->switch_page)
    (*base->switch_page)(gobj(),(GtkWidget*)Glib::unwrap(page),page_num);
}


} // namespace Gtk


