1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/treemodelsort.h>
4 #include <gtkmm/private/treemodelsort_p.h>
9 /* Copyright 1998-2002 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 <gtk/gtktreemodelsort.h>
29 typedef Gtk::TreeModel::Path Path; //So that the generated method implemenations can use this a return type.
34 TreeModel::iterator TreeModelSort::convert_child_iter_to_iter(const iterator& child_iter) const
36 TreeIter sorted_iter (const_cast<TreeModelSort*>(this));
38 gtk_tree_model_sort_convert_child_iter_to_iter(
39 const_cast<GtkTreeModelSort*>(gobj()), sorted_iter.gobj(),
40 const_cast<GtkTreeIter*>(child_iter.gobj()));
45 TreeModel::iterator TreeModelSort::convert_iter_to_child_iter(const iterator& sorted_iter) const
47 GtkTreeModel *const child_model = gtk_tree_model_sort_get_model(const_cast<GtkTreeModelSort*>(gobj()));
49 TreeIter child_iter (dynamic_cast<TreeModel*>(Glib::wrap_auto((GObject*) child_model, false)));
51 gtk_tree_model_sort_convert_iter_to_child_iter(
52 const_cast<GtkTreeModelSort*>(gobj()), child_iter.gobj(),
53 const_cast<GtkTreeIter*>(sorted_iter.gobj()));
58 void TreeModelSort::set_value_impl(const iterator& row, int column, const Glib::ValueBase& value)
60 // Avoid two extra ref/unref cycles -- we don't store the child
61 // model pointer anywhere, so it's OK to do this _internally_.
63 TreeModel *const child_model = dynamic_cast<TreeModel*>(
64 Glib::wrap_auto((GObject*) gtk_tree_model_sort_get_model(gobj()), false));
66 TreeIter child_iter (child_model);
68 gtk_tree_model_sort_convert_iter_to_child_iter(
69 gobj(), child_iter.gobj(), const_cast<GtkTreeIter*>(row.gobj()));
71 child_model->set_value_impl(child_iter, column, value);
79 } // anonymous namespace
85 Glib::RefPtr<Gtk::TreeModelSort> wrap(GtkTreeModelSort* object, bool take_copy)
87 return Glib::RefPtr<Gtk::TreeModelSort>( dynamic_cast<Gtk::TreeModelSort*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
88 //We use dynamic_cast<> in case of multiple inheritance.
91 } /* namespace Glib */
98 /* The *_Class implementation: */
100 const Glib::Class& TreeModelSort_Class::init()
102 if(!gtype_) // create the GType if necessary
104 // Glib::Class has to know the class init function to clone custom types.
105 class_init_func_ = &TreeModelSort_Class::class_init_function;
107 // This is actually just optimized away, apparently with no harm.
108 // Make sure that the parent type has been created.
109 //CppClassParent::CppObjectType::get_type();
111 // Create the wrapper type, with the same class/instance size as the base type.
112 register_derived_type(gtk_tree_model_sort_get_type());
114 // Add derived versions of interfaces, if the C type implements any interfaces:
115 TreeModel::add_interface(get_type());
116 TreeSortable::add_interface(get_type());
122 void TreeModelSort_Class::class_init_function(void* g_class, void* class_data)
124 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
125 CppClassParent::class_init_function(klass, class_data);
130 Glib::ObjectBase* TreeModelSort_Class::wrap_new(GObject* object)
132 return new TreeModelSort((GtkTreeModelSort*)object);
136 /* The implementation: */
138 GtkTreeModelSort* TreeModelSort::gobj_copy()
144 TreeModelSort::TreeModelSort(const Glib::ConstructParams& construct_params)
146 Glib::Object(construct_params)
149 TreeModelSort::TreeModelSort(GtkTreeModelSort* castitem)
151 Glib::Object((GObject*)(castitem))
154 TreeModelSort::~TreeModelSort()
158 TreeModelSort::CppClassType TreeModelSort::treemodelsort_class_; // initialize static member
160 GType TreeModelSort::get_type()
162 return treemodelsort_class_.init().get_type();
165 GType TreeModelSort::get_base_type()
167 return gtk_tree_model_sort_get_type();
171 TreeModelSort::TreeModelSort(const Glib::RefPtr<TreeModel>& model)
173 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
174 Glib::Object(Glib::ConstructParams(treemodelsort_class_.init(), "model", Glib::unwrap(model), (char*) 0))
178 Glib::RefPtr<TreeModelSort> TreeModelSort::create(const Glib::RefPtr<TreeModel>& model)
180 return Glib::RefPtr<TreeModelSort>( new TreeModelSort(model) );
182 Glib::RefPtr<TreeModel> TreeModelSort::get_model()
185 Glib::RefPtr<TreeModel> retvalue = Glib::wrap(gtk_tree_model_sort_get_model(gobj()));
188 retvalue->reference(); //The function does not do a ref for us.
192 Glib::RefPtr<const TreeModel> TreeModelSort::get_model() const
195 Glib::RefPtr<const TreeModel> retvalue = Glib::wrap(gtk_tree_model_sort_get_model(const_cast<GtkTreeModelSort*>(gobj())));
198 retvalue->reference(); //The function does not do a ref for us.
202 Path TreeModelSort::convert_child_path_to_path(const Path& child_path) const
204 return Gtk::TreePath(gtk_tree_model_sort_convert_child_path_to_path(const_cast<GtkTreeModelSort*>(gobj()), const_cast<GtkTreePath*>((child_path).gobj())), false);
207 Path TreeModelSort::convert_path_to_child_path(const Path& sorted_path) const
209 return Gtk::TreePath(gtk_tree_model_sort_convert_path_to_child_path(const_cast<GtkTreeModelSort*>(gobj()), const_cast<GtkTreePath*>((sorted_path).gobj())), false);
212 void TreeModelSort::reset_default_sort_func()
214 gtk_tree_model_sort_reset_default_sort_func(gobj());
217 void TreeModelSort::clear_cache()
219 gtk_tree_model_sort_clear_cache(gobj());
222 bool TreeModelSort::iter_is_valid(const iterator& iter) const
224 return gtk_tree_model_sort_iter_is_valid(const_cast<GtkTreeModelSort*>(gobj()), const_cast<GtkTreeIter*>((iter).gobj()));