1 // Generated by gmmproc 2.45.3 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gtkmm/treemodelfilter.h>
7 #include <gtkmm/private/treemodelfilter_p.h>
8
9
10 // -*- c++ -*-
11 /* $Id: treemodelfilter.ccg,v 1.9 2006/05/11 11:40:24 murrayc Exp $ */
12
13 /* Copyright 1998-2002 The gtkmm Development Team
14 *
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free
27 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30
SignalProxy_Visible_gtk_callback(GtkTreeModel * model,GtkTreeIter * iter,gpointer data)31 static gboolean SignalProxy_Visible_gtk_callback(GtkTreeModel* model, GtkTreeIter* iter, gpointer data)
32 {
33 Gtk::TreeModelFilter::SlotVisible* the_slot = static_cast<Gtk::TreeModelFilter::SlotVisible*>(data);
34
35 try
36 {
37 return (*the_slot)( Gtk::TreeModel::const_iterator(model, iter) );
38 }
39 catch(...)
40 {
41 Glib::exception_handlers_invoke();
42 }
43
44 return FALSE; //An arbitary default, just to avoid the compiler warning.
45 }
46
SignalProxy_Visible_gtk_callback_destroy(void * data)47 static void SignalProxy_Visible_gtk_callback_destroy(void* data)
48 {
49 delete static_cast<Gtk::TreeModelFilter::SlotVisible*>(data);
50 }
51
52
SignalProxy_Modify_gtk_callback(GtkTreeModel * model,GtkTreeIter * iter,GValue * value,gint column,gpointer data)53 static void SignalProxy_Modify_gtk_callback(GtkTreeModel* model, GtkTreeIter* iter, GValue* value, gint column, gpointer data)
54 {
55 Gtk::TreeModelFilter::SlotModify* the_slot = static_cast<Gtk::TreeModelFilter::SlotModify*>(data);
56
57 try
58 {
59 //Initialize the input parameter with the appropriate type for this column.
60 //Then the C++ handler can just use operator==() without calling init on the value output arg:
61 Glib::ValueBase cppValue;
62 GType column_type = gtk_tree_model_get_column_type(model, column);
63 cppValue.init(column_type);
64
65 (*the_slot)( Gtk::TreeModel::const_iterator(model, iter), cppValue, column );
66
67 //GTK+ has already done this for us: g_value_init(value, column_type);
68
69 //If the C++ handler has inited value with an inappropriate GType, then this will fail,
70 //but they should not do that because it makes no sense.
71 g_value_copy(cppValue.gobj() /* source */, value /* destination */);
72 }
73 catch(...)
74 {
75 Glib::exception_handlers_invoke();
76 }
77 }
78
SignalProxy_Modify_gtk_callback_destroy(void * data)79 static void SignalProxy_Modify_gtk_callback_destroy(void* data)
80 {
81 delete static_cast<Gtk::TreeModelFilter::SlotModify*>(data);
82 }
83
84
85 typedef Gtk::TreeModel::Path Path; //So that the generated method implemenations can use this a return type.
86
87 namespace Gtk
88 {
89
TreeModelFilter(const Glib::RefPtr<TreeModel> & child_model)90 TreeModelFilter::TreeModelFilter(const Glib::RefPtr<TreeModel>& child_model)
91 :
92 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
93 Glib::ObjectBase(0),
94 Glib::Object(Glib::ConstructParams(treemodelfilter_class_.init(), "child_model",child_model->gobj(), static_cast<char*>(0)))
95 {
96 }
97
TreeModelFilter(const Glib::RefPtr<TreeModel> & child_model,const TreeModel::Path & virtual_root)98 TreeModelFilter::TreeModelFilter(const Glib::RefPtr<TreeModel>& child_model, const TreeModel::Path& virtual_root)
99 :
100 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
101 Glib::ObjectBase(0),
102 Glib::Object(Glib::ConstructParams(treemodelfilter_class_.init(), "child_model",child_model->gobj(),"virtual_root",(virtual_root.empty() ? 0 : const_cast<GtkTreePath*>((virtual_root).gobj())) , static_cast<char*>(0)))
103 {
104 }
105
set_visible_func(const SlotVisible & slot)106 void TreeModelFilter::set_visible_func(const SlotVisible& slot)
107 {
108 // Create a copy of the slot. A pointer to this will be passed
109 // through the callback's data parameter. It will be deleted
110 // when SignalProxy_Visible_gtk_callback_destroy() is called.
111 SlotVisible* slot_copy = new SlotVisible(slot);
112
113 gtk_tree_model_filter_set_visible_func(gobj(),
114 &SignalProxy_Visible_gtk_callback, slot_copy,
115 &SignalProxy_Visible_gtk_callback_destroy);
116 }
117
118
convert_child_iter_to_iter(const iterator & child_iter) const119 TreeModel::iterator TreeModelFilter::convert_child_iter_to_iter(const iterator& child_iter) const
120 {
121 TreeIter filter_iter (const_cast<TreeModelFilter*>(this));
122
123 gtk_tree_model_filter_convert_child_iter_to_iter(
124 const_cast<GtkTreeModelFilter*>(gobj()), filter_iter.gobj(),
125 const_cast<GtkTreeIter*>(child_iter.gobj()));
126
127 return filter_iter;
128 }
129
convert_iter_to_child_iter(const iterator & filter_iter) const130 TreeModel::iterator TreeModelFilter::convert_iter_to_child_iter(const iterator& filter_iter) const
131 {
132 GtkTreeModel *const child_model = gtk_tree_model_filter_get_model(const_cast<GtkTreeModelFilter*>(gobj()));
133
134 TreeIter child_iter (dynamic_cast<TreeModel*>(Glib::wrap_auto((GObject*) child_model, false)));
135
136 gtk_tree_model_filter_convert_iter_to_child_iter(
137 const_cast<GtkTreeModelFilter*>(gobj()), child_iter.gobj(),
138 const_cast<GtkTreeIter*>(filter_iter.gobj()));
139
140 return child_iter;
141 }
142
set_modify_func(const TreeModelColumnRecord & columns,const SlotModify & slot)143 void TreeModelFilter::set_modify_func(const TreeModelColumnRecord& columns, const SlotModify& slot)
144 {
145 // Create a copy of the slot. A pointer to this will be passed
146 // through the callback's data parameter. It will be deleted
147 // when SignalProxy_Modify_gtk_callback_destroy() is called.
148 SlotModify* slot_copy = new SlotModify(slot);
149
150 gtk_tree_model_filter_set_modify_func(gobj(),
151 columns.size(), const_cast<GType*>(columns.types()),
152 &SignalProxy_Modify_gtk_callback, slot_copy,
153 &SignalProxy_Modify_gtk_callback_destroy);
154 }
155
set_value_impl(const iterator &,int,const Glib::ValueBase &)156 void TreeModelFilter::set_value_impl(const iterator& /* row */, int /* column */, const Glib::ValueBase& /* value */)
157 {
158 g_warning("Attempt to set a value of a row in a TreeModelFilter instead of in the child model.");
159 }
160
161
162 } // namespace Gtk
163
164 namespace
165 {
166 } // anonymous namespace
167
168
169 namespace Glib
170 {
171
wrap(GtkTreeModelFilter * object,bool take_copy)172 Glib::RefPtr<Gtk::TreeModelFilter> wrap(GtkTreeModelFilter* object, bool take_copy)
173 {
174 return Glib::RefPtr<Gtk::TreeModelFilter>( dynamic_cast<Gtk::TreeModelFilter*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
175 //We use dynamic_cast<> in case of multiple inheritance.
176 }
177
178 } /* namespace Glib */
179
180
181 namespace Gtk
182 {
183
184
185 /* The *_Class implementation: */
186
init()187 const Glib::Class& TreeModelFilter_Class::init()
188 {
189 if(!gtype_) // create the GType if necessary
190 {
191 // Glib::Class has to know the class init function to clone custom types.
192 class_init_func_ = &TreeModelFilter_Class::class_init_function;
193
194 // This is actually just optimized away, apparently with no harm.
195 // Make sure that the parent type has been created.
196 //CppClassParent::CppObjectType::get_type();
197
198 // Create the wrapper type, with the same class/instance size as the base type.
199 register_derived_type(gtk_tree_model_filter_get_type());
200
201 // Add derived versions of interfaces, if the C type implements any interfaces:
202 TreeModel::add_interface(get_type());
203
204 }
205
206 return *this;
207 }
208
209
class_init_function(void * g_class,void * class_data)210 void TreeModelFilter_Class::class_init_function(void* g_class, void* class_data)
211 {
212 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
213 CppClassParent::class_init_function(klass, class_data);
214
215
216 }
217
218
wrap_new(GObject * object)219 Glib::ObjectBase* TreeModelFilter_Class::wrap_new(GObject* object)
220 {
221 return new TreeModelFilter((GtkTreeModelFilter*)object);
222 }
223
224
225 /* The implementation: */
226
gobj_copy()227 GtkTreeModelFilter* TreeModelFilter::gobj_copy()
228 {
229 reference();
230 return gobj();
231 }
232
TreeModelFilter(const Glib::ConstructParams & construct_params)233 TreeModelFilter::TreeModelFilter(const Glib::ConstructParams& construct_params)
234 :
235 Glib::Object(construct_params)
236 {
237
238 }
239
TreeModelFilter(GtkTreeModelFilter * castitem)240 TreeModelFilter::TreeModelFilter(GtkTreeModelFilter* castitem)
241 :
242 Glib::Object((GObject*)(castitem))
243 {}
244
245
~TreeModelFilter()246 TreeModelFilter::~TreeModelFilter()
247 {}
248
249
250 TreeModelFilter::CppClassType TreeModelFilter::treemodelfilter_class_; // initialize static member
251
get_type()252 GType TreeModelFilter::get_type()
253 {
254 return treemodelfilter_class_.init().get_type();
255 }
256
257
get_base_type()258 GType TreeModelFilter::get_base_type()
259 {
260 return gtk_tree_model_filter_get_type();
261 }
262
263
create(const Glib::RefPtr<TreeModel> & child_model)264 Glib::RefPtr<TreeModelFilter> TreeModelFilter::create(const Glib::RefPtr<TreeModel>& child_model)
265 {
266 return Glib::RefPtr<TreeModelFilter>( new TreeModelFilter(child_model) );
267 }
268
create(const Glib::RefPtr<TreeModel> & child_model,const TreeModel::Path & virtual_root)269 Glib::RefPtr<TreeModelFilter> TreeModelFilter::create(const Glib::RefPtr<TreeModel>& child_model, const TreeModel::Path& virtual_root)
270 {
271 return Glib::RefPtr<TreeModelFilter>( new TreeModelFilter(child_model, virtual_root) );
272 }
273
set_visible_column(const TreeModelColumnBase & column)274 void TreeModelFilter::set_visible_column(const TreeModelColumnBase& column)
275 {
276 gtk_tree_model_filter_set_visible_column(gobj(), (column).index());
277 }
278
set_visible_column(int column)279 void TreeModelFilter::set_visible_column(int column)
280 {
281 gtk_tree_model_filter_set_visible_column(gobj(), column);
282 }
283
get_model()284 Glib::RefPtr<TreeModel> TreeModelFilter::get_model()
285 {
286 Glib::RefPtr<TreeModel> retvalue = Glib::wrap(gtk_tree_model_filter_get_model(gobj()));
287 if(retvalue)
288 retvalue->reference(); //The function does not do a ref for us.
289 return retvalue;
290 }
291
get_model() const292 Glib::RefPtr<const TreeModel> TreeModelFilter::get_model() const
293 {
294 return const_cast<TreeModelFilter*>(this)->get_model();
295 }
296
297 #ifndef GTKMM_DISABLE_DEPRECATED
298 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
convert_child_path_to_path(const Path & child_path)299 Path TreeModelFilter::convert_child_path_to_path(const Path& child_path)
300 {
301 return Gtk::TreePath(gtk_tree_model_filter_convert_child_path_to_path(gobj(), const_cast<GtkTreePath*>((child_path).gobj())), false);
302 }
303 G_GNUC_END_IGNORE_DEPRECATIONS
304 #endif // GTKMM_DISABLE_DEPRECATED
305
306 #ifndef GTKMM_DISABLE_DEPRECATED
307 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
convert_path_to_child_path(const Path & filter_path)308 Path TreeModelFilter::convert_path_to_child_path(const Path& filter_path)
309 {
310 return Gtk::TreePath(gtk_tree_model_filter_convert_path_to_child_path(gobj(), const_cast<GtkTreePath*>((filter_path).gobj())), false);
311 }
312 G_GNUC_END_IGNORE_DEPRECATIONS
313 #endif // GTKMM_DISABLE_DEPRECATED
314
convert_child_path_to_path(const Path & child_path) const315 Path TreeModelFilter::convert_child_path_to_path(const Path& child_path) const
316 {
317 return Gtk::TreePath(gtk_tree_model_filter_convert_child_path_to_path(const_cast<GtkTreeModelFilter*>(gobj()), const_cast<GtkTreePath*>((child_path).gobj())), false);
318 }
319
convert_path_to_child_path(const Path & filter_path) const320 Path TreeModelFilter::convert_path_to_child_path(const Path& filter_path) const
321 {
322 return Gtk::TreePath(gtk_tree_model_filter_convert_path_to_child_path(const_cast<GtkTreeModelFilter*>(gobj()), const_cast<GtkTreePath*>((filter_path).gobj())), false);
323 }
324
refilter()325 void TreeModelFilter::refilter()
326 {
327 gtk_tree_model_filter_refilter(gobj());
328 }
329
clear_cache()330 void TreeModelFilter::clear_cache()
331 {
332 gtk_tree_model_filter_clear_cache(gobj());
333 }
334
335
property_child_model() const336 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<TreeModel> > TreeModelFilter::property_child_model() const
337 {
338 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<TreeModel> >(this, "child-model");
339 }
340
property_virtual_root() const341 Glib::PropertyProxy_ReadOnly< TreeModel::Path > TreeModelFilter::property_virtual_root() const
342 {
343 return Glib::PropertyProxy_ReadOnly< TreeModel::Path >(this, "virtual-root");
344 }
345
346
347 } // namespace Gtk
348
349
350