13
0
livetrax/libs/gtkmm2/gtk/gtkmm/editable.cc

771 lines
25 KiB
C++
Raw Normal View History

// Generated by gtkmmproc -- DO NOT MODIFY!
#include <gtkmm/editable.h>
#include <gtkmm/private/editable_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.
*/
#include <gtk/gtkeditable.h>
namespace
{
void Editable_signal_insert_text_callback(GtkEditable* self, const gchar* text,gint length,gint* position,void* data)
{
using namespace Gtk;
typedef sigc::slot< void,const Glib::ustring&,int* > 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::ustring(text, text + length), position);
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
const Glib::SignalProxyInfo Editable_signal_insert_text_info =
{
"insert_text",
(GCallback) &Editable_signal_insert_text_callback,
(GCallback) &Editable_signal_insert_text_callback
};
void Editable_signal_delete_text_callback(GtkEditable* self, gint start_pos,gint end_pos,void* data)
{
using namespace Gtk;
typedef sigc::slot< void,int,int > 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))(start_pos
, end_pos
);
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
const Glib::SignalProxyInfo Editable_signal_delete_text_info =
{
"delete_text",
(GCallback) &Editable_signal_delete_text_callback,
(GCallback) &Editable_signal_delete_text_callback
};
const Glib::SignalProxyInfo Editable_signal_changed_info =
{
"changed",
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};
} // anonymous namespace
namespace Glib
{
Glib::RefPtr<Gtk::Editable> wrap(GtkEditable* object, bool take_copy)
{
return Glib::RefPtr<Gtk::Editable>( dynamic_cast<Gtk::Editable*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
//We use dynamic_cast<> in case of multiple inheritance.
}
} // namespace Glib
namespace Gtk
{
/* The *_Class implementation: */
const Glib::Interface_Class& Editable_Class::init()
{
if(!gtype_) // create the GType if necessary
{
// Glib::Interface_Class has to know the interface init function
// in order to add interfaces to implementing types.
class_init_func_ = &Editable_Class::iface_init_function;
// We can not derive from another interface, and it is not necessary anyway.
gtype_ = gtk_editable_get_type();
}
return *this;
}
void Editable_Class::iface_init_function(void* g_iface, void*)
{
BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
//This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
//This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
g_assert(klass != 0);
klass->do_insert_text = &do_insert_text_vfunc_callback;
klass->do_delete_text = &do_delete_text_vfunc_callback;
klass->get_chars = &get_chars_vfunc_callback;
klass->set_selection_bounds = &set_selection_bounds_vfunc_callback;
klass->get_selection_bounds = &get_selection_bounds_vfunc_callback;
klass->set_position = &set_position_vfunc_callback;
klass->get_position = &get_position_vfunc_callback;
klass->insert_text = &insert_text_callback;
klass->delete_text = &delete_text_callback;
klass->changed = &changed_callback;
}
void Editable_Class::do_insert_text_vfunc_callback(GtkEditable* self, const gchar* text, gint length, gint* position)
{
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->insert_text_vfunc( Glib::ustring(text, text + length), *position);
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->do_insert_text)
(*base->do_insert_text)( self, text, length, position);
}
}
void Editable_Class::do_delete_text_vfunc_callback(GtkEditable* self, gint start_pos, gint end_pos)
{
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->delete_text_vfunc(start_pos
, end_pos
);
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->do_delete_text)
(*base->do_delete_text)(self, start_pos, end_pos);
}
}
gchar* Editable_Class::get_chars_vfunc_callback(GtkEditable* self, gint start_pos, gint end_pos)
{
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.
return g_strdup((obj->get_chars_vfunc(start_pos
, end_pos
)).c_str());
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->get_chars)
return (*base->get_chars)(self, start_pos, end_pos);
}
typedef gchar* RType;
return RType();
}
void Editable_Class::set_selection_bounds_vfunc_callback(GtkEditable* self, gint start_pos, gint end_pos)
{
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->select_region_vfunc(start_pos
, end_pos
);
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->set_selection_bounds)
(*base->set_selection_bounds)(self, start_pos, end_pos);
}
}
gboolean Editable_Class::get_selection_bounds_vfunc_callback(GtkEditable* self, gint* start_pos, gint* end_pos)
{
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.
return static_cast<int>(obj->get_selection_bounds_vfunc(*(start_pos)
, *(end_pos)
));
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->get_selection_bounds)
return (*base->get_selection_bounds)(self, start_pos, end_pos);
}
typedef gboolean RType;
return RType();
}
void Editable_Class::set_position_vfunc_callback(GtkEditable* self, gint position)
{
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->set_position_vfunc(position
);
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->set_position)
(*base->set_position)(self, position);
}
}
gint Editable_Class::get_position_vfunc_callback(GtkEditable* 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.
return obj->get_position_vfunc();
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->get_position)
return (*base->get_position)(self);
}
typedef gint RType;
return RType();
}
void Editable_Class::insert_text_callback(GtkEditable* self, const gchar* text, gint length, gint* position)
{
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_insert_text( Glib::ustring(text, text + length), position);
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->insert_text)
(*base->insert_text)( self, text, length, position);
}
}
void Editable_Class::delete_text_callback(GtkEditable* self, gint start_pos, gint end_pos)
{
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_delete_text(start_pos
, end_pos
);
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->delete_text)
(*base->delete_text)(self, start_pos, end_pos);
}
}
void Editable_Class::changed_callback(GtkEditable* 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_changed();
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->changed)
(*base->changed)(self);
}
}
Glib::ObjectBase* Editable_Class::wrap_new(GObject* object)
{
return new Editable((GtkEditable*)(object));
}
/* The implementation: */
Editable::Editable()
:
Glib::Interface(editable_class_.init())
{}
Editable::Editable(GtkEditable* castitem)
:
Glib::Interface((GObject*)(castitem))
{}
Editable::~Editable()
{}
// static
void Editable::add_interface(GType gtype_implementer)
{
editable_class_.init().add_interface(gtype_implementer);
}
Editable::CppClassType Editable::editable_class_; // initialize static member
GType Editable::get_type()
{
return editable_class_.init().get_type();
}
GType Editable::get_base_type()
{
return gtk_editable_get_type();
}
void Editable::cut_clipboard()
{
gtk_editable_cut_clipboard(gobj());
}
void Editable::copy_clipboard()
{
gtk_editable_copy_clipboard(gobj());
}
void Editable::paste_clipboard()
{
gtk_editable_paste_clipboard(gobj());
}
void Editable::delete_selection()
{
gtk_editable_delete_selection(gobj());
}
void Editable::set_editable(bool is_editable)
{
gtk_editable_set_editable(gobj(), static_cast<int>(is_editable));
}
bool Editable::get_editable() const
{
return gtk_editable_get_editable(const_cast<GtkEditable*>(gobj()));
}
void Editable::insert_text(const Glib::ustring& text, int length, int& position)
{
gtk_editable_insert_text(gobj(), text.c_str(), length, &position);
}
void Editable::delete_text(int start_pos, int end_pos)
{
gtk_editable_delete_text(gobj(), start_pos, end_pos);
}
Glib::ustring Editable::get_chars(int start_pos, int end_pos) const
{
return Glib::convert_return_gchar_ptr_to_ustring(gtk_editable_get_chars(const_cast<GtkEditable*>(gobj()), start_pos, end_pos));
}
void Editable::select_region(int start_pos, int end_pos)
{
gtk_editable_select_region(gobj(), start_pos, end_pos);
}
bool Editable::get_selection_bounds(int& start_pos, int& end_pos) const
{
return gtk_editable_get_selection_bounds(const_cast<GtkEditable*>(gobj()), &start_pos, &end_pos);
}
void Editable::set_position(int position)
{
gtk_editable_set_position(gobj(), position);
}
int Editable::get_position() const
{
return gtk_editable_get_position(const_cast<GtkEditable*>(gobj()));
}
Glib::SignalProxy2< void,const Glib::ustring&,int* > Editable::signal_insert_text()
{
return Glib::SignalProxy2< void,const Glib::ustring&,int* >(this, &Editable_signal_insert_text_info);
}
Glib::SignalProxy2< void,int,int > Editable::signal_delete_text()
{
return Glib::SignalProxy2< void,int,int >(this, &Editable_signal_delete_text_info);
}
Glib::SignalProxy0< void > Editable::signal_changed()
{
return Glib::SignalProxy0< void >(this, &Editable_signal_changed_info);
}
void Gtk::Editable::on_insert_text(const Glib::ustring& text, int* position)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->insert_text)
(*base->insert_text)(gobj(),text.data(),text.bytes(),position);
}
void Gtk::Editable::on_delete_text(int start_pos, int end_pos)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->delete_text)
(*base->delete_text)(gobj(),start_pos,end_pos);
}
void Gtk::Editable::on_changed()
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->changed)
(*base->changed)(gobj());
}
void Gtk::Editable::insert_text_vfunc(const Glib::ustring& text, int& position)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->do_insert_text)
(*base->do_insert_text)(gobj(),text.data(),text.bytes(),&position);
}
void Gtk::Editable::delete_text_vfunc(int start_pos, int end_pos)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->do_delete_text)
(*base->do_delete_text)(gobj(),start_pos,end_pos);
}
Glib::ustring Gtk::Editable::get_chars_vfunc(int start_pos, int end_pos) const
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->get_chars)
return Glib::convert_const_gchar_ptr_to_ustring((*base->get_chars)(const_cast<GtkEditable*>(gobj()),start_pos,end_pos));
typedef Glib::ustring RType;
return RType();
}
void Gtk::Editable::select_region_vfunc(int start_pos, int end_pos)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->set_selection_bounds)
(*base->set_selection_bounds)(gobj(),start_pos,end_pos);
}
bool Gtk::Editable::get_selection_bounds_vfunc(int& start_pos, int& end_pos) const
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->get_selection_bounds)
return (*base->get_selection_bounds)(const_cast<GtkEditable*>(gobj()),&start_pos,&end_pos);
typedef bool RType;
return RType();
}
void Gtk::Editable::set_position_vfunc(int position)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->set_position)
(*base->set_position)(gobj(),position);
}
int Gtk::Editable::get_position_vfunc() const
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->get_position)
return (*base->get_position)(const_cast<GtkEditable*>(gobj()));
typedef int RType;
return RType();
}
} // namespace Gtk