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