1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/iconview.h>
4 #include <gtkmm/private/iconview_p.h>
9 /* Copyright 1998-2004 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <gtkmm/adjustment.h>
27 #include <gtk/gtkiconview.h>
29 namespace //anonymous namespace
32 void proxy_foreach_callback(GtkIconView* /* icon_view */, GtkTreePath* path, void* data)
34 typedef Gtk::IconView::SlotForeach SlotType;
35 SlotType& slot = *static_cast<SlotType*>(data);
39 slot(Gtk::TreeModel::Path(path, true));
43 Glib::exception_handlers_invoke();
47 } //anonymous namespace
53 //Allow the generated code to work without the prefix:
54 typedef IconView::ArrayHandle_TreePaths ArrayHandle_TreePaths;
56 void IconView::selected_foreach(const SlotForeach& slot)
58 SlotForeach slot_copy(slot);
59 gtk_icon_view_selected_foreach(const_cast<GtkIconView*>(gobj()), &proxy_foreach_callback, &slot_copy);
69 void IconView_signal_set_scroll_adjustments_callback(GtkIconView* self, GtkAdjustment* p0,GtkAdjustment* p1,void* data)
72 typedef sigc::slot< void,Adjustment*,Adjustment* > SlotType;
74 // Do not try to call a signal on a disassociated wrapper.
75 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
79 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
80 (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
86 Glib::exception_handlers_invoke();
91 const Glib::SignalProxyInfo IconView_signal_set_scroll_adjustments_info =
93 "set_scroll_adjustments",
94 (GCallback) &IconView_signal_set_scroll_adjustments_callback,
95 (GCallback) &IconView_signal_set_scroll_adjustments_callback
99 void IconView_signal_item_activated_callback(GtkIconView* self, GtkTreePath* p0,void* data)
102 typedef sigc::slot< void,const TreeModel::Path& > SlotType;
104 // Do not try to call a signal on a disassociated wrapper.
105 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
109 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
110 (*static_cast<SlotType*>(slot))(Gtk::TreePath(p0, true)
115 Glib::exception_handlers_invoke();
120 const Glib::SignalProxyInfo IconView_signal_item_activated_info =
123 (GCallback) &IconView_signal_item_activated_callback,
124 (GCallback) &IconView_signal_item_activated_callback
128 const Glib::SignalProxyInfo IconView_signal_selection_changed_info =
131 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
132 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
135 } // anonymous namespace
141 Gtk::IconView* wrap(GtkIconView* object, bool take_copy)
143 return dynamic_cast<Gtk::IconView *> (Glib::wrap_auto ((GObject*)(object), take_copy));
146 } /* namespace Glib */
152 /* The *_Class implementation: */
154 const Glib::Class& IconView_Class::init()
156 if(!gtype_) // create the GType if necessary
158 // Glib::Class has to know the class init function to clone custom types.
159 class_init_func_ = &IconView_Class::class_init_function;
161 // This is actually just optimized away, apparently with no harm.
162 // Make sure that the parent type has been created.
163 //CppClassParent::CppObjectType::get_type();
165 // Create the wrapper type, with the same class/instance size as the base type.
166 register_derived_type(gtk_icon_view_get_type());
168 // Add derived versions of interfaces, if the C type implements any interfaces:
174 void IconView_Class::class_init_function(void* g_class, void* class_data)
176 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
177 CppClassParent::class_init_function(klass, class_data);
179 klass->set_scroll_adjustments = &set_scroll_adjustments_callback;
180 klass->item_activated = &item_activated_callback;
181 klass->selection_changed = &selection_changed_callback;
185 void IconView_Class::set_scroll_adjustments_callback(GtkIconView* self, GtkAdjustment* p0, GtkAdjustment* p1)
187 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
188 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
190 // Non-gtkmmproc-generated custom classes implicitly call the default
191 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
192 // generated classes can use this optimisation, which avoids the unnecessary
193 // parameter conversions if there is no possibility of the virtual function
195 if(obj && obj->is_derived_())
197 try // Trap C++ exceptions which would normally be lost because this is a C callback.
199 // Call the virtual member method, which derived classes might override.
200 obj->on_set_scroll_adjustments(Glib::wrap(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->set_scroll_adjustments)
217 (*base->set_scroll_adjustments)(self, p0, p1);
221 void IconView_Class::item_activated_callback(GtkIconView* self, GtkTreePath* p0)
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.
236 obj->on_item_activated(Gtk::TreePath(p0, true)
241 Glib::exception_handlers_invoke();
246 BaseClassType *const base = static_cast<BaseClassType*>(
247 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
250 // Call the original underlying C function:
251 if(base && base->item_activated)
252 (*base->item_activated)(self, p0);
256 void IconView_Class::selection_changed_callback(GtkIconView* self)
258 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
259 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
261 // Non-gtkmmproc-generated custom classes implicitly call the default
262 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
263 // generated classes can use this optimisation, which avoids the unnecessary
264 // parameter conversions if there is no possibility of the virtual function
266 if(obj && obj->is_derived_())
268 try // Trap C++ exceptions which would normally be lost because this is a C callback.
270 // Call the virtual member method, which derived classes might override.
271 obj->on_selection_changed();
275 Glib::exception_handlers_invoke();
280 BaseClassType *const base = static_cast<BaseClassType*>(
281 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
284 // Call the original underlying C function:
285 if(base && base->selection_changed)
286 (*base->selection_changed)(self);
291 Glib::ObjectBase* IconView_Class::wrap_new(GObject* o)
293 return manage(new IconView((GtkIconView*)(o)));
298 /* The implementation: */
300 IconView::IconView(const Glib::ConstructParams& construct_params)
302 Gtk::Container(construct_params)
306 IconView::IconView(GtkIconView* castitem)
308 Gtk::Container((GtkContainer*)(castitem))
312 IconView::~IconView()
317 IconView::CppClassType IconView::iconview_class_; // initialize static member
319 GType IconView::get_type()
321 return iconview_class_.init().get_type();
324 GType IconView::get_base_type()
326 return gtk_icon_view_get_type();
332 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
333 Gtk::Container(Glib::ConstructParams(iconview_class_.init()))
337 IconView::IconView(const Glib::RefPtr<TreeModel>& model)
339 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
340 Gtk::Container(Glib::ConstructParams(iconview_class_.init(), "model", Glib::unwrap(model), (char*) 0))
344 void IconView::set_model(const Glib::RefPtr<TreeModel>& model)
346 gtk_icon_view_set_model(gobj(), Glib::unwrap(model));
349 Glib::RefPtr<TreeModel> IconView::get_model()
351 return Glib::wrap(gtk_icon_view_get_model(gobj()));
354 Glib::RefPtr<const TreeModel> IconView::get_model() const
356 return Glib::wrap(gtk_icon_view_get_model(const_cast<GtkIconView*>(gobj())));
359 void IconView::set_text_column(int column)
361 gtk_icon_view_set_text_column(gobj(), column);
364 void IconView::set_text_column(const TreeModelColumnBase& model_column)
366 gtk_icon_view_set_text_column(gobj(), (model_column).index());
369 int IconView::get_text_column() const
371 return gtk_icon_view_get_text_column(const_cast<GtkIconView*>(gobj()));
374 void IconView::set_markup_column(int column)
376 gtk_icon_view_set_markup_column(gobj(), column);
379 void IconView::set_markup_column(const TreeModelColumnBase& column)
381 gtk_icon_view_set_markup_column(gobj(), (column).index());
384 int IconView::get_markup_column() const
386 return gtk_icon_view_get_markup_column(const_cast<GtkIconView*>(gobj()));
389 void IconView::set_pixbuf_column(int column)
391 gtk_icon_view_set_pixbuf_column(gobj(), column);
394 void IconView::set_pixbuf_column(const TreeModelColumnBase& column)
396 gtk_icon_view_set_pixbuf_column(gobj(), (column).index());
399 int IconView::get_pixbuf_column() const
401 return gtk_icon_view_get_pixbuf_column(const_cast<GtkIconView*>(gobj()));
404 void IconView::set_orientation(Orientation orientation)
406 gtk_icon_view_set_orientation(gobj(), ((GtkOrientation)(orientation)));
409 Orientation IconView::get_orientation() const
411 return ((Orientation)(gtk_icon_view_get_orientation(const_cast<GtkIconView*>(gobj()))));
414 void IconView::set_columns(int columns)
416 gtk_icon_view_set_columns(gobj(), columns);
419 int IconView::get_columns() const
421 return gtk_icon_view_get_columns(const_cast<GtkIconView*>(gobj()));
424 void IconView::set_item_width(int item_width)
426 gtk_icon_view_set_item_width(gobj(), item_width);
429 int IconView::get_icon_width() const
431 return gtk_icon_view_get_item_width(const_cast<GtkIconView*>(gobj()));
434 void IconView::set_spacing(int spacing)
436 gtk_icon_view_set_spacing(gobj(), spacing);
439 int IconView::get_spacing() const
441 return gtk_icon_view_get_spacing(const_cast<GtkIconView*>(gobj()));
444 void IconView::set_row_spacing(int row_spacing)
446 gtk_icon_view_set_row_spacing(gobj(), row_spacing);
449 gint IconView::get_row_spacing() const
451 return gtk_icon_view_get_row_spacing(const_cast<GtkIconView*>(gobj()));
454 void IconView::set_column_spacing(int column_spacing)
456 gtk_icon_view_set_column_spacing(gobj(), column_spacing);
459 int IconView::get_column_spacing() const
461 return gtk_icon_view_get_column_spacing(const_cast<GtkIconView*>(gobj()));
464 void IconView::set_margin(int margin)
466 gtk_icon_view_set_margin(gobj(), margin);
469 int IconView::get_margin() const
471 return gtk_icon_view_get_margin(const_cast<GtkIconView*>(gobj()));
474 TreeModel::Path IconView::get_path_at_pos(int x, int y) const
476 return Gtk::TreePath(gtk_icon_view_get_path_at_pos(const_cast<GtkIconView*>(gobj()), x, y), false);
479 void IconView::set_selection_mode(SelectionMode mode)
481 gtk_icon_view_set_selection_mode(gobj(), ((GtkSelectionMode)(mode)));
484 SelectionMode IconView::get_selection_mode() const
486 return ((SelectionMode)(gtk_icon_view_get_selection_mode(const_cast<GtkIconView*>(gobj()))));
489 void IconView::select_path(const TreeModel::Path& path)
491 gtk_icon_view_select_path(gobj(), const_cast<GtkTreePath*>((path).gobj()));
494 void IconView::unselect_path(const TreeModel::Path& path)
496 gtk_icon_view_unselect_path(gobj(), const_cast<GtkTreePath*>((path).gobj()));
499 bool IconView::path_is_selected(const TreeModel::Path& path) const
501 return gtk_icon_view_path_is_selected(const_cast<GtkIconView*>(gobj()), const_cast<GtkTreePath*>((path).gobj()));
504 ArrayHandle_TreePaths IconView::get_selected_items() const
506 return ArrayHandle_TreePaths(gtk_icon_view_get_selected_items(const_cast<GtkIconView*>(gobj())), Glib::OWNERSHIP_SHALLOW);
509 void IconView::select_all()
511 gtk_icon_view_select_all(gobj());
514 void IconView::unselect_all()
516 gtk_icon_view_unselect_all(gobj());
519 void IconView::item_activated(const TreeModel::Path& path)
521 gtk_icon_view_item_activated(gobj(), const_cast<GtkTreePath*>((path).gobj()));
525 Glib::SignalProxy2< void,Adjustment*,Adjustment* > IconView::signal_set_scroll_adjustments()
527 return Glib::SignalProxy2< void,Adjustment*,Adjustment* >(this, &IconView_signal_set_scroll_adjustments_info);
530 Glib::SignalProxy1< void,const TreeModel::Path& > IconView::signal_item_activated()
532 return Glib::SignalProxy1< void,const TreeModel::Path& >(this, &IconView_signal_item_activated_info);
535 Glib::SignalProxy0< void > IconView::signal_selection_changed()
537 return Glib::SignalProxy0< void >(this, &IconView_signal_selection_changed_info);
541 Glib::PropertyProxy<int> IconView::property_pixbuf_column()
543 return Glib::PropertyProxy<int>(this, "pixbuf-column");
546 Glib::PropertyProxy_ReadOnly<int> IconView::property_pixbuf_column() const
548 return Glib::PropertyProxy_ReadOnly<int>(this, "pixbuf-column");
551 Glib::PropertyProxy<int> IconView::property_text_column()
553 return Glib::PropertyProxy<int>(this, "text-column");
556 Glib::PropertyProxy_ReadOnly<int> IconView::property_text_column() const
558 return Glib::PropertyProxy_ReadOnly<int>(this, "text-column");
561 Glib::PropertyProxy<int> IconView::property_markup_column()
563 return Glib::PropertyProxy<int>(this, "markup-column");
566 Glib::PropertyProxy_ReadOnly<int> IconView::property_markup_column() const
568 return Glib::PropertyProxy_ReadOnly<int>(this, "markup-column");
571 Glib::PropertyProxy<SelectionMode> IconView::property_selection_mode()
573 return Glib::PropertyProxy<SelectionMode>(this, "selection-mode");
576 Glib::PropertyProxy_ReadOnly<SelectionMode> IconView::property_selection_mode() const
578 return Glib::PropertyProxy_ReadOnly<SelectionMode>(this, "selection-mode");
581 Glib::PropertyProxy<Orientation> IconView::property_orientation()
583 return Glib::PropertyProxy<Orientation>(this, "orientation");
586 Glib::PropertyProxy_ReadOnly<Orientation> IconView::property_orientation() const
588 return Glib::PropertyProxy_ReadOnly<Orientation>(this, "orientation");
591 Glib::PropertyProxy< Glib::RefPtr<TreeModel> > IconView::property_model()
593 return Glib::PropertyProxy< Glib::RefPtr<TreeModel> >(this, "model");
596 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<TreeModel> > IconView::property_model() const
598 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<TreeModel> >(this, "model");
601 Glib::PropertyProxy<int> IconView::property_columns()
603 return Glib::PropertyProxy<int>(this, "columns");
606 Glib::PropertyProxy_ReadOnly<int> IconView::property_columns() const
608 return Glib::PropertyProxy_ReadOnly<int>(this, "columns");
611 Glib::PropertyProxy<int> IconView::property_item_width()
613 return Glib::PropertyProxy<int>(this, "item-width");
616 Glib::PropertyProxy_ReadOnly<int> IconView::property_item_width() const
618 return Glib::PropertyProxy_ReadOnly<int>(this, "item-width");
621 Glib::PropertyProxy<int> IconView::property_spacing()
623 return Glib::PropertyProxy<int>(this, "spacing");
626 Glib::PropertyProxy_ReadOnly<int> IconView::property_spacing() const
628 return Glib::PropertyProxy_ReadOnly<int>(this, "spacing");
631 Glib::PropertyProxy<int> IconView::property_row_spacing()
633 return Glib::PropertyProxy<int>(this, "row-spacing");
636 Glib::PropertyProxy_ReadOnly<int> IconView::property_row_spacing() const
638 return Glib::PropertyProxy_ReadOnly<int>(this, "row-spacing");
641 Glib::PropertyProxy<int> IconView::property_column_spacing()
643 return Glib::PropertyProxy<int>(this, "column-spacing");
646 Glib::PropertyProxy_ReadOnly<int> IconView::property_column_spacing() const
648 return Glib::PropertyProxy_ReadOnly<int>(this, "column-spacing");
651 Glib::PropertyProxy<int> IconView::property_margin()
653 return Glib::PropertyProxy<int>(this, "margin");
656 Glib::PropertyProxy_ReadOnly<int> IconView::property_margin() const
658 return Glib::PropertyProxy_ReadOnly<int>(this, "margin");
662 void Gtk::IconView::on_set_scroll_adjustments(Adjustment* hadjustment, Adjustment* vadjustment)
664 BaseClassType *const base = static_cast<BaseClassType*>(
665 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
668 if(base && base->set_scroll_adjustments)
669 (*base->set_scroll_adjustments)(gobj(),(GtkAdjustment*)Glib::unwrap(hadjustment),(GtkAdjustment*)Glib::unwrap(vadjustment));
672 void Gtk::IconView::on_item_activated(const TreeModel::Path& path)
674 BaseClassType *const base = static_cast<BaseClassType*>(
675 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
678 if(base && base->item_activated)
679 (*base->item_activated)(gobj(),const_cast<GtkTreePath*>((path).gobj()));
682 void Gtk::IconView::on_selection_changed()
684 BaseClassType *const base = static_cast<BaseClassType*>(
685 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
688 if(base && base->selection_changed)
689 (*base->selection_changed)(gobj());