1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = 
27  * outPack = gtk
28  * outFile = TreeModelT
29  * strct   = GtkTreeModel
30  * realStrct=
31  * ctorStrct=
32  * clss    = TreeModelT
33  * interf  = TreeModelIF
34  * class Code: Yes
35  * interface Code: Yes
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- gtk_tree_model_
42  * omit structs:
43  * 	- GtkTreeIter
44  * omit prefixes:
45  * 	- gtk_tree_row_reference_
46  * 	- gtk_tree_path_
47  * 	- gtk_tree_iter_
48  * omit code:
49  * 	- gtk_tree_model_get_value
50  * 	- gtk_tree_model_get_iter
51  * omit signals:
52  * imports:
53  * 	- glib.Str
54  * 	- gobject.Value
55  * 	- gtk.TreeIter
56  * 	- gtk.TreePath
57  * structWrap:
58  * 	- GValue* -> Value
59  * 	- GtkTreeIter* -> TreeIter
60  * 	- GtkTreePath* -> TreePath
61  * module aliases:
62  * local aliases:
63  * overrides:
64  */
65 
66 module gtk.TreeModelT;
67 
68 public  import gtkc.gtktypes;
69 
70 public import gtkc.gtk;
71 public import glib.ConstructionException;
72 public import gobject.ObjectG;
73 
74 public import gobject.Signals;
75 public  import gtkc.gdktypes;
76 
77 public import glib.Str;
78 public import gobject.Value;
79 public import gtk.TreeIter;
80 public import gtk.TreePath;
81 
82 
83 
84 
85 /**
86  * The GtkTreeModel interface defines a generic tree interface for
87  * use by the GtkTreeView widget. It is an abstract interface, and
88  * is designed to be usable with any appropriate data structure. The
89  * programmer just has to implement this interface on their own data
90  * type for it to be viewable by a GtkTreeView widget.
91  *
92  * The model is represented as a hierarchical tree of strongly-typed,
93  * columned data. In other words, the model can be seen as a tree where
94  * every node has different values depending on which column is being
95  * queried. The type of data found in a column is determined by using
96  * the GType system (ie. G_TYPE_INT, GTK_TYPE_BUTTON, G_TYPE_POINTER,
97  * etc). The types are homogeneous per column across all nodes. It is
98  * important to note that this interface only provides a way of examining
99  * a model and observing changes. The implementation of each individual
100  * model decides how and if changes are made.
101  *
102  * In order to make life simpler for programmers who do not need to
103  * write their own specialized model, two generic models are provided
104  * — the GtkTreeStore and the GtkListStore. To use these, the
105  * developer simply pushes data into these models as necessary. These
106  * models provide the data structure as well as all appropriate tree
107  * interfaces. As a result, implementing drag and drop, sorting, and
108  * storing data is trivial. For the vast majority of trees and lists,
109  * these two models are sufficient.
110  *
111  * Models are accessed on a node/column level of granularity. One can
112  * query for the value of a model at a certain node and a certain
113  * column on that node. There are two structures used to reference
114  * a particular node in a model. They are the GtkTreePath and the
115  * GtkTreeIter[4]. Most of the interface
116  * consists of operations on a GtkTreeIter.
117  *
118  * A path is essentially a potential node. It is a location on a model
119  * that may or may not actually correspond to a node on a specific
120  * model. The GtkTreePath struct can be converted into either an
121  * array of unsigned integers or a string. The string form is a list
122  * of numbers separated by a colon. Each number refers to the offset
123  * at that level. Thus, the path “0” refers to the root
124  * node and the path “2:4” refers to the fifth child of
125  * the third node.
126  *
127  * By contrast, a GtkTreeIter is a reference to a specific node on
128  * a specific model. It is a generic struct with an integer and three
129  * generic pointers. These are filled in by the model in a model-specific
130  * way. One can convert a path to an iterator by calling
131  * gtk_tree_model_get_iter(). These iterators are the primary way
132  * of accessing a model and are similar to the iterators used by
133  * GtkTextBuffer. They are generally statically allocated on the
134  * stack and only used for a short time. The model interface defines
135  * a set of operations using them for navigating the model.
136  *
137  * It is expected that models fill in the iterator with private data.
138  * For example, the GtkListStore model, which is internally a simple
139  * linked list, stores a list node in one of the pointers. The
140  * GtkTreeModelSort stores an array and an offset in two of the
141  * pointers. Additionally, there is an integer field. This field is
142  * generally filled with a unique stamp per model. This stamp is for
143  * catching errors resulting from using invalid iterators with a model.
144  *
145  * The lifecycle of an iterator can be a little confusing at first.
146  * Iterators are expected to always be valid for as long as the model
147  * is unchanged (and doesn't emit a signal). The model is considered
148  * to own all outstanding iterators and nothing needs to be done to
149  * free them from the user's point of view. Additionally, some models
150  * guarantee that an iterator is valid for as long as the node it refers
151  * to is valid (most notably the GtkTreeStore and GtkListStore).
152  * Although generally uninteresting, as one always has to allow for
153  * the case where iterators do not persist beyond a signal, some very
154  * important performance enhancements were made in the sort model.
155  * As a result, the GTK_TREE_MODEL_ITERS_PERSIST flag was added to
156  * indicate this behavior.
157  *
158  * To help show some common operation of a model, some examples are
159  * provided. The first example shows three ways of getting the iter at
160  * the location “3:2:5”. While the first method shown is
161  * easier, the second is much more common, as you often get paths from
162  * callbacks.
163  *
164  * $(DDOC_COMMENT example)
165  *
166  * This second example shows a quick way of iterating through a list
167  * and getting a string and an integer from each row. The
168  * populate_model function used below is not
169  * shown, as it is specific to the GtkListStore. For information on
170  * how to write such a function, see the GtkListStore documentation.
171  *
172  * $(DDOC_COMMENT example)
173  *
174  * The GtkTreeModel interface contains two methods for reference
175  * counting: gtk_tree_model_ref_node() and gtk_tree_model_unref_node().
176  * These two methods are optional to implement. The reference counting
177  * is meant as a way for views to let models know when nodes are being
178  * displayed. GtkTreeView will take a reference on a node when it is
179  * visible, which means the node is either in the toplevel or expanded.
180  * Being displayed does not mean that the node is currently directly
181  * visible to the user in the viewport. Based on this reference counting
182  * scheme a caching model, for example, can decide whether or not to cache
183  * a node based on the reference count. A file-system based model would
184  * not want to keep the entire file hierarchy in memory, but just the
185  * folders that are currently expanded in every current view.
186  *
187  * When working with reference counting, the following rules must be taken
188  * into account:
189  *
190  * Never take a reference on a node without owning a
191  * reference on its parent. This means that all parent nodes of a referenced
192  * node must be referenced as well.
193  *
194  * Outstanding references on a deleted node are not released.
195  * This is not possible because the node has already been deleted by the
196  * time the row-deleted signal is received.
197  *
198  * Models are not obligated to emit a signal on rows of
199  * which none of its siblings are referenced. To phrase this differently,
200  * signals are only required for levels in which nodes are referenced. For
201  * the root level however, signals must be emitted at all times (however the
202  * root level is always referenced when any view is attached).
203  */
204 public template TreeModelT(TStruct)
205 {
206 	
207 	/** the main Gtk struct */
208 	protected GtkTreeModel* gtkTreeModel;
209 	
210 	
211 	public GtkTreeModel* getTreeModelTStruct()
212 	{
213 		return cast(GtkTreeModel*)getStruct();
214 	}
215 	
216 	
217 	/**
218 	 * Get the value of a column as a char array.
219 	 * this is the same calling getValue and get the string from the value object
220 	 */
221 	string getValueString(TreeIter iter, int column)
222 	{
223 		Value value = getValue(iter, column);
224 		return value.getString();
225 	}
226 	
227 	/**
228 	 * Get the value of a column as a char array.
229 	 * this is the same calling getValue and get the int from the value object
230 	 */
231 	int getValueInt(TreeIter iter, int column)
232 	{
233 		Value value = getValue(iter, column);
234 		return value.getInt();
235 	}
236 	
237 	/**
238 	 * Sets iter to a valid iterator pointing to path.
239 	 * Params:
240 	 *  iter = The uninitialized GtkTreeIter.
241 	 *  path = The GtkTreePath.
242 	 * Returns:
243 	 *  TRUE, if iter was set.
244 	 */
245 	public int getIter(TreeIter iter, TreePath path)
246 	{
247 		// gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,  GtkTreeIter *iter,  GtkTreePath *path);
248 		iter.setModel(this);
249 		return gtk_tree_model_get_iter(
250 		getTreeModelTStruct(),
251 		(iter is null) ? null : iter.getTreeIterStruct(),
252 		(path is null) ? null : path.getTreePathStruct());
253 	}
254 	
255 	/**
256 	 * Initializes and sets value to that at column.
257 	 * When done with value, g_value_unset() needs to be called
258 	 * to free any allocated memory.
259 	 * Params:
260 	 * iter = The GtkTreeIter.
261 	 * column = The column to lookup the value at.
262 	 * value = (inout) (transfer none) An empty GValue to set.
263 	 */
264 	public Value getValue(TreeIter iter, int column, Value value = null)
265 	{
266 		if ( value is null )
267 		value = new Value();
268 		
269 		// void gtk_tree_model_get_value (GtkTreeModel *tree_model,  GtkTreeIter *iter,  gint column,  GValue *value);
270 		gtk_tree_model_get_value(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct(), column, (value is null) ? null : value.getValueStruct());
271 		
272 		return value;
273 	}
274 	
275 	/**
276 	 */
277 	int[string] connectedSignals;
278 	
279 	void delegate(TreePath, TreeIter, TreeModelIF)[] _onRowChangedListeners;
280 	@property void delegate(TreePath, TreeIter, TreeModelIF)[] onRowChangedListeners()
281 	{
282 		return  _onRowChangedListeners;
283 	}
284 	/**
285 	 * This signal is emitted when a row in the model has changed.
286 	 */
287 	void addOnRowChanged(void delegate(TreePath, TreeIter, TreeModelIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
288 	{
289 		if ( !("row-changed" in connectedSignals) )
290 		{
291 			Signals.connectData(
292 			getStruct(),
293 			"row-changed",
294 			cast(GCallback)&callBackRowChanged,
295 			cast(void*)cast(TreeModelIF)this,
296 			null,
297 			connectFlags);
298 			connectedSignals["row-changed"] = 1;
299 		}
300 		_onRowChangedListeners ~= dlg;
301 	}
302 	extern(C) static void callBackRowChanged(GtkTreeModel* treeModelStruct, GtkTreePath* path, GtkTreeIter* iter, TreeModelIF _treeModelIF)
303 	{
304 		foreach ( void delegate(TreePath, TreeIter, TreeModelIF) dlg ; _treeModelIF.onRowChangedListeners )
305 		{
306 			dlg(ObjectG.getDObject!(TreePath)(path), ObjectG.getDObject!(TreeIter)(iter), _treeModelIF);
307 		}
308 	}
309 	
310 	void delegate(TreePath, TreeModelIF)[] _onRowDeletedListeners;
311 	@property void delegate(TreePath, TreeModelIF)[] onRowDeletedListeners()
312 	{
313 		return  _onRowDeletedListeners;
314 	}
315 	/**
316 	 * This signal is emitted when a row has been deleted.
317 	 * Note that no iterator is passed to the signal handler,
318 	 * since the row is already deleted.
319 	 * This should be called by models after a row has been removed.
320 	 * The location pointed to by path should be the location that
321 	 * the row previously was at. It may not be a valid location anymore.
322 	 */
323 	void addOnRowDeleted(void delegate(TreePath, TreeModelIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
324 	{
325 		if ( !("row-deleted" in connectedSignals) )
326 		{
327 			Signals.connectData(
328 			getStruct(),
329 			"row-deleted",
330 			cast(GCallback)&callBackRowDeleted,
331 			cast(void*)cast(TreeModelIF)this,
332 			null,
333 			connectFlags);
334 			connectedSignals["row-deleted"] = 1;
335 		}
336 		_onRowDeletedListeners ~= dlg;
337 	}
338 	extern(C) static void callBackRowDeleted(GtkTreeModel* treeModelStruct, GtkTreePath* path, TreeModelIF _treeModelIF)
339 	{
340 		foreach ( void delegate(TreePath, TreeModelIF) dlg ; _treeModelIF.onRowDeletedListeners )
341 		{
342 			dlg(ObjectG.getDObject!(TreePath)(path), _treeModelIF);
343 		}
344 	}
345 	
346 	void delegate(TreePath, TreeIter, TreeModelIF)[] _onRowHasChildToggledListeners;
347 	@property void delegate(TreePath, TreeIter, TreeModelIF)[] onRowHasChildToggledListeners()
348 	{
349 		return  _onRowHasChildToggledListeners;
350 	}
351 	/**
352 	 * This signal is emitted when a row has gotten the first child
353 	 * row or lost its last child row.
354 	 */
355 	void addOnRowHasChildToggled(void delegate(TreePath, TreeIter, TreeModelIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
356 	{
357 		if ( !("row-has-child-toggled" in connectedSignals) )
358 		{
359 			Signals.connectData(
360 			getStruct(),
361 			"row-has-child-toggled",
362 			cast(GCallback)&callBackRowHasChildToggled,
363 			cast(void*)cast(TreeModelIF)this,
364 			null,
365 			connectFlags);
366 			connectedSignals["row-has-child-toggled"] = 1;
367 		}
368 		_onRowHasChildToggledListeners ~= dlg;
369 	}
370 	extern(C) static void callBackRowHasChildToggled(GtkTreeModel* treeModelStruct, GtkTreePath* path, GtkTreeIter* iter, TreeModelIF _treeModelIF)
371 	{
372 		foreach ( void delegate(TreePath, TreeIter, TreeModelIF) dlg ; _treeModelIF.onRowHasChildToggledListeners )
373 		{
374 			dlg(ObjectG.getDObject!(TreePath)(path), ObjectG.getDObject!(TreeIter)(iter), _treeModelIF);
375 		}
376 	}
377 	
378 	void delegate(TreePath, TreeIter, TreeModelIF)[] _onRowInsertedListeners;
379 	@property void delegate(TreePath, TreeIter, TreeModelIF)[] onRowInsertedListeners()
380 	{
381 		return  _onRowInsertedListeners;
382 	}
383 	/**
384 	 * This signal is emitted when a new row has been inserted in
385 	 * the model.
386 	 * Note that the row may still be empty at this point, since
387 	 * it is a common pattern to first insert an empty row, and
388 	 * then fill it with the desired values.
389 	 */
390 	void addOnRowInserted(void delegate(TreePath, TreeIter, TreeModelIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
391 	{
392 		if ( !("row-inserted" in connectedSignals) )
393 		{
394 			Signals.connectData(
395 			getStruct(),
396 			"row-inserted",
397 			cast(GCallback)&callBackRowInserted,
398 			cast(void*)cast(TreeModelIF)this,
399 			null,
400 			connectFlags);
401 			connectedSignals["row-inserted"] = 1;
402 		}
403 		_onRowInsertedListeners ~= dlg;
404 	}
405 	extern(C) static void callBackRowInserted(GtkTreeModel* treeModelStruct, GtkTreePath* path, GtkTreeIter* iter, TreeModelIF _treeModelIF)
406 	{
407 		foreach ( void delegate(TreePath, TreeIter, TreeModelIF) dlg ; _treeModelIF.onRowInsertedListeners )
408 		{
409 			dlg(ObjectG.getDObject!(TreePath)(path), ObjectG.getDObject!(TreeIter)(iter), _treeModelIF);
410 		}
411 	}
412 	
413 	void delegate(TreePath, TreeIter, void*, TreeModelIF)[] _onRowsReorderedListeners;
414 	@property void delegate(TreePath, TreeIter, void*, TreeModelIF)[] onRowsReorderedListeners()
415 	{
416 		return  _onRowsReorderedListeners;
417 	}
418 	/**
419 	 * This signal is emitted when the children of a node in the
420 	 * GtkTreeModel have been reordered.
421 	 * Note that this signal is not emitted
422 	 * when rows are reordered by DND, since this is implemented
423 	 * by removing and then reinserting the row.
424 	 * See Also
425 	 * GtkTreeView, GtkTreeStore, GtkListStore,
426 	 *  GtkTreeDnd,
427 	 *  GtkTreeSortable
428 	 * [4] Here, iter is short
429 	 * for “iterator”
430 	 */
431 	void addOnRowsReordered(void delegate(TreePath, TreeIter, void*, TreeModelIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
432 	{
433 		if ( !("rows-reordered" in connectedSignals) )
434 		{
435 			Signals.connectData(
436 			getStruct(),
437 			"rows-reordered",
438 			cast(GCallback)&callBackRowsReordered,
439 			cast(void*)cast(TreeModelIF)this,
440 			null,
441 			connectFlags);
442 			connectedSignals["rows-reordered"] = 1;
443 		}
444 		_onRowsReorderedListeners ~= dlg;
445 	}
446 	extern(C) static void callBackRowsReordered(GtkTreeModel* treeModelStruct, GtkTreePath* path, GtkTreeIter* iter, void* newOrder, TreeModelIF _treeModelIF)
447 	{
448 		foreach ( void delegate(TreePath, TreeIter, void*, TreeModelIF) dlg ; _treeModelIF.onRowsReorderedListeners )
449 		{
450 			dlg(ObjectG.getDObject!(TreePath)(path), ObjectG.getDObject!(TreeIter)(iter), newOrder, _treeModelIF);
451 		}
452 	}
453 	
454 	
455 	/**
456 	 * Returns a set of flags supported by this interface.
457 	 * The flags are a bitwise combination of GtkTreeModelFlags.
458 	 * The flags supported should not change during the lifetime
459 	 * of the tree_model.
460 	 * Returns: the flags supported by this interface
461 	 */
462 	public GtkTreeModelFlags getFlags()
463 	{
464 		// GtkTreeModelFlags gtk_tree_model_get_flags (GtkTreeModel *tree_model);
465 		return gtk_tree_model_get_flags(getTreeModelTStruct());
466 	}
467 	
468 	/**
469 	 * Returns the number of columns supported by tree_model.
470 	 * Returns: the number of columns
471 	 */
472 	public int getNColumns()
473 	{
474 		// gint gtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
475 		return gtk_tree_model_get_n_columns(getTreeModelTStruct());
476 	}
477 	
478 	/**
479 	 * Returns the type of the column.
480 	 * Params:
481 	 * index = the column index
482 	 * Returns: the type of the column. [transfer none]
483 	 */
484 	public GType getColumnType(int index)
485 	{
486 		// GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,  gint index_);
487 		return gtk_tree_model_get_column_type(getTreeModelTStruct(), index);
488 	}
489 	
490 	/**
491 	 * Sets iter to a valid iterator pointing to path_string, if it
492 	 * exists. Otherwise, iter is left invalid and FALSE is returned.
493 	 * Params:
494 	 * iter = an uninitialized GtkTreeIter. [out]
495 	 * pathString = a string representation of a GtkTreePath
496 	 * Returns: TRUE, if iter was set
497 	 */
498 	public int getIterFromString(TreeIter iter, string pathString)
499 	{
500 		// gboolean gtk_tree_model_get_iter_from_string (GtkTreeModel *tree_model,  GtkTreeIter *iter,  const gchar *path_string);
501 		return gtk_tree_model_get_iter_from_string(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct(), Str.toStringz(pathString));
502 	}
503 	
504 	/**
505 	 * Initializes iter with the first iterator in the tree
506 	 * (the one at the path "0") and returns TRUE. Returns
507 	 * FALSE if the tree is empty.
508 	 * Params:
509 	 * iter = the uninitialized GtkTreeIter. [out]
510 	 * Returns: TRUE, if iter was set
511 	 */
512 	public int getIterFirst(TreeIter iter)
513 	{
514 		// gboolean gtk_tree_model_get_iter_first (GtkTreeModel *tree_model,  GtkTreeIter *iter);
515 		return gtk_tree_model_get_iter_first(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct());
516 	}
517 	
518 	/**
519 	 * Returns a newly-created GtkTreePath referenced by iter.
520 	 * This path should be freed with gtk_tree_path_free().
521 	 * Params:
522 	 * iter = the GtkTreeIter
523 	 * Returns: a newly-created GtkTreePath
524 	 */
525 	public TreePath getPath(TreeIter iter)
526 	{
527 		// GtkTreePath * gtk_tree_model_get_path (GtkTreeModel *tree_model,  GtkTreeIter *iter);
528 		auto p = gtk_tree_model_get_path(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct());
529 		
530 		if(p is null)
531 		{
532 			return null;
533 		}
534 		
535 		return ObjectG.getDObject!(TreePath)(cast(GtkTreePath*) p);
536 	}
537 	
538 	/**
539 	 * Sets iter to point to the node following it at the current level.
540 	 * If there is no next iter, FALSE is returned and iter is set
541 	 * to be invalid.
542 	 * Params:
543 	 * iter = the GtkTreeIter. [in]
544 	 * Returns: TRUE if iter has been changed to the next node
545 	 */
546 	public int iterNext(TreeIter iter)
547 	{
548 		// gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model,  GtkTreeIter *iter);
549 		return gtk_tree_model_iter_next(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct());
550 	}
551 	
552 	/**
553 	 * Sets iter to point to the previous node at the current level.
554 	 * If there is no previous iter, FALSE is returned and iter is
555 	 * set to be invalid.
556 	 * Params:
557 	 * iter = the GtkTreeIter. [in]
558 	 * Returns: TRUE if iter has been changed to the previous node Since 3.0
559 	 */
560 	public int iterPrevious(TreeIter iter)
561 	{
562 		// gboolean gtk_tree_model_iter_previous (GtkTreeModel *tree_model,  GtkTreeIter *iter);
563 		return gtk_tree_model_iter_previous(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct());
564 	}
565 	
566 	/**
567 	 * Sets iter to point to the first child of parent.
568 	 * If parent has no children, FALSE is returned and iter is
569 	 * set to be invalid. parent will remain a valid node after this
570 	 * function has been called.
571 	 * If parent is NULL returns the first node, equivalent to
572 	 * gtk_tree_model_get_iter_first (tree_model, iter);
573 	 * Params:
574 	 * iter = the new GtkTreeIter to be set to the child. [out]
575 	 * parent = the GtkTreeIter, or NULL. [allow-none]
576 	 * Returns: TRUE, if child has been set to the first child
577 	 */
578 	public int iterChildren(TreeIter iter, TreeIter parent)
579 	{
580 		// gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model,  GtkTreeIter *iter,  GtkTreeIter *parent);
581 		return gtk_tree_model_iter_children(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct(), (parent is null) ? null : parent.getTreeIterStruct());
582 	}
583 	
584 	/**
585 	 * Returns TRUE if iter has children, FALSE otherwise.
586 	 * Params:
587 	 * iter = the GtkTreeIter to test for children
588 	 * Returns: TRUE if iter has children
589 	 */
590 	public int iterHasChild(TreeIter iter)
591 	{
592 		// gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,  GtkTreeIter *iter);
593 		return gtk_tree_model_iter_has_child(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct());
594 	}
595 	
596 	/**
597 	 * Returns the number of children that iter has.
598 	 * As a special case, if iter is NULL, then the number
599 	 * of toplevel nodes is returned.
600 	 * Params:
601 	 * iter = the GtkTreeIter, or NULL. [allow-none]
602 	 * Returns: the number of children of iter
603 	 */
604 	public int iterNChildren(TreeIter iter)
605 	{
606 		// gint gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,  GtkTreeIter *iter);
607 		return gtk_tree_model_iter_n_children(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct());
608 	}
609 	
610 	/**
611 	 * Sets iter to be the child of parent, using the given index.
612 	 * The first index is 0. If n is too big, or parent has no children,
613 	 * iter is set to an invalid iterator and FALSE is returned. parent
614 	 * will remain a valid node after this function has been called. As a
615 	 * special case, if parent is NULL, then the nth root node
616 	 * is set.
617 	 * Params:
618 	 * iter = the GtkTreeIter to set to the nth child. [out]
619 	 * parent = the GtkTreeIter to get the child from, or NULL. [allow-none]
620 	 * n = the index of the desired child
621 	 * Returns: TRUE, if parent has an nth child
622 	 */
623 	public int iterNthChild(TreeIter iter, TreeIter parent, int n)
624 	{
625 		// gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,  GtkTreeIter *iter,  GtkTreeIter *parent,  gint n);
626 		return gtk_tree_model_iter_nth_child(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct(), (parent is null) ? null : parent.getTreeIterStruct(), n);
627 	}
628 	
629 	/**
630 	 * Sets iter to be the parent of child.
631 	 * If child is at the toplevel, and doesn't have a parent, then
632 	 * iter is set to an invalid iterator and FALSE is returned.
633 	 * child will remain a valid node after this function has been
634 	 * called.
635 	 * Params:
636 	 * iter = the new GtkTreeIter to set to the parent. [out]
637 	 * child = the GtkTreeIter
638 	 * Returns: TRUE, if iter is set to the parent of child
639 	 */
640 	public int iterParent(TreeIter iter, TreeIter child)
641 	{
642 		// gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,  GtkTreeIter *iter,  GtkTreeIter *child);
643 		return gtk_tree_model_iter_parent(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct(), (child is null) ? null : child.getTreeIterStruct());
644 	}
645 	
646 	/**
647 	 * Generates a string representation of the iter.
648 	 * This string is a ':' separated list of numbers.
649 	 * For example, "4:10:0:3" would be an acceptable
650 	 * return value for this string.
651 	 * Since 2.2
652 	 * Params:
653 	 * iter = a GtkTreeIter
654 	 * Returns: a newly-allocated string. Must be freed with g_free().
655 	 */
656 	public string getStringFromIter(TreeIter iter)
657 	{
658 		// gchar * gtk_tree_model_get_string_from_iter (GtkTreeModel *tree_model,  GtkTreeIter *iter);
659 		return Str.toString(gtk_tree_model_get_string_from_iter(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct()));
660 	}
661 	
662 	/**
663 	 * Lets the tree ref the node.
664 	 * This is an optional method for models to implement.
665 	 * To be more specific, models may ignore this call as it exists
666 	 * primarily for performance reasons.
667 	 * This function is primarily meant as a way for views to let
668 	 * caching models know when nodes are being displayed (and hence,
669 	 * whether or not to cache that node). Being displayed means a node
670 	 * is in an expanded branch, regardless of whether the node is currently
671 	 * visible in the viewport. For example, a file-system based model
672 	 * would not want to keep the entire file-hierarchy in memory,
673 	 * just the sections that are currently being displayed by
674 	 * every current view.
675 	 * A model should be expected to be able to get an iter independent
676 	 * of its reffed state.
677 	 * Params:
678 	 * iter = the GtkTreeIter
679 	 */
680 	public void refNode(TreeIter iter)
681 	{
682 		// void gtk_tree_model_ref_node (GtkTreeModel *tree_model,  GtkTreeIter *iter);
683 		gtk_tree_model_ref_node(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct());
684 	}
685 	
686 	/**
687 	 * Lets the tree unref the node.
688 	 * This is an optional method for models to implement.
689 	 * To be more specific, models may ignore this call as it exists
690 	 * primarily for performance reasons. For more information on what
691 	 * this means, see gtk_tree_model_ref_node().
692 	 * Please note that nodes that are deleted are not unreffed.
693 	 * Params:
694 	 * iter = the GtkTreeIter
695 	 */
696 	public void unrefNode(TreeIter iter)
697 	{
698 		// void gtk_tree_model_unref_node (GtkTreeModel *tree_model,  GtkTreeIter *iter);
699 		gtk_tree_model_unref_node(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct());
700 	}
701 	
702 	/**
703 	 * See gtk_tree_model_get(), this version takes a va_list
704 	 * for language bindings to use.
705 	 * Params:
706 	 * iter = a row in tree_model
707 	 * varArgs = va_list of column/return location pairs
708 	 */
709 	public void getValist(TreeIter iter, void* varArgs)
710 	{
711 		// void gtk_tree_model_get_valist (GtkTreeModel *tree_model,  GtkTreeIter *iter,  va_list var_args);
712 		gtk_tree_model_get_valist(getTreeModelTStruct(), (iter is null) ? null : iter.getTreeIterStruct(), varArgs);
713 	}
714 	
715 	/**
716 	 * Calls func on each node in model in a depth-first fashion.
717 	 * If func returns TRUE, then the tree ceases to be walked,
718 	 * and gtk_tree_model_foreach() returns.
719 	 * Params:
720 	 * func = a function to be called on each row. [scope call]
721 	 * userData = user data to passed to func
722 	 */
723 	public void foreac(GtkTreeModelForeachFunc func, void* userData)
724 	{
725 		// void gtk_tree_model_foreach (GtkTreeModel *model,  GtkTreeModelForeachFunc func,  gpointer user_data);
726 		gtk_tree_model_foreach(getTreeModelTStruct(), func, userData);
727 	}
728 	
729 	/**
730 	 * Emits the "row-changed" signal on tree_model.
731 	 * Params:
732 	 * path = a GtkTreePath pointing to the changed row
733 	 * iter = a valid GtkTreeIter pointing to the changed row
734 	 */
735 	public void rowChanged(TreePath path, TreeIter iter)
736 	{
737 		// void gtk_tree_model_row_changed (GtkTreeModel *tree_model,  GtkTreePath *path,  GtkTreeIter *iter);
738 		gtk_tree_model_row_changed(getTreeModelTStruct(), (path is null) ? null : path.getTreePathStruct(), (iter is null) ? null : iter.getTreeIterStruct());
739 	}
740 	
741 	/**
742 	 * Emits the "row-inserted" signal on tree_model.
743 	 * Params:
744 	 * path = a GtkTreePath pointing to the inserted row
745 	 * iter = a valid GtkTreeIter pointing to the inserted row
746 	 */
747 	public void rowInserted(TreePath path, TreeIter iter)
748 	{
749 		// void gtk_tree_model_row_inserted (GtkTreeModel *tree_model,  GtkTreePath *path,  GtkTreeIter *iter);
750 		gtk_tree_model_row_inserted(getTreeModelTStruct(), (path is null) ? null : path.getTreePathStruct(), (iter is null) ? null : iter.getTreeIterStruct());
751 	}
752 	
753 	/**
754 	 * Emits the "row-has-child-toggled" signal on
755 	 * tree_model. This should be called by models after the child
756 	 * state of a node changes.
757 	 * Params:
758 	 * path = a GtkTreePath pointing to the changed row
759 	 * iter = a valid GtkTreeIter pointing to the changed row
760 	 */
761 	public void rowHasChildToggled(TreePath path, TreeIter iter)
762 	{
763 		// void gtk_tree_model_row_has_child_toggled  (GtkTreeModel *tree_model,  GtkTreePath *path,  GtkTreeIter *iter);
764 		gtk_tree_model_row_has_child_toggled(getTreeModelTStruct(), (path is null) ? null : path.getTreePathStruct(), (iter is null) ? null : iter.getTreeIterStruct());
765 	}
766 	
767 	/**
768 	 * Emits the "row-deleted" signal on tree_model.
769 	 * This should be called by models after a row has been removed.
770 	 * The location pointed to by path should be the location that
771 	 * the row previously was at. It may not be a valid location anymore.
772 	 * Nodes that are deleted are not unreffed, this means that any
773 	 * outstanding references on the deleted node should not be released.
774 	 * Params:
775 	 * path = a GtkTreePath pointing to the previous location of
776 	 * the deleted row
777 	 */
778 	public void rowDeleted(TreePath path)
779 	{
780 		// void gtk_tree_model_row_deleted (GtkTreeModel *tree_model,  GtkTreePath *path);
781 		gtk_tree_model_row_deleted(getTreeModelTStruct(), (path is null) ? null : path.getTreePathStruct());
782 	}
783 	
784 	/**
785 	 * Emits the "rows-reordered" signal on tree_model.
786 	 * This should be called by models when their rows have been
787 	 * reordered.
788 	 * Params:
789 	 * path = a GtkTreePath pointing to the tree node whose children
790 	 * have been reordered
791 	 * iter = a valid GtkTreeIter pointing to the node whose children
792 	 * have been reordered, or NULL if the depth of path is 0
793 	 * newOrder = an array of integers mapping the current position of
794 	 * each child to its old position before the re-ordering,
795 	 * i.e. new_order[newpos] = oldpos
796 	 * Signal Details
797 	 * The "row-changed" signal
798 	 * void user_function (GtkTreeModel *tree_model,
799 	 *  GtkTreePath *path,
800 	 *  GtkTreeIter *iter,
801 	 *  gpointer user_data) : Run Last
802 	 * This signal is emitted when a row in the model has changed.
803 	 * path = a GtkTreePath identifying the changed row
804 	 * iter = a valid GtkTreeIter pointing to the changed row
805 	 */
806 	public void rowsReordered(TreePath path, TreeIter iter, int[] newOrder)
807 	{
808 		// void gtk_tree_model_rows_reordered (GtkTreeModel *tree_model,  GtkTreePath *path,  GtkTreeIter *iter,  gint *new_order);
809 		gtk_tree_model_rows_reordered(getTreeModelTStruct(), (path is null) ? null : path.getTreePathStruct(), (iter is null) ? null : iter.getTreeIterStruct(), newOrder.ptr);
810 	}
811 }