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