994 lines
26 KiB
C++
994 lines
26 KiB
C++
|
// Generated by gtkmmproc -- DO NOT MODIFY!
|
||
|
|
||
|
#include <gtkmm/combo.h>
|
||
|
#include <gtkmm/private/combo_p.h>
|
||
|
|
||
|
// -*- c++ -*-
|
||
|
/* $Id$ */
|
||
|
|
||
|
/*
|
||
|
*
|
||
|
* 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 Library General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2 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
|
||
|
* Library General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Library General Public
|
||
|
* License along with this library; if not, write to the Free
|
||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||
|
*/
|
||
|
|
||
|
//These were deprecated between 1.2 and 2.0:
|
||
|
#include <gtk/gtklistitem.h>
|
||
|
#include <gtk/gtklist.h>
|
||
|
|
||
|
#include <gtk/gtkcombo.h>
|
||
|
#include <gtk/gtklabel.h>
|
||
|
#include <gtkmm/entry.h>
|
||
|
#include <gtkmm/button.h>
|
||
|
#include <gtkmm/scrolledwindow.h>
|
||
|
#include <gtkmm/window.h>
|
||
|
#include <gtkmm/item.h>
|
||
|
|
||
|
namespace Gtk
|
||
|
{
|
||
|
|
||
|
namespace ComboDropDown_Helpers
|
||
|
{
|
||
|
|
||
|
ComboDropDownList::iterator ComboDropDownList::insert(ComboDropDownList::iterator position, const Element& item)
|
||
|
{
|
||
|
int pos = -1;
|
||
|
|
||
|
if(position.node_)
|
||
|
pos = g_list_position(glist(), position.node_);
|
||
|
|
||
|
// gtk+ inserts the GList node allocated by g_list_append into the list as is!
|
||
|
gtk_list_insert_items((GtkList*)gparent(), g_list_append(0, const_cast<GtkWidget*>(item.Widget::gobj())), pos);
|
||
|
|
||
|
return --position;
|
||
|
}
|
||
|
|
||
|
void ComboDropDownList::remove(const_reference child)
|
||
|
{
|
||
|
GList child_list;
|
||
|
child_list.data = (gpointer)child.gobj();
|
||
|
child_list.next = child_list.prev = 0;
|
||
|
gtk_list_remove_items(GTK_LIST(gparent_), &child_list);
|
||
|
}
|
||
|
|
||
|
ComboDropDownList::iterator ComboDropDownList::erase(iterator position)
|
||
|
{
|
||
|
//Check that it is a valid iterator, to a real item:
|
||
|
if ( !position.node_|| (position == end()) )
|
||
|
return end();
|
||
|
|
||
|
//Get an iterator the the next item, to return:
|
||
|
iterator next = position;
|
||
|
next++;
|
||
|
|
||
|
//Use GTK+ C function to remove it, by providing the GtkWidget*:
|
||
|
GList child_list;
|
||
|
child_list.data = (gpointer)position->gobj();
|
||
|
child_list.next = child_list.prev = 0;
|
||
|
gtk_list_remove_items(GTK_LIST(gparent_), &child_list);
|
||
|
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
} // namespace ComboList_Helpers
|
||
|
|
||
|
ComboDropDown::ComboDropDownList& ComboDropDown::children()
|
||
|
{
|
||
|
children_proxy_ = ComboDropDownList(gobj());
|
||
|
return children_proxy_;
|
||
|
}
|
||
|
|
||
|
const ComboDropDown::ComboDropDownList& ComboDropDown::children() const
|
||
|
{
|
||
|
children_proxy_ = ComboDropDownList(const_cast<GtkList*>(gobj()));
|
||
|
return children_proxy_;
|
||
|
}
|
||
|
|
||
|
} // namespace Gtk
|
||
|
|
||
|
|
||
|
namespace Gtk
|
||
|
{
|
||
|
|
||
|
void Combo::remove_item_string(Gtk::Item& item)
|
||
|
{
|
||
|
gtk_combo_set_item_string(gobj(), item.gobj(), 0);
|
||
|
}
|
||
|
|
||
|
Glib::ListHandle<Glib::ustring> Combo::get_popdown_strings() const
|
||
|
{
|
||
|
GList* popdown_strings = 0;
|
||
|
|
||
|
GList *const list_children =
|
||
|
gtk_container_get_children(reinterpret_cast<GtkContainer*>(gobj()->list));
|
||
|
|
||
|
for(const GList* node = list_children; node != 0; node = node->next)
|
||
|
{
|
||
|
GtkLabel *const label = reinterpret_cast<GtkLabel*>(
|
||
|
gtk_bin_get_child(static_cast<GtkBin*>(node->data)));
|
||
|
|
||
|
popdown_strings = g_list_prepend(
|
||
|
popdown_strings, const_cast<char*>(gtk_label_get_text(label)));
|
||
|
}
|
||
|
|
||
|
g_list_free(list_children);
|
||
|
popdown_strings = g_list_reverse(popdown_strings);
|
||
|
|
||
|
return Glib::ListHandle<Glib::ustring>(popdown_strings, Glib::OWNERSHIP_SHALLOW);
|
||
|
}
|
||
|
|
||
|
} // namespace Gtk
|
||
|
|
||
|
|
||
|
namespace
|
||
|
{
|
||
|
|
||
|
void ComboDropDownItem_signal_scroll_horizontal_callback(GtkListItem* self, GtkScrollType p0,gfloat p1,void* data)
|
||
|
{
|
||
|
using namespace Gtk;
|
||
|
typedef sigc::slot< void,ScrollType,float > SlotType;
|
||
|
|
||
|
// Do not try to call a signal on a disassociated wrapper.
|
||
|
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
|
||
|
(*static_cast<SlotType*>(slot))(((ScrollType)(p0))
|
||
|
, p1
|
||
|
);
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
Glib::exception_handlers_invoke();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const Glib::SignalProxyInfo ComboDropDownItem_signal_scroll_horizontal_info =
|
||
|
{
|
||
|
"scroll-horizontal",
|
||
|
(GCallback) &ComboDropDownItem_signal_scroll_horizontal_callback,
|
||
|
(GCallback) &ComboDropDownItem_signal_scroll_horizontal_callback
|
||
|
};
|
||
|
|
||
|
|
||
|
void ComboDropDownItem_signal_scroll_vertical_callback(GtkListItem* self, GtkScrollType p0,gfloat p1,void* data)
|
||
|
{
|
||
|
using namespace Gtk;
|
||
|
typedef sigc::slot< void,ScrollType,float > SlotType;
|
||
|
|
||
|
// Do not try to call a signal on a disassociated wrapper.
|
||
|
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
|
||
|
(*static_cast<SlotType*>(slot))(((ScrollType)(p0))
|
||
|
, p1
|
||
|
);
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
Glib::exception_handlers_invoke();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const Glib::SignalProxyInfo ComboDropDownItem_signal_scroll_vertical_info =
|
||
|
{
|
||
|
"scroll-vertical",
|
||
|
(GCallback) &ComboDropDownItem_signal_scroll_vertical_callback,
|
||
|
(GCallback) &ComboDropDownItem_signal_scroll_vertical_callback
|
||
|
};
|
||
|
|
||
|
|
||
|
void ComboDropDown_signal_select_child_callback(GtkList* self, GtkWidget* p0,void* data)
|
||
|
{
|
||
|
using namespace Gtk;
|
||
|
typedef sigc::slot< void,Widget& > SlotType;
|
||
|
|
||
|
// Do not try to call a signal on a disassociated wrapper.
|
||
|
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
|
||
|
(*static_cast<SlotType*>(slot))(*Glib::wrap(p0)
|
||
|
);
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
Glib::exception_handlers_invoke();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const Glib::SignalProxyInfo ComboDropDown_signal_select_child_info =
|
||
|
{
|
||
|
"select_child",
|
||
|
(GCallback) &ComboDropDown_signal_select_child_callback,
|
||
|
(GCallback) &ComboDropDown_signal_select_child_callback
|
||
|
};
|
||
|
|
||
|
|
||
|
const Glib::SignalProxyInfo ComboDropDown_signal_selection_changed_info =
|
||
|
{
|
||
|
"selection_changed",
|
||
|
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
|
||
|
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback
|
||
|
};
|
||
|
|
||
|
|
||
|
void ComboDropDown_signal_unselect_child_callback(GtkList* self, GtkWidget* p0,void* data)
|
||
|
{
|
||
|
using namespace Gtk;
|
||
|
typedef sigc::slot< void,Widget& > SlotType;
|
||
|
|
||
|
// Do not try to call a signal on a disassociated wrapper.
|
||
|
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
|
||
|
(*static_cast<SlotType*>(slot))(*Glib::wrap(p0)
|
||
|
);
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
Glib::exception_handlers_invoke();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const Glib::SignalProxyInfo ComboDropDown_signal_unselect_child_info =
|
||
|
{
|
||
|
"unselect_child",
|
||
|
(GCallback) &ComboDropDown_signal_unselect_child_callback,
|
||
|
(GCallback) &ComboDropDown_signal_unselect_child_callback
|
||
|
};
|
||
|
|
||
|
} // anonymous namespace
|
||
|
|
||
|
|
||
|
namespace Glib
|
||
|
{
|
||
|
|
||
|
Gtk::ComboDropDownItem* wrap(GtkListItem* object, bool take_copy)
|
||
|
{
|
||
|
return dynamic_cast<Gtk::ComboDropDownItem *> (Glib::wrap_auto ((GObject*)(object), take_copy));
|
||
|
}
|
||
|
|
||
|
} /* namespace Glib */
|
||
|
|
||
|
namespace Gtk
|
||
|
{
|
||
|
|
||
|
|
||
|
/* The *_Class implementation: */
|
||
|
|
||
|
const Glib::Class& ComboDropDownItem_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_ = &ComboDropDownItem_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_list_item_get_type());
|
||
|
|
||
|
// Add derived versions of interfaces, if the C type implements any interfaces:
|
||
|
}
|
||
|
|
||
|
return *this;
|
||
|
}
|
||
|
|
||
|
void ComboDropDownItem_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->scroll_horizontal = &scroll_horizontal_callback;
|
||
|
klass->scroll_vertical = &scroll_vertical_callback;
|
||
|
}
|
||
|
|
||
|
|
||
|
void ComboDropDownItem_Class::scroll_horizontal_callback(GtkListItem* self, GtkScrollType p0, gfloat p1)
|
||
|
{
|
||
|
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
|
||
|
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 && obj->is_derived_())
|
||
|
{
|
||
|
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_scroll_horizontal(((ScrollType)(p0))
|
||
|
, p1
|
||
|
);
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
Glib::exception_handlers_invoke();
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
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->scroll_horizontal)
|
||
|
(*base->scroll_horizontal)(self, p0, p1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ComboDropDownItem_Class::scroll_vertical_callback(GtkListItem* self, GtkScrollType p0, gfloat p1)
|
||
|
{
|
||
|
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
|
||
|
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 && obj->is_derived_())
|
||
|
{
|
||
|
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_scroll_vertical(((ScrollType)(p0))
|
||
|
, p1
|
||
|
);
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
Glib::exception_handlers_invoke();
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
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->scroll_vertical)
|
||
|
(*base->scroll_vertical)(self, p0, p1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
Glib::ObjectBase* ComboDropDownItem_Class::wrap_new(GObject* o)
|
||
|
{
|
||
|
return manage(new ComboDropDownItem((GtkListItem*)(o)));
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
/* The implementation: */
|
||
|
|
||
|
ComboDropDownItem::ComboDropDownItem(const Glib::ConstructParams& construct_params)
|
||
|
:
|
||
|
Gtk::Item(construct_params)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
ComboDropDownItem::ComboDropDownItem(GtkListItem* castitem)
|
||
|
:
|
||
|
Gtk::Item((GtkItem*)(castitem))
|
||
|
{
|
||
|
}
|
||
|
|
||
|
ComboDropDownItem::~ComboDropDownItem()
|
||
|
{
|
||
|
destroy_();
|
||
|
}
|
||
|
|
||
|
ComboDropDownItem::CppClassType ComboDropDownItem::combodropdownitem_class_; // initialize static member
|
||
|
|
||
|
GType ComboDropDownItem::get_type()
|
||
|
{
|
||
|
return combodropdownitem_class_.init().get_type();
|
||
|
}
|
||
|
|
||
|
GType ComboDropDownItem::get_base_type()
|
||
|
{
|
||
|
return gtk_list_item_get_type();
|
||
|
}
|
||
|
|
||
|
|
||
|
ComboDropDownItem::ComboDropDownItem()
|
||
|
:
|
||
|
Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
|
||
|
Gtk::Item(Glib::ConstructParams(combodropdownitem_class_.init()))
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
Glib::SignalProxy2< void,ScrollType,float > ComboDropDownItem::signal_scroll_horizontal()
|
||
|
{
|
||
|
return Glib::SignalProxy2< void,ScrollType,float >(this, &ComboDropDownItem_signal_scroll_horizontal_info);
|
||
|
}
|
||
|
|
||
|
Glib::SignalProxy2< void,ScrollType,float > ComboDropDownItem::signal_scroll_vertical()
|
||
|
{
|
||
|
return Glib::SignalProxy2< void,ScrollType,float >(this, &ComboDropDownItem_signal_scroll_vertical_info);
|
||
|
}
|
||
|
|
||
|
|
||
|
void Gtk::ComboDropDownItem::on_scroll_horizontal(ScrollType scroll_type, float position)
|
||
|
{
|
||
|
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->scroll_horizontal)
|
||
|
(*base->scroll_horizontal)(gobj(),((GtkScrollType)(scroll_type)),position);
|
||
|
}
|
||
|
|
||
|
void Gtk::ComboDropDownItem::on_scroll_vertical(ScrollType scroll_type, float position)
|
||
|
{
|
||
|
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->scroll_vertical)
|
||
|
(*base->scroll_vertical)(gobj(),((GtkScrollType)(scroll_type)),position);
|
||
|
}
|
||
|
|
||
|
|
||
|
} // namespace Gtk
|
||
|
|
||
|
|
||
|
namespace Glib
|
||
|
{
|
||
|
|
||
|
Gtk::ComboDropDown* wrap(GtkList* object, bool take_copy)
|
||
|
{
|
||
|
return dynamic_cast<Gtk::ComboDropDown *> (Glib::wrap_auto ((GObject*)(object), take_copy));
|
||
|
}
|
||
|
|
||
|
} /* namespace Glib */
|
||
|
|
||
|
namespace Gtk
|
||
|
{
|
||
|
|
||
|
|
||
|
/* The *_Class implementation: */
|
||
|
|
||
|
const Glib::Class& ComboDropDown_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_ = &ComboDropDown_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_list_get_type());
|
||
|
|
||
|
// Add derived versions of interfaces, if the C type implements any interfaces:
|
||
|
}
|
||
|
|
||
|
return *this;
|
||
|
}
|
||
|
|
||
|
void ComboDropDown_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->select_child = &select_child_callback;
|
||
|
klass->selection_changed = &selection_changed_callback;
|
||
|
klass->unselect_child = &unselect_child_callback;
|
||
|
}
|
||
|
|
||
|
|
||
|
void ComboDropDown_Class::select_child_callback(GtkList* self, GtkWidget* p0)
|
||
|
{
|
||
|
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
|
||
|
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 && obj->is_derived_())
|
||
|
{
|
||
|
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_select_child(*Glib::wrap(p0)
|
||
|
);
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
Glib::exception_handlers_invoke();
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
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->select_child)
|
||
|
(*base->select_child)(self, p0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ComboDropDown_Class::selection_changed_callback(GtkList* self)
|
||
|
{
|
||
|
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
|
||
|
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 && obj->is_derived_())
|
||
|
{
|
||
|
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_selection_changed();
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
Glib::exception_handlers_invoke();
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
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->selection_changed)
|
||
|
(*base->selection_changed)(self);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ComboDropDown_Class::unselect_child_callback(GtkList* self, GtkWidget* p0)
|
||
|
{
|
||
|
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
|
||
|
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 && obj->is_derived_())
|
||
|
{
|
||
|
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_unselect_child(*Glib::wrap(p0)
|
||
|
);
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
Glib::exception_handlers_invoke();
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
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->unselect_child)
|
||
|
(*base->unselect_child)(self, p0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
Glib::ObjectBase* ComboDropDown_Class::wrap_new(GObject* o)
|
||
|
{
|
||
|
return manage(new ComboDropDown((GtkList*)(o)));
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
/* The implementation: */
|
||
|
|
||
|
ComboDropDown::ComboDropDown(const Glib::ConstructParams& construct_params)
|
||
|
:
|
||
|
Gtk::Container(construct_params)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
ComboDropDown::ComboDropDown(GtkList* castitem)
|
||
|
:
|
||
|
Gtk::Container((GtkContainer*)(castitem))
|
||
|
{
|
||
|
}
|
||
|
|
||
|
ComboDropDown::~ComboDropDown()
|
||
|
{
|
||
|
destroy_();
|
||
|
}
|
||
|
|
||
|
ComboDropDown::CppClassType ComboDropDown::combodropdown_class_; // initialize static member
|
||
|
|
||
|
GType ComboDropDown::get_type()
|
||
|
{
|
||
|
return combodropdown_class_.init().get_type();
|
||
|
}
|
||
|
|
||
|
GType ComboDropDown::get_base_type()
|
||
|
{
|
||
|
return gtk_list_get_type();
|
||
|
}
|
||
|
|
||
|
|
||
|
namespace ComboDropDown_Helpers
|
||
|
{
|
||
|
|
||
|
ComboDropDownList::iterator ComboDropDownList::find(const_reference w)
|
||
|
{
|
||
|
iterator i = begin();
|
||
|
for(i = begin(); i != end() && (i->gobj() != w.gobj()); i++);
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
ComboDropDownList::iterator ComboDropDownList::find(Widget& w)
|
||
|
{
|
||
|
iterator i;
|
||
|
for(i = begin(); i != end() && ((GtkWidget*)i->gobj() != w.gobj()); i++);
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
} /* namespace ComboDropDown_Helpers */
|
||
|
|
||
|
|
||
|
namespace ComboDropDown_Helpers
|
||
|
{
|
||
|
|
||
|
ComboDropDownList::ComboDropDownList()
|
||
|
{}
|
||
|
|
||
|
ComboDropDownList::ComboDropDownList(GtkList* gparent)
|
||
|
: type_base((GObject*)gparent)
|
||
|
{}
|
||
|
|
||
|
ComboDropDownList::ComboDropDownList(const ComboDropDownList& src)
|
||
|
:
|
||
|
type_base(src)
|
||
|
{}
|
||
|
|
||
|
ComboDropDownList& ComboDropDownList::operator=(const ComboDropDownList& src)
|
||
|
{
|
||
|
type_base::operator=(src);
|
||
|
return *this;
|
||
|
}
|
||
|
|
||
|
GList*& ComboDropDownList::glist() const
|
||
|
{
|
||
|
return ((GtkList*)gparent_)->children;
|
||
|
}
|
||
|
|
||
|
void ComboDropDownList::erase(iterator start, iterator stop)
|
||
|
{
|
||
|
type_base::erase(start, stop);
|
||
|
}
|
||
|
|
||
|
GtkList* ComboDropDownList::gparent()
|
||
|
{
|
||
|
return (GtkList*)type_base::gparent();
|
||
|
}
|
||
|
|
||
|
const GtkList* ComboDropDownList::gparent() const
|
||
|
{
|
||
|
return (GtkList*)type_base::gparent();
|
||
|
}
|
||
|
|
||
|
ComboDropDownList::reference ComboDropDownList::operator[](size_type l) const
|
||
|
{
|
||
|
return type_base::operator[](l);
|
||
|
}
|
||
|
|
||
|
} /* namespace ComboDropDown_Helpers */
|
||
|
|
||
|
ComboDropDown::ComboDropDown()
|
||
|
:
|
||
|
Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
|
||
|
Gtk::Container(Glib::ConstructParams(combodropdown_class_.init()))
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void ComboDropDown::scroll_horizontal(ScrollType scroll_type, float position)
|
||
|
{
|
||
|
gtk_list_scroll_horizontal(gobj(), ((GtkScrollType)(scroll_type)), position);
|
||
|
}
|
||
|
|
||
|
void ComboDropDown::scroll_vertical(ScrollType scroll_type, float position)
|
||
|
{
|
||
|
gtk_list_scroll_vertical(gobj(), ((GtkScrollType)(scroll_type)), position);
|
||
|
}
|
||
|
|
||
|
|
||
|
Glib::SignalProxy1< void,Widget& > ComboDropDown::signal_select_child()
|
||
|
{
|
||
|
return Glib::SignalProxy1< void,Widget& >(this, &ComboDropDown_signal_select_child_info);
|
||
|
}
|
||
|
|
||
|
Glib::SignalProxy0< void > ComboDropDown::signal_selection_changed()
|
||
|
{
|
||
|
return Glib::SignalProxy0< void >(this, &ComboDropDown_signal_selection_changed_info);
|
||
|
}
|
||
|
|
||
|
Glib::SignalProxy1< void,Widget& > ComboDropDown::signal_unselect_child()
|
||
|
{
|
||
|
return Glib::SignalProxy1< void,Widget& >(this, &ComboDropDown_signal_unselect_child_info);
|
||
|
}
|
||
|
|
||
|
|
||
|
void Gtk::ComboDropDown::on_select_child(Widget& item)
|
||
|
{
|
||
|
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->select_child)
|
||
|
(*base->select_child)(gobj(),(item).gobj());
|
||
|
}
|
||
|
|
||
|
void Gtk::ComboDropDown::on_selection_changed()
|
||
|
{
|
||
|
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->selection_changed)
|
||
|
(*base->selection_changed)(gobj());
|
||
|
}
|
||
|
|
||
|
void Gtk::ComboDropDown::on_unselect_child(Widget& item)
|
||
|
{
|
||
|
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->unselect_child)
|
||
|
(*base->unselect_child)(gobj(),(item).gobj());
|
||
|
}
|
||
|
|
||
|
|
||
|
} // namespace Gtk
|
||
|
|
||
|
|
||
|
namespace Glib
|
||
|
{
|
||
|
|
||
|
Gtk::Combo* wrap(GtkCombo* object, bool take_copy)
|
||
|
{
|
||
|
return dynamic_cast<Gtk::Combo *> (Glib::wrap_auto ((GObject*)(object), take_copy));
|
||
|
}
|
||
|
|
||
|
} /* namespace Glib */
|
||
|
|
||
|
namespace Gtk
|
||
|
{
|
||
|
|
||
|
|
||
|
/* The *_Class implementation: */
|
||
|
|
||
|
const Glib::Class& Combo_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_ = &Combo_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_combo_get_type());
|
||
|
|
||
|
// Add derived versions of interfaces, if the C type implements any interfaces:
|
||
|
}
|
||
|
|
||
|
return *this;
|
||
|
}
|
||
|
|
||
|
void Combo_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);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
Glib::ObjectBase* Combo_Class::wrap_new(GObject* o)
|
||
|
{
|
||
|
return manage(new Combo((GtkCombo*)(o)));
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
/* The implementation: */
|
||
|
|
||
|
Combo::Combo(const Glib::ConstructParams& construct_params)
|
||
|
:
|
||
|
Gtk::HBox(construct_params)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
Combo::Combo(GtkCombo* castitem)
|
||
|
:
|
||
|
Gtk::HBox((GtkHBox*)(castitem))
|
||
|
{
|
||
|
}
|
||
|
|
||
|
Combo::~Combo()
|
||
|
{
|
||
|
destroy_();
|
||
|
}
|
||
|
|
||
|
Combo::CppClassType Combo::combo_class_; // initialize static member
|
||
|
|
||
|
GType Combo::get_type()
|
||
|
{
|
||
|
return combo_class_.init().get_type();
|
||
|
}
|
||
|
|
||
|
GType Combo::get_base_type()
|
||
|
{
|
||
|
return gtk_combo_get_type();
|
||
|
}
|
||
|
|
||
|
Combo::Combo()
|
||
|
:
|
||
|
Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
|
||
|
Gtk::HBox(Glib::ConstructParams(combo_class_.init()))
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void Combo::set_value_in_list(bool value, bool empty)
|
||
|
{
|
||
|
gtk_combo_set_value_in_list(gobj(), static_cast<int>(value), static_cast<int>(empty));
|
||
|
}
|
||
|
|
||
|
void Combo::set_use_arrows(bool arrows_on)
|
||
|
{
|
||
|
gtk_combo_set_use_arrows(gobj(), static_cast<int>(arrows_on));
|
||
|
}
|
||
|
|
||
|
void Combo::set_use_arrows_always(bool arrows_always)
|
||
|
{
|
||
|
gtk_combo_set_use_arrows_always(gobj(), static_cast<int>(arrows_always));
|
||
|
}
|
||
|
|
||
|
void Combo::set_case_sensitive(bool val)
|
||
|
{
|
||
|
gtk_combo_set_case_sensitive(gobj(), static_cast<int>(val));
|
||
|
}
|
||
|
|
||
|
void Combo::set_item_string(Gtk::Item& item, const Glib::ustring& item_value)
|
||
|
{
|
||
|
gtk_combo_set_item_string(gobj(), (item).gobj(), item_value.c_str());
|
||
|
}
|
||
|
|
||
|
void Combo::set_popdown_strings(const Glib::ListHandle<Glib::ustring>& strings)
|
||
|
{
|
||
|
gtk_combo_set_popdown_strings(gobj(), strings.data());
|
||
|
}
|
||
|
|
||
|
void Combo::disable_activate()
|
||
|
{
|
||
|
gtk_combo_disable_activate(gobj());
|
||
|
}
|
||
|
|
||
|
Entry* Combo::get_entry()
|
||
|
{
|
||
|
return Glib::wrap((GtkEntry*)(gobj()->entry));
|
||
|
}
|
||
|
|
||
|
const Entry* Combo::get_entry() const
|
||
|
{
|
||
|
return Glib::wrap((GtkEntry*)(gobj()->entry));
|
||
|
}
|
||
|
|
||
|
ComboDropDown* Combo::get_list()
|
||
|
{
|
||
|
return Glib::wrap((GtkList*)(gobj()->list));
|
||
|
}
|
||
|
|
||
|
const ComboDropDown* Combo::get_list() const
|
||
|
{
|
||
|
return Glib::wrap((GtkList*)(gobj()->list));
|
||
|
}
|
||
|
|
||
|
|
||
|
Glib::PropertyProxy<bool> Combo::property_enable_arrow_keys()
|
||
|
{
|
||
|
return Glib::PropertyProxy<bool>(this, "enable-arrow-keys");
|
||
|
}
|
||
|
|
||
|
Glib::PropertyProxy_ReadOnly<bool> Combo::property_enable_arrow_keys() const
|
||
|
{
|
||
|
return Glib::PropertyProxy_ReadOnly<bool>(this, "enable-arrow-keys");
|
||
|
}
|
||
|
|
||
|
Glib::PropertyProxy<bool> Combo::property_enable_arrows_always()
|
||
|
{
|
||
|
return Glib::PropertyProxy<bool>(this, "enable-arrows-always");
|
||
|
}
|
||
|
|
||
|
Glib::PropertyProxy_ReadOnly<bool> Combo::property_enable_arrows_always() const
|
||
|
{
|
||
|
return Glib::PropertyProxy_ReadOnly<bool>(this, "enable-arrows-always");
|
||
|
}
|
||
|
|
||
|
Glib::PropertyProxy<bool> Combo::property_case_sensitive()
|
||
|
{
|
||
|
return Glib::PropertyProxy<bool>(this, "case-sensitive");
|
||
|
}
|
||
|
|
||
|
Glib::PropertyProxy_ReadOnly<bool> Combo::property_case_sensitive() const
|
||
|
{
|
||
|
return Glib::PropertyProxy_ReadOnly<bool>(this, "case-sensitive");
|
||
|
}
|
||
|
|
||
|
Glib::PropertyProxy<bool> Combo::property_allow_empty()
|
||
|
{
|
||
|
return Glib::PropertyProxy<bool>(this, "allow-empty");
|
||
|
}
|
||
|
|
||
|
Glib::PropertyProxy_ReadOnly<bool> Combo::property_allow_empty() const
|
||
|
{
|
||
|
return Glib::PropertyProxy_ReadOnly<bool>(this, "allow-empty");
|
||
|
}
|
||
|
|
||
|
Glib::PropertyProxy<bool> Combo::property_value_in_list()
|
||
|
{
|
||
|
return Glib::PropertyProxy<bool>(this, "value-in-list");
|
||
|
}
|
||
|
|
||
|
Glib::PropertyProxy_ReadOnly<bool> Combo::property_value_in_list() const
|
||
|
{
|
||
|
return Glib::PropertyProxy_ReadOnly<bool>(this, "value-in-list");
|
||
|
}
|
||
|
|
||
|
|
||
|
} // namespace Gtk
|
||
|
|
||
|
|