Robin Gareus
ad51c7c2ba
This is intended mainly for GNU/Linux distros who will remove GTK2 support in the near future.
1230 lines
30 KiB
C++
1230 lines
30 KiB
C++
// Generated by gmmproc 2.45.3 -- DO NOT MODIFY!
|
|
|
|
#undef GTK_DISABLE_DEPRECATED
|
|
//Allow us to use the ->children struct field.
|
|
//TODO: We probably need to remove the entire STL-style children() API in a future ABI break.
|
|
#undef GSEAL_ENABLE
|
|
|
|
|
|
#include <glibmm.h>
|
|
|
|
#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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
#include <gtk/gtk.h>
|
|
#include <gtkmm/label.h>
|
|
#include <algorithm>
|
|
|
|
|
|
namespace
|
|
{
|
|
extern "C"
|
|
{
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
|
|
static GtkNotebook* SignalProxy_WindowCreation_gtk_callback(GtkNotebook*, GtkWidget* page,
|
|
int x, int y, void* data)
|
|
{
|
|
Gtk::Notebook::SlotWindowCreation *const
|
|
slot = static_cast<Gtk::Notebook::SlotWindowCreation*>(data);
|
|
try
|
|
{
|
|
return Glib::unwrap((*slot)(Glib::wrap(page), x, y));
|
|
}
|
|
catch (...)
|
|
{
|
|
Glib::exception_handlers_invoke();
|
|
}
|
|
return 0;
|
|
}
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
|
|
static void SignalProxy_WindowCreation_gtk_callback_destroy(void* data)
|
|
{
|
|
delete static_cast<Gtk::Notebook::SlotWindowCreation*>(data);
|
|
}
|
|
|
|
} // extern "C"
|
|
} // anonymous namespace
|
|
|
|
namespace Gtk
|
|
{
|
|
|
|
namespace Notebook_Helpers
|
|
{
|
|
|
|
/**** Gtk::Notebook_Helpers::PageIterator **********************************/
|
|
|
|
bool PageIterator::equal(const PageIterator& other) const
|
|
{
|
|
return (node_ == other.node_);
|
|
}
|
|
|
|
PageIterator::operator bool() const
|
|
{
|
|
return (node_ != 0);
|
|
}
|
|
|
|
PageIterator& PageIterator::operator++()
|
|
{
|
|
g_return_val_if_fail(node_ != 0, *this);
|
|
|
|
node_ = node_->next;
|
|
return *this;
|
|
}
|
|
|
|
const PageIterator PageIterator::operator++(int)
|
|
{
|
|
const PageIterator tmp (*this);
|
|
++*this;
|
|
return tmp;
|
|
}
|
|
|
|
PageIterator& PageIterator::operator--()
|
|
{
|
|
node_ = (node_) ? node_->prev : g_list_last(parent_->gobj()->children);
|
|
return *this;
|
|
}
|
|
|
|
const PageIterator PageIterator::operator--(int)
|
|
{
|
|
const PageIterator tmp (*this);
|
|
--*this;
|
|
return tmp;
|
|
}
|
|
|
|
|
|
/*********************************************************************
|
|
***** Page Properties
|
|
*********************************************************************/
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
|
|
int Page::get_page_num() const
|
|
{
|
|
return g_list_position(parent_->gobj()->children, node_);
|
|
}
|
|
|
|
Widget* Page::get_child() const
|
|
{
|
|
return parent_->get_nth_page(get_page_num());
|
|
}
|
|
|
|
Widget* Page::get_tab_label() const
|
|
{
|
|
return parent_->get_tab_label(*get_child());
|
|
}
|
|
|
|
void Page::set_tab_label(Widget& tab_label)
|
|
{
|
|
parent_->set_tab_label(*get_child(), tab_label);
|
|
}
|
|
|
|
void Page::set_tab_label_text(const Glib::ustring& tab_text)
|
|
{
|
|
parent_->set_tab_label_text(*get_child(), tab_text);
|
|
}
|
|
|
|
Glib::ustring Page::get_tab_label_text() const
|
|
{
|
|
return parent_->get_tab_label_text(*get_child());
|
|
}
|
|
|
|
Widget* Page::get_menu_label() const
|
|
{
|
|
return parent_->get_menu_label(*get_child());
|
|
}
|
|
|
|
void Page::set_menu_label(Widget& menu_label)
|
|
{
|
|
parent_->set_menu_label(*get_child(), menu_label);
|
|
}
|
|
|
|
void Page::set_menu_label_text(const Glib::ustring& menu_text)
|
|
{
|
|
parent_->set_menu_label_text(*get_child(), menu_text);
|
|
}
|
|
|
|
Glib::ustring Page::get_menu_label_text() const
|
|
{
|
|
return parent_->get_menu_label_text(*get_child());
|
|
}
|
|
|
|
void Page::query_tab_label_packing(bool& expand, bool& fill, PackType& pack_type)
|
|
{
|
|
parent_->query_tab_label_packing(*get_child(), expand, fill, pack_type);
|
|
}
|
|
|
|
void Page::set_tab_label_packing(bool expand, bool fill, PackType pack_type)
|
|
{
|
|
parent_->set_tab_label_packing(*get_child(), expand, fill, pack_type);
|
|
}
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
|
|
/*********************************************************************
|
|
***** List properties
|
|
*********************************************************************/
|
|
PageList::PageList()
|
|
:
|
|
gparent_ (0)
|
|
{}
|
|
|
|
PageList::PageList(GtkNotebook* gparent)
|
|
:
|
|
gparent_ (gparent)
|
|
{}
|
|
|
|
PageList::PageList(const PageList& src)
|
|
:
|
|
gparent_ (src.gparent_)
|
|
{}
|
|
|
|
PageList& PageList::operator=(const PageList& src)
|
|
{
|
|
gparent_ = src.gparent_;
|
|
return *this;
|
|
}
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
|
|
PageList::size_type PageList::max_size() const
|
|
{
|
|
return G_MAXINT;
|
|
}
|
|
|
|
bool PageList::empty() const
|
|
{
|
|
return (gparent_->children == 0);
|
|
}
|
|
|
|
PageList::size_type PageList::size() const
|
|
{
|
|
return g_list_length(gparent_->children);
|
|
}
|
|
|
|
PageList::value_type PageList::front() const
|
|
{
|
|
return *begin();
|
|
}
|
|
|
|
PageList::value_type PageList::back() const
|
|
{
|
|
return *--end();
|
|
}
|
|
|
|
PageList::value_type PageList::operator[](size_type index) const
|
|
{
|
|
GList *const node = g_list_nth(gparent_->children, index);
|
|
g_assert(node != 0);
|
|
|
|
return *iterator(Glib::wrap(gparent_), node);
|
|
}
|
|
|
|
PageList::iterator PageList::insert(PageList::iterator position, const Element& elem)
|
|
{
|
|
// Get the iterator index, or -1 for end().
|
|
const int index = (position) ? position->get_page_num() : -1;
|
|
|
|
// Give item to GTK+.
|
|
gtk_notebook_insert_page_menu(gparent_,
|
|
Glib::unwrap(elem.child_),
|
|
Glib::unwrap(elem.tab_),
|
|
Glib::unwrap(elem.menu_),
|
|
index);
|
|
|
|
// Return an iterator pointing to the inserted element.
|
|
return --position;
|
|
}
|
|
|
|
void PageList::erase(PageList::iterator start, PageList::iterator stop)
|
|
{
|
|
while(start != stop)
|
|
start = erase(start);
|
|
}
|
|
|
|
PageList::iterator PageList::erase(PageList::iterator position)
|
|
{
|
|
iterator next (position);
|
|
|
|
if(position)
|
|
{
|
|
++next;
|
|
gtk_container_remove(GTK_CONTAINER(gparent_), position->get_child()->gobj());
|
|
}
|
|
|
|
return next;
|
|
}
|
|
|
|
void PageList::remove(const_reference child)
|
|
{
|
|
// g_return_if_fail(child.parent_ != 0);
|
|
gtk_container_remove(GTK_CONTAINER(gparent_), child.get_child()->gobj());
|
|
}
|
|
|
|
void PageList::remove(Widget& widget)
|
|
{
|
|
gtk_container_remove(GTK_CONTAINER(gparent_), widget.gobj());
|
|
}
|
|
|
|
void PageList::reorder(PageList::iterator position, PageList::iterator page)
|
|
{
|
|
gtk_notebook_reorder_child(gparent(), page->get_child()->gobj(), position->get_page_num());
|
|
}
|
|
|
|
PageList::iterator PageList::find(int num)
|
|
{
|
|
if (num < 0)
|
|
return end();
|
|
iterator i = begin();
|
|
std::advance(i, num);
|
|
return i;
|
|
}
|
|
|
|
PageList::iterator PageList::find(const_reference c)
|
|
{
|
|
iterator i = begin();
|
|
while (i != end() && ((*i).get_child() != c.get_child()))
|
|
++i;
|
|
return i;
|
|
}
|
|
|
|
PageList::iterator PageList::find(Widget& widget)
|
|
{
|
|
iterator i = begin();
|
|
while (i != end() && ((*i).get_child() != &widget))
|
|
++i;
|
|
return i;
|
|
}
|
|
|
|
PageList::iterator PageList::find(GtkNotebookPage* page)
|
|
{
|
|
GList* node = gparent_->children;
|
|
|
|
while(node && node->data != page)
|
|
node = node->next;
|
|
|
|
return (node) ? iterator(Glib::wrap(gparent_), node) : end();
|
|
}
|
|
|
|
void PageList::clear()
|
|
{
|
|
erase(begin(), end());
|
|
}
|
|
|
|
PageList::iterator PageList::begin_() const
|
|
{
|
|
return iterator(Glib::wrap(gparent_), gparent_->children);
|
|
}
|
|
|
|
PageList::iterator PageList::end_() const
|
|
{
|
|
return iterator(Glib::wrap(gparent_), 0);
|
|
}
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
|
|
Element::Element(Widget* child, Widget* tab, Widget* menu)
|
|
:
|
|
child_ (child),
|
|
tab_ (tab),
|
|
menu_ (menu)
|
|
{}
|
|
|
|
Element::Element(Widget& child, Widget& tab, Widget& menu)
|
|
:
|
|
child_ (&child),
|
|
tab_ (&tab),
|
|
menu_ (&menu)
|
|
{}
|
|
|
|
Element::Element(Widget& child)
|
|
:
|
|
child_ (&child),
|
|
tab_ (0),
|
|
menu_ (0)
|
|
{}
|
|
|
|
TabElem::TabElem(Widget& child, Widget& tab)
|
|
:
|
|
Element(&child, &tab, 0)
|
|
{}
|
|
|
|
TabElem::TabElem(Widget& child, const Glib::ustring& label, bool mnemonic)
|
|
:
|
|
Element(&child, manage(new Label(label, mnemonic)), 0)
|
|
{}
|
|
|
|
MenuElem::MenuElem(Widget& child, Widget& menu)
|
|
:
|
|
Element(&child, 0, &menu)
|
|
{}
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
|
|
} /* namespace Notebook_Helpers */
|
|
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
|
|
Notebook::PageList::iterator Notebook::get_current()
|
|
{
|
|
return pages().find(get_current_page());
|
|
}
|
|
|
|
Notebook::PageList& Notebook::pages()
|
|
{
|
|
pages_proxy_ = PageList(gobj());
|
|
return pages_proxy_;
|
|
}
|
|
|
|
const Notebook::PageList& Notebook::pages() const
|
|
{
|
|
pages_proxy_ = PageList(const_cast<GtkNotebook*>(gobj()));
|
|
return pages_proxy_;
|
|
}
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
|
|
void Notebook::query_tab_label_packing(Widget& child, bool& expand, bool& fill, PackType& pack_type)
|
|
{
|
|
gboolean gexpand = false;
|
|
gboolean gfill = false;
|
|
GtkPackType gpack_type = GTK_PACK_START;
|
|
gtk_notebook_query_tab_label_packing(gobj(), child.gobj(), &gexpand, &gfill, &gpack_type);
|
|
expand = gexpand;
|
|
fill = gfill;
|
|
pack_type = (PackType)gpack_type;
|
|
}
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
|
|
typedef sigc::slot<Widget*, int, int> SlotWindowCreation;
|
|
|
|
void Notebook::set_window_creation_hook(const SlotWindowCreation& slot)
|
|
{
|
|
SlotWindowCreation* slot_copy = new SlotWindowCreation(slot);
|
|
gtk_notebook_set_window_creation_hook(&SignalProxy_WindowCreation_gtk_callback, slot_copy, &SignalProxy_WindowCreation_gtk_callback_destroy);
|
|
}
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
|
|
} //namespace Gtk
|
|
|
|
|
|
namespace
|
|
{
|
|
|
|
|
|
static void Notebook_signal_switch_page_callback(GtkNotebook* self, GtkNotebookPage* p0,guint p1,void* data)
|
|
{
|
|
using namespace Gtk;
|
|
typedef sigc::slot< void,GtkNotebookPage*,guint > SlotType;
|
|
|
|
Notebook* obj = dynamic_cast<Notebook*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
|
|
// Do not try to call a signal on a disassociated wrapper.
|
|
if(obj)
|
|
{
|
|
try
|
|
{
|
|
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
|
|
(*static_cast<SlotType*>(slot))(p0, p1);
|
|
}
|
|
catch(...)
|
|
{
|
|
Glib::exception_handlers_invoke();
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
|
|
Notebook* obj = dynamic_cast<Notebook*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
|
|
// Do not try to call a signal on a disassociated wrapper.
|
|
if(obj)
|
|
{
|
|
try
|
|
{
|
|
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
|
|
(*static_cast<SlotType*>(slot))(Glib::wrap(p0)
|
|
, p1);
|
|
}
|
|
catch(...)
|
|
{
|
|
Glib::exception_handlers_invoke();
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
|
|
Notebook* obj = dynamic_cast<Notebook*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
|
|
// Do not try to call a signal on a disassociated wrapper.
|
|
if(obj)
|
|
{
|
|
try
|
|
{
|
|
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
|
|
(*static_cast<SlotType*>(slot))(Glib::wrap(p0)
|
|
, p1);
|
|
}
|
|
catch(...)
|
|
{
|
|
Glib::exception_handlers_invoke();
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
|
|
Notebook* obj = dynamic_cast<Notebook*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
|
|
// Do not try to call a signal on a disassociated wrapper.
|
|
if(obj)
|
|
{
|
|
try
|
|
{
|
|
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
|
|
(*static_cast<SlotType*>(slot))(Glib::wrap(p0)
|
|
, p1);
|
|
}
|
|
catch(...)
|
|
{
|
|
Glib::exception_handlers_invoke();
|
|
}
|
|
}
|
|
}
|
|
|
|
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, GtkNotebookPage* 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.
|
|
{
|
|
try // Trap C++ exceptions which would normally be lost because this is a C callback.
|
|
{
|
|
// Call the virtual member method, which derived classes might override.
|
|
obj->on_switch_page(p0, p1);
|
|
return;
|
|
}
|
|
catch(...)
|
|
{
|
|
Glib::exception_handlers_invoke();
|
|
}
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
void Notebook::set_group_id(int group_id)
|
|
{
|
|
gtk_notebook_set_group_id(gobj(), group_id);
|
|
}
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
int Notebook::get_group_id() const
|
|
{
|
|
return gtk_notebook_get_group_id(const_cast<GtkNotebook*>(gobj()));
|
|
}
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
void Notebook::set_group(void* group)
|
|
{
|
|
gtk_notebook_set_group(gobj(), group);
|
|
}
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
void* Notebook::get_group()
|
|
{
|
|
return gtk_notebook_get_group(gobj());
|
|
}
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
const void* Notebook::get_group() const
|
|
{
|
|
return const_cast<Notebook*>(this)->get_group();
|
|
}
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
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);
|
|
}
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
int Notebook::get_n_pages()
|
|
{
|
|
return gtk_notebook_get_n_pages(gobj());
|
|
}
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
int Notebook::get_n_pages() const
|
|
{
|
|
return gtk_notebook_get_n_pages(const_cast<GtkNotebook*>(gobj()));
|
|
}
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
int Notebook::page_num(const Widget& child)
|
|
{
|
|
return gtk_notebook_page_num(gobj(), const_cast<GtkWidget*>((child).gobj()));
|
|
}
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
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()));
|
|
}
|
|
|
|
#ifndef GTKMM_DISABLE_DEPRECATED
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
void Notebook::set_tab_label_packing(Widget& child, bool expand, bool fill, PackType pack_type)
|
|
{
|
|
gtk_notebook_set_tab_label_packing(gobj(), (child).gobj(), static_cast<int>(expand), static_cast<int>(fill), ((GtkPackType)(pack_type)));
|
|
}
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
#endif // GTKMM_DISABLE_DEPRECATED
|
|
|
|
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,GtkNotebookPage*,guint > Notebook::signal_switch_page()
|
|
{
|
|
return Glib::SignalProxy2< void,GtkNotebookPage*,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);
|
|
}
|
|
|
|
|
|
Glib::PropertyProxy< PositionType > Notebook::property_tab_pos()
|
|
{
|
|
return Glib::PropertyProxy< PositionType >(this, "tab-pos");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< PositionType > Notebook::property_tab_pos() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< PositionType >(this, "tab-pos");
|
|
}
|
|
|
|
Glib::PropertyProxy< bool > Notebook::property_show_tabs()
|
|
{
|
|
return Glib::PropertyProxy< bool >(this, "show-tabs");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< bool > Notebook::property_show_tabs() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< bool >(this, "show-tabs");
|
|
}
|
|
|
|
Glib::PropertyProxy< bool > Notebook::property_show_border()
|
|
{
|
|
return Glib::PropertyProxy< bool >(this, "show-border");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< bool > Notebook::property_show_border() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< bool >(this, "show-border");
|
|
}
|
|
|
|
Glib::PropertyProxy< bool > Notebook::property_scrollable()
|
|
{
|
|
return Glib::PropertyProxy< bool >(this, "scrollable");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< bool > Notebook::property_scrollable() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< bool >(this, "scrollable");
|
|
}
|
|
|
|
Glib::PropertyProxy_WriteOnly< guint > Notebook::property_tab_border()
|
|
{
|
|
return Glib::PropertyProxy_WriteOnly< guint >(this, "tab-border");
|
|
}
|
|
|
|
Glib::PropertyProxy< guint > Notebook::property_tab_hborder()
|
|
{
|
|
return Glib::PropertyProxy< guint >(this, "tab-hborder");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< guint > Notebook::property_tab_hborder() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< guint >(this, "tab-hborder");
|
|
}
|
|
|
|
Glib::PropertyProxy< guint > Notebook::property_tab_vborder()
|
|
{
|
|
return Glib::PropertyProxy< guint >(this, "tab-vborder");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< guint > Notebook::property_tab_vborder() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< guint >(this, "tab-vborder");
|
|
}
|
|
|
|
Glib::PropertyProxy< int > Notebook::property_page()
|
|
{
|
|
return Glib::PropertyProxy< int >(this, "page");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< int > Notebook::property_page() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< int >(this, "page");
|
|
}
|
|
|
|
Glib::PropertyProxy< bool > Notebook::property_enable_popup()
|
|
{
|
|
return Glib::PropertyProxy< bool >(this, "enable-popup");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< bool > Notebook::property_enable_popup() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< bool >(this, "enable-popup");
|
|
}
|
|
|
|
Glib::PropertyProxy< bool > Notebook::property_homogeneous()
|
|
{
|
|
return Glib::PropertyProxy< bool >(this, "homogeneous");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< bool > Notebook::property_homogeneous() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< bool >(this, "homogeneous");
|
|
}
|
|
|
|
Glib::PropertyProxy< int > Notebook::property_group_id()
|
|
{
|
|
return Glib::PropertyProxy< int >(this, "group-id");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< int > Notebook::property_group_id() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< int >(this, "group-id");
|
|
}
|
|
|
|
Glib::PropertyProxy< void* > Notebook::property_group()
|
|
{
|
|
return Glib::PropertyProxy< void* >(this, "group");
|
|
}
|
|
|
|
Glib::PropertyProxy_ReadOnly< void* > Notebook::property_group() const
|
|
{
|
|
return Glib::PropertyProxy_ReadOnly< void* >(this, "group");
|
|
}
|
|
|
|
|
|
void Gtk::Notebook::on_switch_page(GtkNotebookPage* 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(),page,page_num);
|
|
}
|
|
|
|
|
|
} // namespace Gtk
|
|
|
|
|