1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/cellrenderer.h>
4 #include <gtkmm/private/cellrenderer_p.h>
6 #include <gtk/gtktypebuiltins.h>
10 /* Copyright 1998-2002 The gtkmm Development Team
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <gtk/gtkcellrenderer.h>
32 void CellRenderer::get_size(Widget& widget, int& x_offset, int& y_offset, int& width, int& height) const
34 gtk_cell_renderer_get_size(const_cast<GtkCellRenderer*>(gobj()), widget.gobj(), 0, &x_offset, &y_offset, &width, &height);
37 Glib::PropertyProxy_Base CellRenderer::_property_renderable()
39 g_assert_not_reached();
40 return Glib::PropertyProxy<int>(0, 0); // shut up warnings
49 const Glib::SignalProxyInfo CellRenderer_signal_editing_canceled_info =
52 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
53 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
57 void CellRenderer_signal_editing_started_callback(GtkCellRenderer* self, GtkCellEditable* p0,const gchar* p1,void* data)
60 typedef sigc::slot< void,CellEditable*,const Glib::ustring& > SlotType;
62 // Do not try to call a signal on a disassociated wrapper.
63 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
67 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
68 (*static_cast<SlotType*>(slot))(dynamic_cast<CellEditable*>(Glib::wrap_auto((GObject*)(p0), false))
69 , Glib::convert_const_gchar_ptr_to_ustring(p1)
74 Glib::exception_handlers_invoke();
79 const Glib::SignalProxyInfo CellRenderer_signal_editing_started_info =
82 (GCallback) &CellRenderer_signal_editing_started_callback,
83 (GCallback) &CellRenderer_signal_editing_started_callback
86 } // anonymous namespace
89 GType Glib::Value<Gtk::CellRendererState>::value_type()
91 return gtk_cell_renderer_state_get_type();
95 GType Glib::Value<Gtk::CellRendererMode>::value_type()
97 return gtk_cell_renderer_mode_get_type();
104 Gtk::CellRenderer* wrap(GtkCellRenderer* object, bool take_copy)
106 return dynamic_cast<Gtk::CellRenderer *> (Glib::wrap_auto ((GObject*)(object), take_copy));
109 } /* namespace Glib */
115 /* The *_Class implementation: */
117 const Glib::Class& CellRenderer_Class::init()
119 if(!gtype_) // create the GType if necessary
121 // Glib::Class has to know the class init function to clone custom types.
122 class_init_func_ = &CellRenderer_Class::class_init_function;
124 // This is actually just optimized away, apparently with no harm.
125 // Make sure that the parent type has been created.
126 //CppClassParent::CppObjectType::get_type();
128 // Create the wrapper type, with the same class/instance size as the base type.
129 register_derived_type(gtk_cell_renderer_get_type());
131 // Add derived versions of interfaces, if the C type implements any interfaces:
137 void CellRenderer_Class::class_init_function(void* g_class, void* class_data)
139 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
140 CppClassParent::class_init_function(klass, class_data);
142 klass->get_size = &get_size_vfunc_callback;
143 klass->render = &render_vfunc_callback;
144 klass->activate = &activate_vfunc_callback;
145 klass->start_editing = &start_editing_vfunc_callback;
146 klass->editing_canceled = &editing_canceled_callback;
149 void CellRenderer_Class::get_size_vfunc_callback(GtkCellRenderer* self, GtkWidget* widget, GdkRectangle* cell_area, gint* x_offset, gint* y_offset, gint* width, gint* height)
151 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
152 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
154 // Non-gtkmmproc-generated custom classes implicitly call the default
155 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
156 // generated classes can use this optimisation, which avoids the unnecessary
157 // parameter conversions if there is no possibility of the virtual function
159 if(obj && obj->is_derived_())
161 try // Trap C++ exceptions which would normally be lost because this is a C callback.
163 // Call the virtual member method, which derived classes might override.
164 obj->get_size_vfunc(*Glib::wrap(widget)
165 , &Glib::wrap(cell_area)
174 Glib::exception_handlers_invoke();
179 BaseClassType *const base = static_cast<BaseClassType*>(
180 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
183 // Call the original underlying C function:
184 if(base && base->get_size)
185 (*base->get_size)(self, widget, cell_area, x_offset, y_offset, width, height);
189 void CellRenderer_Class::render_vfunc_callback(GtkCellRenderer* self, GdkDrawable* window, GtkWidget* widget, GdkRectangle* background_area, GdkRectangle* cell_area, GdkRectangle* expose_area, GtkCellRendererState flags)
191 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
192 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
194 // Non-gtkmmproc-generated custom classes implicitly call the default
195 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
196 // generated classes can use this optimisation, which avoids the unnecessary
197 // parameter conversions if there is no possibility of the virtual function
199 if(obj && obj->is_derived_())
201 try // Trap C++ exceptions which would normally be lost because this is a C callback.
203 // Call the virtual member method, which derived classes might override.
204 obj->render_vfunc(Glib::wrap(window, true)
205 , *Glib::wrap(widget)
206 , Glib::wrap(background_area)
207 , Glib::wrap(cell_area)
208 , Glib::wrap(expose_area)
209 , ((CellRendererState)(flags))
214 Glib::exception_handlers_invoke();
219 BaseClassType *const base = static_cast<BaseClassType*>(
220 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
223 // Call the original underlying C function:
224 if(base && base->render)
225 (*base->render)(self, window, widget, background_area, cell_area, expose_area, flags);
229 gboolean CellRenderer_Class::activate_vfunc_callback(GtkCellRenderer* self, GdkEvent* event, GtkWidget* widget, const gchar* path, GdkRectangle* background_area, GdkRectangle* cell_area, GtkCellRendererState flags)
231 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
232 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
234 // Non-gtkmmproc-generated custom classes implicitly call the default
235 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
236 // generated classes can use this optimisation, which avoids the unnecessary
237 // parameter conversions if there is no possibility of the virtual function
239 if(obj && obj->is_derived_())
241 try // Trap C++ exceptions which would normally be lost because this is a C callback.
243 // Call the virtual member method, which derived classes might override.
244 return static_cast<int>(obj->activate_vfunc(event, *Glib::wrap(widget)
245 , Glib::convert_const_gchar_ptr_to_ustring(path)
246 , Glib::wrap(background_area)
247 , Glib::wrap(cell_area)
248 , ((CellRendererState)(flags))
253 Glib::exception_handlers_invoke();
258 BaseClassType *const base = static_cast<BaseClassType*>(
259 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
262 // Call the original underlying C function:
263 if(base && base->activate)
264 return (*base->activate)(self, event, widget, path, background_area, cell_area, flags);
267 typedef gboolean RType;
271 GtkCellEditable* CellRenderer_Class::start_editing_vfunc_callback(GtkCellRenderer* self, GdkEvent* event, GtkWidget* widget, const gchar* path, GdkRectangle* background_area, GdkRectangle* cell_area, GtkCellRendererState flags)
273 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
274 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
276 // Non-gtkmmproc-generated custom classes implicitly call the default
277 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
278 // generated classes can use this optimisation, which avoids the unnecessary
279 // parameter conversions if there is no possibility of the virtual function
281 if(false) //obj && obj->is_derived_())
283 try // Trap C++ exceptions which would normally be lost because this is a C callback.
285 // Call the virtual member method, which derived classes might override.
286 return Glib::unwrap(obj->start_editing_vfunc(event, *Glib::wrap(widget)
287 , Glib::convert_const_gchar_ptr_to_ustring(path)
288 , Glib::wrap(background_area)
289 , Glib::wrap(cell_area)
290 , ((CellRendererState)(flags))
295 Glib::exception_handlers_invoke();
300 BaseClassType *const base = static_cast<BaseClassType*>(
301 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
304 // Call the original underlying C function:
305 if(base && base->start_editing)
306 return (*base->start_editing)(self, event, widget, path, background_area, cell_area, flags);
309 typedef GtkCellEditable* RType;
314 void CellRenderer_Class::editing_canceled_callback(GtkCellRenderer* self)
316 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
317 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
319 // Non-gtkmmproc-generated custom classes implicitly call the default
320 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
321 // generated classes can use this optimisation, which avoids the unnecessary
322 // parameter conversions if there is no possibility of the virtual function
324 if(obj && obj->is_derived_())
326 try // Trap C++ exceptions which would normally be lost because this is a C callback.
328 // Call the virtual member method, which derived classes might override.
329 obj->on_editing_canceled();
333 Glib::exception_handlers_invoke();
338 BaseClassType *const base = static_cast<BaseClassType*>(
339 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
342 // Call the original underlying C function:
343 if(base && base->editing_canceled)
344 (*base->editing_canceled)(self);
349 Glib::ObjectBase* CellRenderer_Class::wrap_new(GObject* o)
351 return manage(new CellRenderer((GtkCellRenderer*)(o)));
356 /* The implementation: */
358 CellRenderer::CellRenderer(const Glib::ConstructParams& construct_params)
360 Gtk::Object(construct_params)
364 CellRenderer::CellRenderer(GtkCellRenderer* castitem)
366 Gtk::Object((GtkObject*)(castitem))
370 CellRenderer::~CellRenderer()
375 CellRenderer::CppClassType CellRenderer::cellrenderer_class_; // initialize static member
377 GType CellRenderer::get_type()
379 return cellrenderer_class_.init().get_type();
382 GType CellRenderer::get_base_type()
384 return gtk_cell_renderer_get_type();
388 void CellRenderer::get_size(Widget& widget, const Gdk::Rectangle& cell_area, int& x_offset, int& y_offset, int& width, int& height) const
390 gtk_cell_renderer_get_size(const_cast<GtkCellRenderer*>(gobj()), (widget).gobj(), const_cast<GdkRectangle*>(cell_area.gobj()), &x_offset, &y_offset, &width, &height);
393 void CellRenderer::render(const Glib::RefPtr<Gdk::Window>& window, Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, CellRendererState flags)
395 gtk_cell_renderer_render(gobj(), Glib::unwrap(window), (widget).gobj(), const_cast<GdkRectangle*>(background_area.gobj()), const_cast<GdkRectangle*>(cell_area.gobj()), const_cast<GdkRectangle*>(expose_area.gobj()), ((GtkCellRendererState)(flags)));
398 bool CellRenderer::activate(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags)
400 return gtk_cell_renderer_activate(gobj(), event, (widget).gobj(), path.c_str(), const_cast<GdkRectangle*>(background_area.gobj()), const_cast<GdkRectangle*>(cell_area.gobj()), ((GtkCellRendererState)(flags)));
403 CellEditable* CellRenderer::start_editing(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags)
405 return dynamic_cast<CellEditable*>(Glib::wrap_auto((GObject*)(gtk_cell_renderer_start_editing(gobj(), event, (widget).gobj(), path.c_str(), const_cast<GdkRectangle*>(background_area.gobj()), const_cast<GdkRectangle*>(cell_area.gobj()), ((GtkCellRendererState)(flags)))), false));
408 void CellRenderer::set_fixed_size(int width, int height)
410 gtk_cell_renderer_set_fixed_size(gobj(), width, height);
413 void CellRenderer::get_fixed_size(int& width, int& height) const
415 gtk_cell_renderer_get_fixed_size(const_cast<GtkCellRenderer*>(gobj()), &width, &height);
418 void CellRenderer::editing_canceled()
420 gtk_cell_renderer_editing_canceled(gobj());
423 void CellRenderer::stop_editing(bool canceled)
425 gtk_cell_renderer_stop_editing(gobj(), static_cast<int>(canceled));
428 CellRenderer::CellRenderer()
430 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
431 Gtk::Object(Glib::ConstructParams(cellrenderer_class_.init()))
436 Glib::SignalProxy0< void > CellRenderer::signal_editing_canceled()
438 return Glib::SignalProxy0< void >(this, &CellRenderer_signal_editing_canceled_info);
441 Glib::SignalProxy2< void,CellEditable*,const Glib::ustring& > CellRenderer::signal_editing_started()
443 return Glib::SignalProxy2< void,CellEditable*,const Glib::ustring& >(this, &CellRenderer_signal_editing_started_info);
447 Glib::PropertyProxy<CellRendererMode> CellRenderer::property_mode()
449 return Glib::PropertyProxy<CellRendererMode>(this, "mode");
452 Glib::PropertyProxy_ReadOnly<CellRendererMode> CellRenderer::property_mode() const
454 return Glib::PropertyProxy_ReadOnly<CellRendererMode>(this, "mode");
457 Glib::PropertyProxy<bool> CellRenderer::property_visible()
459 return Glib::PropertyProxy<bool>(this, "visible");
462 Glib::PropertyProxy_ReadOnly<bool> CellRenderer::property_visible() const
464 return Glib::PropertyProxy_ReadOnly<bool>(this, "visible");
467 Glib::PropertyProxy<float> CellRenderer::property_xalign()
469 return Glib::PropertyProxy<float>(this, "xalign");
472 Glib::PropertyProxy_ReadOnly<float> CellRenderer::property_xalign() const
474 return Glib::PropertyProxy_ReadOnly<float>(this, "xalign");
477 Glib::PropertyProxy<float> CellRenderer::property_yalign()
479 return Glib::PropertyProxy<float>(this, "yalign");
482 Glib::PropertyProxy_ReadOnly<float> CellRenderer::property_yalign() const
484 return Glib::PropertyProxy_ReadOnly<float>(this, "yalign");
487 Glib::PropertyProxy<unsigned int> CellRenderer::property_xpad()
489 return Glib::PropertyProxy<unsigned int>(this, "xpad");
492 Glib::PropertyProxy_ReadOnly<unsigned int> CellRenderer::property_xpad() const
494 return Glib::PropertyProxy_ReadOnly<unsigned int>(this, "xpad");
497 Glib::PropertyProxy<unsigned int> CellRenderer::property_ypad()
499 return Glib::PropertyProxy<unsigned int>(this, "ypad");
502 Glib::PropertyProxy_ReadOnly<unsigned int> CellRenderer::property_ypad() const
504 return Glib::PropertyProxy_ReadOnly<unsigned int>(this, "ypad");
507 Glib::PropertyProxy<int> CellRenderer::property_width()
509 return Glib::PropertyProxy<int>(this, "width");
512 Glib::PropertyProxy_ReadOnly<int> CellRenderer::property_width() const
514 return Glib::PropertyProxy_ReadOnly<int>(this, "width");
517 Glib::PropertyProxy<int> CellRenderer::property_height()
519 return Glib::PropertyProxy<int>(this, "height");
522 Glib::PropertyProxy_ReadOnly<int> CellRenderer::property_height() const
524 return Glib::PropertyProxy_ReadOnly<int>(this, "height");
527 Glib::PropertyProxy<bool> CellRenderer::property_is_expander()
529 return Glib::PropertyProxy<bool>(this, "is-expander");
532 Glib::PropertyProxy_ReadOnly<bool> CellRenderer::property_is_expander() const
534 return Glib::PropertyProxy_ReadOnly<bool>(this, "is-expander");
537 Glib::PropertyProxy<bool> CellRenderer::property_is_expanded()
539 return Glib::PropertyProxy<bool>(this, "is-expanded");
542 Glib::PropertyProxy_ReadOnly<bool> CellRenderer::property_is_expanded() const
544 return Glib::PropertyProxy_ReadOnly<bool>(this, "is-expanded");
547 Glib::PropertyProxy_WriteOnly<Glib::ustring> CellRenderer::property_cell_background()
549 return Glib::PropertyProxy_WriteOnly<Glib::ustring>(this, "cell-background");
552 Glib::PropertyProxy_ReadOnly<Glib::ustring> CellRenderer::property_cell_background() const
554 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "cell-background");
557 Glib::PropertyProxy<Gdk::Color> CellRenderer::property_cell_background_gdk()
559 return Glib::PropertyProxy<Gdk::Color>(this, "cell-background-gdk");
562 Glib::PropertyProxy_ReadOnly<Gdk::Color> CellRenderer::property_cell_background_gdk() const
564 return Glib::PropertyProxy_ReadOnly<Gdk::Color>(this, "cell-background-gdk");
567 Glib::PropertyProxy<bool> CellRenderer::property_cell_background_set()
569 return Glib::PropertyProxy<bool>(this, "cell-background-set");
572 Glib::PropertyProxy_ReadOnly<bool> CellRenderer::property_cell_background_set() const
574 return Glib::PropertyProxy_ReadOnly<bool>(this, "cell-background-set");
578 void Gtk::CellRenderer::on_editing_canceled()
580 BaseClassType *const base = static_cast<BaseClassType*>(
581 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
584 if(base && base->editing_canceled)
585 (*base->editing_canceled)(gobj());
589 void Gtk::CellRenderer::get_size_vfunc(Widget& widget, const Gdk::Rectangle* cell_area, int* x_offset, int* y_offset, int* width, int* height) const
591 BaseClassType *const base = static_cast<BaseClassType*>(
592 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
595 if(base && base->get_size)
596 (*base->get_size)(const_cast<GtkCellRenderer*>(gobj()),(widget).gobj(),Glib::unwrap(const_cast<Gdk::Rectangle*>(cell_area)),x_offset,y_offset,width,height);
599 void Gtk::CellRenderer::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window, Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, CellRendererState flags)
601 BaseClassType *const base = static_cast<BaseClassType*>(
602 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
605 if(base && base->render)
606 (*base->render)(gobj(),Glib::unwrap(window),(widget).gobj(),const_cast<GdkRectangle*>(background_area.gobj()),const_cast<GdkRectangle*>(cell_area.gobj()),const_cast<GdkRectangle*>(expose_area.gobj()),((GtkCellRendererState)(flags)));
609 bool Gtk::CellRenderer::activate_vfunc(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags)
611 BaseClassType *const base = static_cast<BaseClassType*>(
612 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
615 if(base && base->activate)
616 return (*base->activate)(gobj(),event,(widget).gobj(),path.c_str(),const_cast<GdkRectangle*>(background_area.gobj()),const_cast<GdkRectangle*>(cell_area.gobj()),((GtkCellRendererState)(flags)));
622 CellEditable* Gtk::CellRenderer::start_editing_vfunc(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags)
624 BaseClassType *const base = static_cast<BaseClassType*>(
625 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
628 if(base && base->start_editing)
629 return dynamic_cast<CellEditable*>(Glib::wrap_auto((GObject*)((*base->start_editing)(gobj(),event,(widget).gobj(),path.c_str(),const_cast<GdkRectangle*>(background_area.gobj()),const_cast<GdkRectangle*>(cell_area.gobj()),((GtkCellRendererState)(flags)))), false));
631 typedef CellEditable* RType;