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