1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/entry.h>
4 #include <gtkmm/private/entry_p.h>
11 * Copyright 1998-2002 The gtkmm Development Team
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <gtk/gtkentry.h>
34 void Entry_signal_populate_popup_callback(GtkEntry* self, GtkMenu* p0,void* data)
37 typedef sigc::slot< void,Menu* > SlotType;
39 // Do not try to call a signal on a disassociated wrapper.
40 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
44 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
45 (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
50 Glib::exception_handlers_invoke();
55 const Glib::SignalProxyInfo Entry_signal_populate_popup_info =
58 (GCallback) &Entry_signal_populate_popup_callback,
59 (GCallback) &Entry_signal_populate_popup_callback
63 void Entry_signal_insert_at_cursor_callback(GtkEntry* self, const gchar* p0,void* data)
66 typedef sigc::slot< void,const Glib::ustring& > SlotType;
68 // Do not try to call a signal on a disassociated wrapper.
69 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
73 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
74 (*static_cast<SlotType*>(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0)
79 Glib::exception_handlers_invoke();
84 const Glib::SignalProxyInfo Entry_signal_insert_at_cursor_info =
87 (GCallback) &Entry_signal_insert_at_cursor_callback,
88 (GCallback) &Entry_signal_insert_at_cursor_callback
92 const Glib::SignalProxyInfo Entry_signal_activate_info =
95 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
96 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
99 } // anonymous namespace
105 Gtk::Entry* wrap(GtkEntry* object, bool take_copy)
107 return dynamic_cast<Gtk::Entry *> (Glib::wrap_auto ((GObject*)(object), take_copy));
110 } /* namespace Glib */
116 /* The *_Class implementation: */
118 const Glib::Class& Entry_Class::init()
120 if(!gtype_) // create the GType if necessary
122 // Glib::Class has to know the class init function to clone custom types.
123 class_init_func_ = &Entry_Class::class_init_function;
125 // This is actually just optimized away, apparently with no harm.
126 // Make sure that the parent type has been created.
127 //CppClassParent::CppObjectType::get_type();
129 // Create the wrapper type, with the same class/instance size as the base type.
130 register_derived_type(gtk_entry_get_type());
132 // Add derived versions of interfaces, if the C type implements any interfaces:
133 Editable::add_interface(get_type());
134 CellEditable::add_interface(get_type());
140 void Entry_Class::class_init_function(void* g_class, void* class_data)
142 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
143 CppClassParent::class_init_function(klass, class_data);
145 klass->populate_popup = &populate_popup_callback;
146 klass->insert_at_cursor = &insert_at_cursor_callback;
147 klass->activate = &activate_callback;
151 void Entry_Class::populate_popup_callback(GtkEntry* self, GtkMenu* p0)
153 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
154 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
156 // Non-gtkmmproc-generated custom classes implicitly call the default
157 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
158 // generated classes can use this optimisation, which avoids the unnecessary
159 // parameter conversions if there is no possibility of the virtual function
161 if(obj && obj->is_derived_())
163 try // Trap C++ exceptions which would normally be lost because this is a C callback.
165 // Call the virtual member method, which derived classes might override.
166 obj->on_populate_popup(Glib::wrap(p0)
171 Glib::exception_handlers_invoke();
176 BaseClassType *const base = static_cast<BaseClassType*>(
177 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
180 // Call the original underlying C function:
181 if(base && base->populate_popup)
182 (*base->populate_popup)(self, p0);
186 void Entry_Class::insert_at_cursor_callback(GtkEntry* self, const gchar* p0)
188 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
189 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
191 // Non-gtkmmproc-generated custom classes implicitly call the default
192 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
193 // generated classes can use this optimisation, which avoids the unnecessary
194 // parameter conversions if there is no possibility of the virtual function
196 if(obj && obj->is_derived_())
198 try // Trap C++ exceptions which would normally be lost because this is a C callback.
200 // Call the virtual member method, which derived classes might override.
201 obj->on_insert_at_cursor(Glib::convert_const_gchar_ptr_to_ustring(p0)
206 Glib::exception_handlers_invoke();
211 BaseClassType *const base = static_cast<BaseClassType*>(
212 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
215 // Call the original underlying C function:
216 if(base && base->insert_at_cursor)
217 (*base->insert_at_cursor)(self, p0);
221 void Entry_Class::activate_callback(GtkEntry* self)
223 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
224 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
226 // Non-gtkmmproc-generated custom classes implicitly call the default
227 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
228 // generated classes can use this optimisation, which avoids the unnecessary
229 // parameter conversions if there is no possibility of the virtual function
231 if(obj && obj->is_derived_())
233 try // Trap C++ exceptions which would normally be lost because this is a C callback.
235 // Call the virtual member method, which derived classes might override.
240 Glib::exception_handlers_invoke();
245 BaseClassType *const base = static_cast<BaseClassType*>(
246 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
249 // Call the original underlying C function:
250 if(base && base->activate)
251 (*base->activate)(self);
256 Glib::ObjectBase* Entry_Class::wrap_new(GObject* o)
258 return manage(new Entry((GtkEntry*)(o)));
263 /* The implementation: */
265 Entry::Entry(const Glib::ConstructParams& construct_params)
267 Gtk::Widget(construct_params)
271 Entry::Entry(GtkEntry* castitem)
273 Gtk::Widget((GtkWidget*)(castitem))
282 Entry::CppClassType Entry::entry_class_; // initialize static member
284 GType Entry::get_type()
286 return entry_class_.init().get_type();
289 GType Entry::get_base_type()
291 return gtk_entry_get_type();
297 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
298 Gtk::Widget(Glib::ConstructParams(entry_class_.init()))
302 void Entry::set_visibility(bool visible)
304 gtk_entry_set_visibility(gobj(), static_cast<int>(visible));
307 bool Entry::get_visibility() const
309 return gtk_entry_get_visibility(const_cast<GtkEntry*>(gobj()));
312 void Entry::set_invisible_char(gunichar ch)
314 gtk_entry_set_invisible_char(gobj(), ch);
317 gunichar Entry::get_invisible_char() const
319 return gtk_entry_get_invisible_char(const_cast<GtkEntry*>(gobj()));
322 void Entry::set_has_frame(bool setting)
324 gtk_entry_set_has_frame(gobj(), static_cast<int>(setting));
327 bool Entry::get_has_frame() const
329 return gtk_entry_get_has_frame(const_cast<GtkEntry*>(gobj()));
332 void Entry::set_max_length(int max)
334 gtk_entry_set_max_length(gobj(), max);
337 int Entry::get_max_length() const
339 return gtk_entry_get_max_length(const_cast<GtkEntry*>(gobj()));
342 void Entry::set_activates_default(bool setting)
344 gtk_entry_set_activates_default(gobj(), static_cast<int>(setting));
347 gboolean Entry::get_activates_default() const
349 return gtk_entry_get_activates_default(const_cast<GtkEntry*>(gobj()));
352 void Entry::set_width_chars(int n_chars)
354 gtk_entry_set_width_chars(gobj(), n_chars);
357 int Entry::get_width_chars() const
359 return gtk_entry_get_width_chars(const_cast<GtkEntry*>(gobj()));
362 void Entry::set_text(const Glib::ustring & text)
364 gtk_entry_set_text(gobj(), text.c_str());
367 Glib::ustring Entry::get_text() const
369 return Glib::convert_const_gchar_ptr_to_ustring(gtk_entry_get_text(const_cast<GtkEntry*>(gobj())));
372 Glib::RefPtr<Pango::Layout> Entry::get_layout()
375 Glib::RefPtr<Pango::Layout> retvalue = Glib::wrap(gtk_entry_get_layout(gobj()));
378 retvalue->reference(); //The function does not do a ref for us.
382 Glib::RefPtr<const Pango::Layout> Entry::get_layout() const
385 Glib::RefPtr<const Pango::Layout> retvalue = Glib::wrap(gtk_entry_get_layout(const_cast<GtkEntry*>(gobj())));
388 retvalue->reference(); //The function does not do a ref for us.
392 void Entry::get_layout_offsets(int& x, int& y)
394 gtk_entry_get_layout_offsets(gobj(), &x, &y);
397 int Entry::layout_index_to_text_index(int layout_index) const
399 return gtk_entry_layout_index_to_text_index(const_cast<GtkEntry*>(gobj()), layout_index);
402 int Entry::text_index_to_layout_index(int text_index) const
404 return gtk_entry_text_index_to_layout_index(const_cast<GtkEntry*>(gobj()), text_index);
407 void Entry::set_alignment(float xalign)
409 gtk_entry_set_alignment(gobj(), xalign);
412 void Entry::set_alignment(AlignmentEnum xalign)
414 gtk_entry_set_alignment(gobj(), _gtkmm_align_float_from_enum(xalign));
417 float Entry::get_alignment() const
419 return gtk_entry_get_alignment(const_cast<GtkEntry*>(gobj()));
422 void Entry::set_completion(const Glib::RefPtr<EntryCompletion>& completion)
424 gtk_entry_set_completion(gobj(), Glib::unwrap(completion));
427 Glib::RefPtr<EntryCompletion> Entry::get_completion()
430 Glib::RefPtr<EntryCompletion> retvalue = Glib::wrap(gtk_entry_get_completion(gobj()));
433 retvalue->reference(); //The function does not do a ref for us.
437 Glib::RefPtr<const EntryCompletion> Entry::get_completion() const
440 Glib::RefPtr<const EntryCompletion> retvalue = Glib::wrap(gtk_entry_get_completion(const_cast<GtkEntry*>(gobj())));
443 retvalue->reference(); //The function does not do a ref for us.
447 guint16 Entry::get_text_length() const
449 return gobj()->text_length;
453 Glib::SignalProxy1< void,Menu* > Entry::signal_populate_popup()
455 return Glib::SignalProxy1< void,Menu* >(this, &Entry_signal_populate_popup_info);
458 Glib::SignalProxy1< void,const Glib::ustring& > Entry::signal_insert_at_cursor()
460 return Glib::SignalProxy1< void,const Glib::ustring& >(this, &Entry_signal_insert_at_cursor_info);
463 Glib::SignalProxy0< void > Entry::signal_activate()
465 return Glib::SignalProxy0< void >(this, &Entry_signal_activate_info);
469 Glib::PropertyProxy_ReadOnly<int> Entry::property_cursor_position() const
471 return Glib::PropertyProxy_ReadOnly<int>(this, "cursor-position");
474 Glib::PropertyProxy_ReadOnly<int> Entry::property_selection_bound() const
476 return Glib::PropertyProxy_ReadOnly<int>(this, "selection-bound");
479 Glib::PropertyProxy<bool> Entry::property_editable()
481 return Glib::PropertyProxy<bool>(this, "editable");
484 Glib::PropertyProxy_ReadOnly<bool> Entry::property_editable() const
486 return Glib::PropertyProxy_ReadOnly<bool>(this, "editable");
489 Glib::PropertyProxy<int> Entry::property_max_length()
491 return Glib::PropertyProxy<int>(this, "max-length");
494 Glib::PropertyProxy_ReadOnly<int> Entry::property_max_length() const
496 return Glib::PropertyProxy_ReadOnly<int>(this, "max-length");
499 Glib::PropertyProxy<bool> Entry::property_visibility()
501 return Glib::PropertyProxy<bool>(this, "visibility");
504 Glib::PropertyProxy_ReadOnly<bool> Entry::property_visibility() const
506 return Glib::PropertyProxy_ReadOnly<bool>(this, "visibility");
509 Glib::PropertyProxy<bool> Entry::property_has_frame()
511 return Glib::PropertyProxy<bool>(this, "has-frame");
514 Glib::PropertyProxy_ReadOnly<bool> Entry::property_has_frame() const
516 return Glib::PropertyProxy_ReadOnly<bool>(this, "has-frame");
519 Glib::PropertyProxy<gunichar> Entry::property_invisible_char()
521 return Glib::PropertyProxy<gunichar>(this, "invisible-char");
524 Glib::PropertyProxy_ReadOnly<gunichar> Entry::property_invisible_char() const
526 return Glib::PropertyProxy_ReadOnly<gunichar>(this, "invisible-char");
529 Glib::PropertyProxy<bool> Entry::property_activates_default()
531 return Glib::PropertyProxy<bool>(this, "activates-default");
534 Glib::PropertyProxy_ReadOnly<bool> Entry::property_activates_default() const
536 return Glib::PropertyProxy_ReadOnly<bool>(this, "activates-default");
539 Glib::PropertyProxy<int> Entry::property_width_chars()
541 return Glib::PropertyProxy<int>(this, "width-chars");
544 Glib::PropertyProxy_ReadOnly<int> Entry::property_width_chars() const
546 return Glib::PropertyProxy_ReadOnly<int>(this, "width-chars");
549 Glib::PropertyProxy_ReadOnly<int> Entry::property_scroll_offset() const
551 return Glib::PropertyProxy_ReadOnly<int>(this, "scroll-offset");
554 Glib::PropertyProxy<Glib::ustring> Entry::property_text()
556 return Glib::PropertyProxy<Glib::ustring>(this, "text");
559 Glib::PropertyProxy_ReadOnly<Glib::ustring> Entry::property_text() const
561 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "text");
565 void Gtk::Entry::on_populate_popup(Menu* menu)
567 BaseClassType *const base = static_cast<BaseClassType*>(
568 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
571 if(base && base->populate_popup)
572 (*base->populate_popup)(gobj(),(GtkMenu*)Glib::unwrap(menu));
575 void Gtk::Entry::on_insert_at_cursor(const Glib::ustring& str)
577 BaseClassType *const base = static_cast<BaseClassType*>(
578 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
581 if(base && base->insert_at_cursor)
582 (*base->insert_at_cursor)(gobj(),str.c_str());
585 void Gtk::Entry::on_activate()
587 BaseClassType *const base = static_cast<BaseClassType*>(
588 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
591 if(base && base->activate)
592 (*base->activate)(gobj());