I've no idea here...
[gtkD.git] / src / gtk / TreeModel.d
blobba793e8fede80819075cc136e8f547b4a430f561
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkTreeModel.html
26 * outPack = gtk
27 * outFile = TreeModel
28 * strct = GtkTreeModel
29 * realStrct=
30 * ctorStrct=
31 * clss = TreeModel
32 * interf =
33 * class Code: Yes
34 * interface Code: Yes
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_tree_model_
40 * omit structs:
41 * omit prefixes:
42 * - gtk_tree_row_reference_
43 * - gtk_tree_path_
44 * - gtk_tree_iter_
45 * omit code:
46 * - gtk_tree_model_get_iter
47 * imports:
48 * - glib.Str
49 * - gtk.TreeIter
50 * - gtk.TreePath
51 * - gobject.Value
52 * structWrap:
53 * - GValue* -> Value
54 * - GtkTreeIter* -> TreeIter
55 * - GtkTreePath* -> TreePath
56 * local aliases:
59 module gtk.TreeModel;
61 private import gtk.gtktypes;
63 private import lib.gtk;
65 private import glib.Str;
66 private import gtk.TreeIter;
67 private import gtk.TreePath;
68 private import gobject.Value;
70 /**
71 * Description
72 * The GtkTreeModel interface defines a generic tree interface for use by
73 * the GtkTreeView widget. It is an abstract interface, and is designed
74 * to be usable with any appropriate data structure. The programmer just
75 * has to implement this interface on their own data type for it to be
76 * viewable by a GtkTreeView widget.
77 * The model is represented as a hierarchical tree of strongly-typed,
78 * columned data. In other words, the model can be seen as a tree where
79 * every node has different values depending on which column is being
80 * queried. The type of data found in a column is determined by using the
81 * GType system (ie. G_TYPE_INT, GTK_TYPE_BUTTON, G_TYPE_POINTER, etc.).
82 * The types are homogeneous per column across all nodes. It is important
83 * to note that this interface only provides a way of examining a model and
84 * observing changes. The implementation of each individual model decides
85 * how and if changes are made.
86 * In order to make life simpler for programmers who do not need to write
87 * their own specialized model, two generic models are provided the
88 * GtkTreeStore and the GtkListStore. To use these, the developer simply
89 * pushes data into these models as necessary. These models provide the
90 * data structure as well as all appropriate tree interfaces. As a result,
91 * implementing drag and drop, sorting, and storing data is trivial. For
92 * the vast majority of trees and lists, these two models are sufficient.
93 * Models are accessed on a node/column level of granularity. One can
94 * query for the value of a model at a certain node and a certain column
95 * on that node. There are two structures used to reference a particular
96 * node in a model. They are the GtkTreePath and the GtkTreeIter
97 * [4]
98 * Most of the interface consists of operations on a GtkTreeIter.
99 * A path is essentially a potential node. It is a location on a model
100 * that may or may not actually correspond to a node on a specific model.
101 * The GtkTreePath struct can be converted into either an array of
102 * unsigned integers or a string. The string form is a list of numbers
103 * separated by a colon. Each number refers to the offset at that level.
104 * Thus, the path 0 refers to the root node and the path
105 * 2:4 refers to the fifth child of the third node.
106 * By contrast, a GtkTreeIter is a reference to a specific node on a
107 * specific model. It is a generic struct with an integer and three
108 * generic pointers. These are filled in by the model in a model-specific
109 * way. One can convert a path to an iterator by calling
110 * gtk_tree_model_get_iter(). These iterators are the primary way of
111 * accessing a model and are similar to the iterators used by
112 * GtkTextBuffer. They are generally statically allocated on the stack and
113 * only used for a short time. The model interface defines a set of
114 * operations using them for navigating the model.
115 * It is expected that models fill in the iterator with private data. For
116 * example, the GtkListStore model, which is internally a simple linked
117 * list, stores a list node in one of the pointers. The GtkTreeModelSort
118 * stores an array and an offset in two of the pointers. Additionally,
119 * there is an integer field. This field is generally filled with a unique
120 * stamp per model. This stamp is for catching errors resulting from using
121 * invalid iterators with a model.
122 * The lifecycle of an iterator can be a little confusing at first.
123 * Iterators are expected to always be valid for as long as the model is
124 * unchanged (and doesn't emit a signal). The model is considered to own
125 * all outstanding iterators and nothing needs to be done to free them from
126 * the user's point of view. Additionally, some models guarantee that an
127 * iterator is valid for as long as the node it refers to is valid (most
128 * notably the GtkTreeStore and GtkListStore). Although generally
129 * uninteresting, as one always has to allow for the case where iterators
130 * do not persist beyond a signal, some very important performance
131 * enhancements were made in the sort model. As a result, the
132 * GTK_TREE_MODEL_ITERS_PERSIST flag was added to indicate this behavior.
133 * To help show some common operation of a model, some examples are
134 * provided. The first example shows three ways of getting the iter at the
135 * location 3:2:5. While the first method shown is easier,
136 * the second is much more common, as you often get paths from callbacks.
137 * Example1.Acquiring a GtkTreeIter
138 * /+* Three ways of getting the iter pointing to the location
139 * +/
141 * GtkTreePath *path;
142 * GtkTreeIter iter;
143 * GtkTreeIter parent_iter;
144 * /+* get the iterator from a string +/
145 * gtk_tree_model_get_iter_from_string (model, iter, "3:2:5");
146 * /+* get the iterator from a path +/
147 * path = gtk_tree_path_new_from_string ("3:2:5");
148 * gtk_tree_model_get_iter (model, iter, path);
149 * gtk_tree_path_free (path);
150 * /+* walk the tree to find the iterator +/
151 * gtk_tree_model_iter_nth_child (model, iter, NULL, 3);
152 * parent_iter = iter;
153 * gtk_tree_model_iter_nth_child (model, iter, parent_iter, 2);
154 * parent_iter = iter;
155 * gtk_tree_model_iter_nth_child (model, iter, parent_iter, 5);
157 * This second example shows a quick way of iterating through a list and
158 * getting a string and an integer from each row. The
159 * populate_model function used below is not shown, as
160 * it is specific to the GtkListStore. For information on how to write
161 * such a function, see the GtkListStore documentation.
162 * Example2.Reading data from a GtkTreeModel
163 * enum
165 * STRING_COLUMN,
166 * INT_COLUMN,
167 * N_COLUMNS
168 * };
170 * GtkTreeModel *list_store;
171 * GtkTreeIter iter;
172 * gboolean valid;
173 * gint row_count = 0;
174 * /+* make a new list_store +/
175 * list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
176 * /+* Fill the list store with data +/
177 * populate_model (list_store);
178 * /+* Get the first iter in the list +/
179 * valid = gtk_tree_model_get_iter_first (list_store, iter);
180 * while (valid)
182 * /+* Walk through the list, reading each row +/
183 * gchar *str_data;
184 * gint int_data;
185 * /+* Make sure you terminate calls to gtk_tree_model_get()
186 * * with a '-1' value
187 * +/
188 * gtk_tree_model_get (list_store, iter,
189 * STRING_COLUMN, str_data,
190 * INT_COLUMN, int_data,
191 * -1);
192 * /+* Do something with the data +/
193 * g_print ("Row %d: (%s,%d)\n", row_count, str_data, int_data);
194 * g_free (str_data);
195 * row_count ++;
196 * valid = gtk_tree_model_iter_next (list_store, iter);
200 public class TreeModel
203 /** the main Gtk struct */
204 protected GtkTreeModel* gtkTreeModel;
207 public GtkTreeModel* getTreeModelStruct()
209 return gtkTreeModel;
213 /** the main Gtk struct as a void* */
214 protected void* getStruct()
216 return cast(void*)gtkTreeModel;
220 * Sets our main struct and passes it to the parent class
222 public this (GtkTreeModel* gtkTreeModel)
224 this.gtkTreeModel = gtkTreeModel;
228 * Get the value of a column as a char array.
229 * this is the same calling getValue and get the string from the value object
231 char[] getValueString(TreeIter iter, int column)
233 Value value = new Value();
234 getValue(iter, column, value);
235 return value.getString();
239 * Get the value of a column as a char array.
240 * this is the same calling getValue and get the int from the value object
242 int getValueInt(TreeIter iter, int column)
244 Value value = new Value();
245 getValue(iter, column, value);
246 return value.getInt();
250 * Sets iter to a valid iterator pointing to path.
251 * tree_model:
252 * A GtkTreeModel.
253 * iter:
254 * The uninitialized GtkTreeIter.
255 * path:
256 * The GtkTreePath.
257 * Returns:
258 * TRUE, if iter was set.
260 public int getIter(TreeIter iter, TreePath path)
262 // gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreePath *path);
263 iter.setModel(this);
264 return gtk_tree_model_get_iter(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct(), (path is null) ? null : path.getTreePathStruct());
270 // imports for the signal processing
271 private import gobject.Signals;
272 private import gdk.gdktypes;
273 int[char[]] connectedSignals;
275 void delegate(TreePath, TreeIter, TreeModel)[] onRowChangedListeners;
276 void addOnRowChanged(void delegate(TreePath, TreeIter, TreeModel) dlg)
278 if ( !("row-changed" in connectedSignals) )
280 Signals.connectData(
281 getStruct(),
282 "row-changed",
283 cast(GCallback)&callBackRowChanged,
284 this,
285 null,
286 cast(ConnectFlags)0);
287 connectedSignals["row-changed"] = 1;
289 onRowChangedListeners ~= dlg;
291 extern(C) static void callBackRowChanged(GtkTreeModel* treeModelStruct, GtkTreePath* path, GtkTreeIter* iter, TreeModel treeModel)
293 bit consumed = false;
295 foreach ( void delegate(TreePath, TreeIter, TreeModel) dlg ; treeModel.onRowChangedListeners )
297 dlg(new TreePath(path), new TreeIter(iter), treeModel);
300 return consumed;
303 void delegate(TreePath, TreeModel)[] onRowDeletedListeners;
304 void addOnRowDeleted(void delegate(TreePath, TreeModel) dlg)
306 if ( !("row-deleted" in connectedSignals) )
308 Signals.connectData(
309 getStruct(),
310 "row-deleted",
311 cast(GCallback)&callBackRowDeleted,
312 this,
313 null,
314 cast(ConnectFlags)0);
315 connectedSignals["row-deleted"] = 1;
317 onRowDeletedListeners ~= dlg;
319 extern(C) static void callBackRowDeleted(GtkTreeModel* treeModelStruct, GtkTreePath* path, TreeModel treeModel)
321 bit consumed = false;
323 foreach ( void delegate(TreePath, TreeModel) dlg ; treeModel.onRowDeletedListeners )
325 dlg(new TreePath(path), treeModel);
328 return consumed;
331 void delegate(TreePath, TreeIter, TreeModel)[] onRowHasChildToggledListeners;
332 void addOnRowHasChildToggled(void delegate(TreePath, TreeIter, TreeModel) dlg)
334 if ( !("row-has-child-toggled" in connectedSignals) )
336 Signals.connectData(
337 getStruct(),
338 "row-has-child-toggled",
339 cast(GCallback)&callBackRowHasChildToggled,
340 this,
341 null,
342 cast(ConnectFlags)0);
343 connectedSignals["row-has-child-toggled"] = 1;
345 onRowHasChildToggledListeners ~= dlg;
347 extern(C) static void callBackRowHasChildToggled(GtkTreeModel* treeModelStruct, GtkTreePath* path, GtkTreeIter* iter, TreeModel treeModel)
349 bit consumed = false;
351 foreach ( void delegate(TreePath, TreeIter, TreeModel) dlg ; treeModel.onRowHasChildToggledListeners )
353 dlg(new TreePath(path), new TreeIter(iter), treeModel);
356 return consumed;
359 void delegate(TreePath, TreeIter, TreeModel)[] onRowInsertedListeners;
360 void addOnRowInserted(void delegate(TreePath, TreeIter, TreeModel) dlg)
362 if ( !("row-inserted" in connectedSignals) )
364 Signals.connectData(
365 getStruct(),
366 "row-inserted",
367 cast(GCallback)&callBackRowInserted,
368 this,
369 null,
370 cast(ConnectFlags)0);
371 connectedSignals["row-inserted"] = 1;
373 onRowInsertedListeners ~= dlg;
375 extern(C) static void callBackRowInserted(GtkTreeModel* treeModelStruct, GtkTreePath* path, GtkTreeIter* iter, TreeModel treeModel)
377 bit consumed = false;
379 foreach ( void delegate(TreePath, TreeIter, TreeModel) dlg ; treeModel.onRowInsertedListeners )
381 dlg(new TreePath(path), new TreeIter(iter), treeModel);
384 return consumed;
387 void delegate(TreePath, TreeIter, gpointer, TreeModel)[] onRowsReorderedListeners;
388 void addOnRowsReordered(void delegate(TreePath, TreeIter, gpointer, TreeModel) dlg)
390 if ( !("rows-reordered" in connectedSignals) )
392 Signals.connectData(
393 getStruct(),
394 "rows-reordered",
395 cast(GCallback)&callBackRowsReordered,
396 this,
397 null,
398 cast(ConnectFlags)0);
399 connectedSignals["rows-reordered"] = 1;
401 onRowsReorderedListeners ~= dlg;
403 extern(C) static void callBackRowsReordered(GtkTreeModel* treeModelStruct, GtkTreePath* path, GtkTreeIter* iter, gpointer arg3, TreeModel treeModel)
405 bit consumed = false;
407 foreach ( void delegate(TreePath, TreeIter, gpointer, TreeModel) dlg ; treeModel.onRowsReorderedListeners )
409 dlg(new TreePath(path), new TreeIter(iter), arg3, treeModel);
412 return consumed;
455 * Returns a set of flags supported by this interface. The flags are a bitwise
456 * combination of GtkTreeModelFlags. The flags supported should not change
457 * during the lifecycle of the tree_model.
458 * tree_model:
459 * A GtkTreeModel.
460 * Returns:
461 * The flags supported by this interface.
463 public GtkTreeModelFlags getFlags()
465 // GtkTreeModelFlags gtk_tree_model_get_flags (GtkTreeModel *tree_model);
466 return gtk_tree_model_get_flags(gtkTreeModel);
470 * Returns the number of columns supported by tree_model.
471 * tree_model:
472 * A GtkTreeModel.
473 * Returns:
474 * The number of columns.
476 public int getNColumns()
478 // gint gtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
479 return gtk_tree_model_get_n_columns(gtkTreeModel);
483 * Returns the type of the column.
484 * tree_model:
485 * A GtkTreeModel.
486 * index_:
487 * The column index.
488 * Returns:
489 * The type of the column.
491 public GType getColumnType(int index)
493 // GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model, gint index_);
494 return gtk_tree_model_get_column_type(gtkTreeModel, index);
499 * Sets iter to a valid iterator pointing to path_string, if it
500 * exists. Otherwise, iter is left invalid and FALSE is returned.
501 * tree_model:
502 * A GtkTreeModel.
503 * iter:
504 * An uninitialized GtkTreeIter.
505 * path_string:
506 * A string representation of a GtkTreePath.
507 * Returns:
508 * TRUE, if iter was set.
510 public int getIterFromString(TreeIter iter, char[] pathString)
512 // gboolean gtk_tree_model_get_iter_from_string (GtkTreeModel *tree_model, GtkTreeIter *iter, const gchar *path_string);
513 return gtk_tree_model_get_iter_from_string(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct(), Str.toStringz(pathString));
517 * Initializes iter with the first iterator in the tree (the one at the path
518 * "0") and returns TRUE. Returns FALSE if the tree is empty.
519 * tree_model:
520 * A GtkTreeModel.
521 * iter:
522 * The uninitialized GtkTreeIter.
523 * Returns:
524 * TRUE, if iter was set.
526 public int getIterFirst(TreeIter iter)
528 // gboolean gtk_tree_model_get_iter_first (GtkTreeModel *tree_model, GtkTreeIter *iter);
529 return gtk_tree_model_get_iter_first(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct());
534 * Returns a newly-created GtkTreePath referenced by iter. This path should
535 * be freed with gtk_tree_path_free().
536 * tree_model:
537 * A GtkTreeModel.
538 * iter:
539 * The GtkTreeIter.
540 * Returns:
541 * a newly-created GtkTreePath.
543 public TreePath getPath(TreeIter iter)
545 // GtkTreePath* gtk_tree_model_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter);
546 return new TreePath( gtk_tree_model_get_path(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct()) );
550 * Sets initializes and sets value to that at column. When done with value,
551 * g_value_unset() needs to be called to free any allocated memory.
552 * tree_model:
553 * A GtkTreeModel.
554 * iter:
555 * The GtkTreeIter.
556 * column:
557 * The column to lookup the value at.
558 * value:
559 * An empty GValue to set.
561 public void getValue(TreeIter iter, int column, Value value)
563 // void gtk_tree_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value);
564 gtk_tree_model_get_value(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct(), column, (value is null) ? null : value.getValueStruct());
568 * Sets iter to point to the node following it at the current level. If there
569 * is no next iter, FALSE is returned and iter is set to be invalid.
570 * tree_model:
571 * A GtkTreeModel.
572 * iter:
573 * The GtkTreeIter.
574 * Returns:
575 * TRUE if iter has been changed to the next node.
577 public int iterNext(TreeIter iter)
579 // gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter);
580 return gtk_tree_model_iter_next(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct());
584 * Sets iter to point to the first child of parent. If parent has no
585 * children, FALSE is returned and iter is set to be invalid. parent
586 * will remain a valid node after this function has been called.
587 * If parent is NULL returns the first node, equivalent to
588 * gtk_tree_model_get_iter_first (tree_model, iter);
589 * tree_model:
590 * A GtkTreeModel.
591 * iter:
592 * The new GtkTreeIter to be set to the child.
593 * parent:
594 * The GtkTreeIter, or NULL
595 * Returns:
596 * TRUE, if child has been set to the first child.
598 public int iterChildren(TreeIter iter, TreeIter parent)
600 // gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent);
601 return gtk_tree_model_iter_children(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct(), (parent is null) ? null : parent.getTreeIterStruct());
605 * Returns TRUE if iter has children, FALSE otherwise.
606 * tree_model:
607 * A GtkTreeModel.
608 * iter:
609 * The GtkTreeIter to test for children.
610 * Returns:
611 * TRUE if iter has children.
613 public int iterHasChild(TreeIter iter)
615 // gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model, GtkTreeIter *iter);
616 return gtk_tree_model_iter_has_child(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct());
620 * Returns the number of children that iter has. As a special case, if iter
621 * is NULL, then the number of toplevel nodes is returned.
622 * tree_model:
623 * A GtkTreeModel.
624 * iter:
625 * The GtkTreeIter, or NULL.
626 * Returns:
627 * The number of children of iter.
629 public int iterNChildren(TreeIter iter)
631 // gint gtk_tree_model_iter_n_children (GtkTreeModel *tree_model, GtkTreeIter *iter);
632 return gtk_tree_model_iter_n_children(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct());
636 * Sets iter to be the child of parent, using the given index. The first
637 * index is 0. If n is too big, or parent has no children, iter is set
638 * to an invalid iterator and FALSE is returned. parent will remain a valid
639 * node after this function has been called. As a special case, if parent is
640 * NULL, then the nth root node is set.
641 * tree_model:
642 * A GtkTreeModel.
643 * iter:
644 * The GtkTreeIter to set to the nth child.
645 * parent:
646 * The GtkTreeIter to get the child from, or NULL.
647 * n:
648 * Then index of the desired child.
649 * Returns:
650 * TRUE, if parent has an nth child.
652 public int iterNthChild(TreeIter iter, TreeIter parent, int n)
654 // gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n);
655 return gtk_tree_model_iter_nth_child(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct(), (parent is null) ? null : parent.getTreeIterStruct(), n);
659 * Sets iter to be the parent of child. If child is at the toplevel, and
660 * doesn't have a parent, then iter is set to an invalid iterator and FALSE
661 * is returned. child will remain a valid node after this function has been
662 * called.
663 * tree_model:
664 * A GtkTreeModel
665 * iter:
666 * The new GtkTreeIter to set to the parent.
667 * child:
668 * The GtkTreeIter.
669 * Returns:
670 * TRUE, if iter is set to the parent of child.
672 public int iterParent(TreeIter iter, TreeIter child)
674 // gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child);
675 return gtk_tree_model_iter_parent(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct(), (child is null) ? null : child.getTreeIterStruct());
679 * Generates a string representation of the iter. This string is a ':'
680 * separated list of numbers. For example, "4:10:0:3" would be an
681 * acceptable return value for this string.
682 * tree_model:
683 * A GtkTreeModel.
684 * iter:
685 * An GtkTreeIter.
686 * Returns:
687 * A newly-allocated string. Must be freed with g_free().
688 * Since 2.2
690 public char[] getStringFromIter(TreeIter iter)
692 // gchar* gtk_tree_model_get_string_from_iter (GtkTreeModel *tree_model, GtkTreeIter *iter);
693 return Str.toString(gtk_tree_model_get_string_from_iter(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct()) );
697 * Lets the tree ref the node. This is an optional method for models to
698 * implement. To be more specific, models may ignore this call as it exists
699 * primarily for performance reasons.
700 * This function is primarily meant as a way for views to let caching model
701 * know when nodes are being displayed (and hence, whether or not to cache that
702 * node.) For example, a file-system based model would not want to keep the
703 * entire file-hierarchy in memory, just the sections that are currently being
704 * displayed by every current view.
705 * A model should be expected to be able to get an iter independent of its
706 * reffed state.
707 * tree_model:
708 * A GtkTreeModel.
709 * iter:
710 * The GtkTreeIter.
712 public void refNode(TreeIter iter)
714 // void gtk_tree_model_ref_node (GtkTreeModel *tree_model, GtkTreeIter *iter);
715 gtk_tree_model_ref_node(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct());
719 * Lets the tree unref the node. This is an optional method for models to
720 * implement. To be more specific, models may ignore this call as it exists
721 * primarily for performance reasons.
722 * For more information on what this means, see gtk_tree_model_ref_node().
723 * Please note that nodes that are deleted are not unreffed.
724 * tree_model:
725 * A GtkTreeModel.
726 * iter:
727 * The GtkTreeIter.
729 public void unrefNode(TreeIter iter)
731 // void gtk_tree_model_unref_node (GtkTreeModel *tree_model, GtkTreeIter *iter);
732 gtk_tree_model_unref_node(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct());
736 * Gets the value of one or more cells in the row referenced by iter.
737 * The variable argument list should contain integer column numbers,
738 * each column number followed by a place to store the value being
739 * retrieved. The list is terminated by a -1. For example, to get a
740 * value from column 0 with type G_TYPE_STRING, you would
741 * write: gtk_tree_model_get (model, iter, 0, place_string_here, -1),
742 * where place_string_here is a gchar* to be
743 * filled with the string.
744 * If appropriate, the returned values have to be freed or unreferenced.
745 * tree_model:
746 * a GtkTreeModel
747 * iter:
748 * a row in tree_model
749 * ...:
750 * pairs of column number and value return locations, terminated by -1
752 public void get(TreeIter iter, ... )
754 // void gtk_tree_model_get (GtkTreeModel *tree_model, GtkTreeIter *iter, ...);
755 gtk_tree_model_get(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct());
759 * See gtk_tree_model_get(), this version takes a va_list
760 * for language bindings to use.
761 * tree_model:
762 * a GtkTreeModel
763 * iter:
764 * a row in tree_model
765 * var_args:
766 * va_list of column/return location pairs
768 public void getValist(TreeIter iter, void* varArgs)
770 // void gtk_tree_model_get_valist (GtkTreeModel *tree_model, GtkTreeIter *iter, va_list var_args);
771 gtk_tree_model_get_valist(gtkTreeModel, (iter is null) ? null : iter.getTreeIterStruct(), varArgs);
775 * Calls func on each node in model in a depth-first fashion.
776 * If func returns TRUE, then the tree ceases to be walked, and
777 * gtk_tree_model_foreach() returns.
778 * model:
779 * A GtkTreeModel
780 * func:
781 * A function to be called on each row
782 * user_data:
783 * User data to passed to func.
785 public void foreac(GtkTreeModelForeachFunc func, void* userData)
787 // void gtk_tree_model_foreach (GtkTreeModel *model, GtkTreeModelForeachFunc func, gpointer user_data);
788 gtk_tree_model_foreach(gtkTreeModel, func, userData);
792 * Emits the "row_changed" signal on tree_model.
793 * tree_model:
794 * A GtkTreeModel
795 * path:
796 * A GtkTreePath pointing to the changed row
797 * iter:
798 * A valid GtkTreeIter pointing to the changed row
800 public void rowChanged(TreePath path, TreeIter iter)
802 // void gtk_tree_model_row_changed (GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter);
803 gtk_tree_model_row_changed(gtkTreeModel, (path is null) ? null : path.getTreePathStruct(), (iter is null) ? null : iter.getTreeIterStruct());
807 * Emits the "row_inserted" signal on tree_model
808 * tree_model:
809 * A GtkTreeModel
810 * path:
811 * A GtkTreePath pointing to the inserted row
812 * iter:
813 * A valid GtkTreeIter pointing to the inserted row
815 public void rowInserted(TreePath path, TreeIter iter)
817 // void gtk_tree_model_row_inserted (GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter);
818 gtk_tree_model_row_inserted(gtkTreeModel, (path is null) ? null : path.getTreePathStruct(), (iter is null) ? null : iter.getTreeIterStruct());
822 * Emits the "row_has_child_toggled" signal on tree_model. This should be
823 * called by models after the child state of a node changes.
824 * tree_model:
825 * A GtkTreeModel
826 * path:
827 * A GtkTreePath pointing to the changed row
828 * iter:
829 * A valid GtkTreeIter pointing to the changed row
831 public void rowHasChildToggled(TreePath path, TreeIter iter)
833 // void gtk_tree_model_row_has_child_toggled (GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter);
834 gtk_tree_model_row_has_child_toggled(gtkTreeModel, (path is null) ? null : path.getTreePathStruct(), (iter is null) ? null : iter.getTreeIterStruct());
838 * Emits the "row_deleted" signal on tree_model. This should be called by
839 * models after a row has been removed. The location pointed to by path
840 * should be the location that the row previously was at. It may not be a
841 * valid location anymore.
842 * tree_model:
843 * A GtkTreeModel
844 * path:
845 * A GtkTreePath pointing to the previous location of the deleted row.
847 public void rowDeleted(TreePath path)
849 // void gtk_tree_model_row_deleted (GtkTreeModel *tree_model, GtkTreePath *path);
850 gtk_tree_model_row_deleted(gtkTreeModel, (path is null) ? null : path.getTreePathStruct());
854 * Emits the "rows_reordered" signal on tree_model. This should be called by
855 * models when their rows have been reordered.
856 * tree_model:
857 * A GtkTreeModel
858 * path:
859 * A GtkTreePath pointing to the tree node whose children have been
860 * reordered
861 * iter:
862 * A valid GtkTreeIter pointing to the node whose children have been
863 * reordered, or NULL if the depth of path is 0.
864 * new_order:
865 * an array of integers mapping the current position of each child
866 * to its old position before the re-ordering,
867 * i.e. new_order[newpos] = oldpos.
868 * Signal Details
869 * The "row-changed" signal
870 * void user_function (GtkTreeModel *tree_model,
871 * GtkTreePath *path,
872 * GtkTreeIter *iter,
873 * gpointer user_data) : Run last
874 * This signal is emitted when a row in the model has changed.
875 * tree_model:
876 * the GtkTreeModel on which the signal is emitted
877 * path:
878 * a GtkTreePath identifying the changed row
879 * iter:
880 * a valid GtkTreeIter pointing to the changed row
881 * user_data:
882 * user data set when the signal handler was connected.
884 public void rowsReordered(TreePath path, TreeIter iter, int* newOrder)
886 // void gtk_tree_model_rows_reordered (GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter, gint *new_order);
887 gtk_tree_model_rows_reordered(gtkTreeModel, (path is null) ? null : path.getTreePathStruct(), (iter is null) ? null : iter.getTreeIterStruct(), newOrder);