Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / treemodelsort.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/treemodelsort.h>
4 #include <gtkmm/private/treemodelsort_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright 1998-2002 The gtkmm Development Team
10  *
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.
15  *
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.
20  *
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.
24  */
25
26 #include <gtk/gtktreemodelsort.h>
27
28
29 typedef Gtk::TreeModel::Path Path; //So that the generated method implemenations can use this a return type.
30
31 namespace Gtk
32 {
33
34 TreeModel::iterator TreeModelSort::convert_child_iter_to_iter(const iterator& child_iter) const
35 {
36   TreeIter sorted_iter (const_cast<TreeModelSort*>(this));
37
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()));
41
42   return sorted_iter;
43 }
44
45 TreeModel::iterator TreeModelSort::convert_iter_to_child_iter(const iterator& sorted_iter) const
46 {
47   GtkTreeModel *const child_model = gtk_tree_model_sort_get_model(const_cast<GtkTreeModelSort*>(gobj()));
48
49   TreeIter child_iter (dynamic_cast<TreeModel*>(Glib::wrap_auto((GObject*) child_model, false)));
50
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()));
54
55   return child_iter;
56 }
57
58 void TreeModelSort::set_value_impl(const iterator& row, int column, const Glib::ValueBase& value)
59 {
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_.
62
63   TreeModel *const child_model = dynamic_cast<TreeModel*>(
64       Glib::wrap_auto((GObject*) gtk_tree_model_sort_get_model(gobj()), false));
65
66   TreeIter child_iter (child_model);
67
68   gtk_tree_model_sort_convert_iter_to_child_iter(
69       gobj(), child_iter.gobj(), const_cast<GtkTreeIter*>(row.gobj()));
70
71   child_model->set_value_impl(child_iter, column, value);
72 }
73
74 } // namespace Gtk
75
76
77 namespace
78 {
79 } // anonymous namespace
80
81
82 namespace Glib
83 {
84
85 Glib::RefPtr<Gtk::TreeModelSort> wrap(GtkTreeModelSort* object, bool take_copy)
86 {
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.
89 }
90
91 } /* namespace Glib */
92
93
94 namespace Gtk
95 {
96
97
98 /* The *_Class implementation: */
99
100 const Glib::Class& TreeModelSort_Class::init()
101 {
102   if(!gtype_) // create the GType if necessary
103   {
104     // Glib::Class has to know the class init function to clone custom types.
105     class_init_func_ = &TreeModelSort_Class::class_init_function;
106
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();
110
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());
113
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());
117   }
118
119   return *this;
120 }
121
122 void TreeModelSort_Class::class_init_function(void* g_class, void* class_data)
123 {
124   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
125   CppClassParent::class_init_function(klass, class_data);
126
127 }
128
129
130 Glib::ObjectBase* TreeModelSort_Class::wrap_new(GObject* object)
131 {
132   return new TreeModelSort((GtkTreeModelSort*)object);
133 }
134
135
136 /* The implementation: */
137
138 GtkTreeModelSort* TreeModelSort::gobj_copy()
139 {
140   reference();
141   return gobj();
142 }
143
144 TreeModelSort::TreeModelSort(const Glib::ConstructParams& construct_params)
145 :
146   Glib::Object(construct_params)
147 {}
148
149 TreeModelSort::TreeModelSort(GtkTreeModelSort* castitem)
150 :
151   Glib::Object((GObject*)(castitem))
152 {}
153
154 TreeModelSort::~TreeModelSort()
155 {}
156
157
158 TreeModelSort::CppClassType TreeModelSort::treemodelsort_class_; // initialize static member
159
160 GType TreeModelSort::get_type()
161 {
162   return treemodelsort_class_.init().get_type();
163 }
164
165 GType TreeModelSort::get_base_type()
166 {
167   return gtk_tree_model_sort_get_type();
168 }
169
170
171 TreeModelSort::TreeModelSort(const Glib::RefPtr<TreeModel>& model)
172 :
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))
175 {
176   }
177
178 Glib::RefPtr<TreeModelSort> TreeModelSort::create(const Glib::RefPtr<TreeModel>& model)
179 {
180   return Glib::RefPtr<TreeModelSort>( new TreeModelSort(model) );
181 }
182 Glib::RefPtr<TreeModel> TreeModelSort::get_model()
183 {
184
185   Glib::RefPtr<TreeModel> retvalue = Glib::wrap(gtk_tree_model_sort_get_model(gobj()));
186
187   if(retvalue)
188     retvalue->reference(); //The function does not do a ref for us.
189   return retvalue;
190 }
191
192 Glib::RefPtr<const TreeModel> TreeModelSort::get_model() const
193 {
194
195   Glib::RefPtr<const TreeModel> retvalue = Glib::wrap(gtk_tree_model_sort_get_model(const_cast<GtkTreeModelSort*>(gobj())));
196
197   if(retvalue)
198     retvalue->reference(); //The function does not do a ref for us.
199   return retvalue;
200 }
201
202 Path TreeModelSort::convert_child_path_to_path(const Path& child_path) const
203 {
204   return Gtk::TreePath(gtk_tree_model_sort_convert_child_path_to_path(const_cast<GtkTreeModelSort*>(gobj()), const_cast<GtkTreePath*>((child_path).gobj())), false);
205 }
206
207 Path TreeModelSort::convert_path_to_child_path(const Path& sorted_path) const
208 {
209   return Gtk::TreePath(gtk_tree_model_sort_convert_path_to_child_path(const_cast<GtkTreeModelSort*>(gobj()), const_cast<GtkTreePath*>((sorted_path).gobj())), false);
210 }
211
212 void TreeModelSort::reset_default_sort_func()
213 {
214   gtk_tree_model_sort_reset_default_sort_func(gobj());
215 }
216
217 void TreeModelSort::clear_cache()
218 {
219   gtk_tree_model_sort_clear_cache(gobj());
220 }
221
222 bool TreeModelSort::iter_is_valid(const iterator& iter) const
223 {
224   return gtk_tree_model_sort_iter_is_valid(const_cast<GtkTreeModelSort*>(gobj()), const_cast<GtkTreeIter*>((iter).gobj()));
225 }
226
227
228 } // namespace Gtk
229
230