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.TreeStore;
26 
27 private import gdk.Pixbuf;
28 private import glib.ConstructionException;
29 private import gobject.ObjectG;
30 private import gobject.Value;
31 private import gtk.BuildableIF;
32 private import gtk.BuildableT;
33 private import gtk.TreeDragDestIF;
34 private import gtk.TreeDragDestT;
35 private import gtk.TreeDragSourceIF;
36 private import gtk.TreeDragSourceT;
37 private import gtk.TreeIter;
38 private import gtk.TreeModelIF;
39 private import gtk.TreeModelT;
40 private import gtk.TreeNode;
41 private import gtk.TreeSortableIF;
42 private import gtk.TreeSortableT;
43 private import gtkc.gtk;
44 public  import gtkc.gtktypes;
45 
46 
47 /**
48  * The #GtkTreeStore object is a list model for use with a #GtkTreeView
49  * widget.  It implements the #GtkTreeModel interface, and consequentialy,
50  * can use all of the methods available there.  It also implements the
51  * #GtkTreeSortable interface so it can be sorted by the view.  Finally,
52  * it also implements the tree
53  * [drag and drop][gtk3-GtkTreeView-drag-and-drop]
54  * interfaces.
55  * 
56  * # GtkTreeStore as GtkBuildable
57  * 
58  * The GtkTreeStore implementation of the #GtkBuildable interface allows
59  * to specify the model columns with a <columns> element that may contain
60  * multiple <column> elements, each specifying one model column. The “type”
61  * attribute specifies the data type for the column.
62  * 
63  * An example of a UI Definition fragment for a tree store:
64  * |[
65  * <object class="GtkTreeStore">
66  * <columns>
67  * <column type="gchararray"/>
68  * <column type="gchararray"/>
69  * <column type="gint"/>
70  * </columns>
71  * </object>
72  * ]|
73  */
74 public class TreeStore : ObjectG, BuildableIF, TreeDragDestIF, TreeDragSourceIF, TreeModelIF, TreeSortableIF
75 {
76 	/** the main Gtk struct */
77 	protected GtkTreeStore* gtkTreeStore;
78 
79 	/** Get the main Gtk struct */
80 	public GtkTreeStore* getTreeStoreStruct()
81 	{
82 		return gtkTreeStore;
83 	}
84 
85 	/** the main Gtk struct as a void* */
86 	protected override void* getStruct()
87 	{
88 		return cast(void*)gtkTreeStore;
89 	}
90 
91 	protected override void setStruct(GObject* obj)
92 	{
93 		gtkTreeStore = cast(GtkTreeStore*)obj;
94 		super.setStruct(obj);
95 	}
96 
97 	/**
98 	 * Sets our main struct and passes it to the parent class.
99 	 */
100 	public this (GtkTreeStore* gtkTreeStore, bool ownedRef = false)
101 	{
102 		this.gtkTreeStore = gtkTreeStore;
103 		super(cast(GObject*)gtkTreeStore, ownedRef);
104 	}
105 
106 	// add the Buildable capabilities
107 	mixin BuildableT!(GtkTreeStore);
108 
109 	// add the TreeDragDest capabilities
110 	mixin TreeDragDestT!(GtkTreeStore);
111 
112 	// add the TreeDragSource capabilities
113 	mixin TreeDragSourceT!(GtkTreeStore);
114 
115 	// add the TreeModel capabilities
116 	mixin TreeModelT!(GtkTreeStore);
117 
118 	// add the TreeSortable capabilities
119 	mixin TreeSortableT!(GtkTreeStore);
120 
121 	/**
122 	 * Creates a top level iteractor.
123 	 * I don't think lists have but the top level iteractor
124 	 */
125 	TreeIter createIter(TreeIter parent=null)
126 	{
127 		GtkTreeIter* iter = new GtkTreeIter;
128 		gtk_tree_store_append(getTreeStoreStruct(), iter, (parent is null) ? null : parent.getTreeIterStruct());
129 		return new TreeIter(iter);
130 	}
131 	
132 	/**
133 	 * Sets one value into one cells.
134 	 * \todo confirm we need to destroy the Value instance
135 	 * Params:
136 	 *  iter = the tree iteractor, effectivly the row
137 	 *  column = to column number to set
138 	 *  value = the value
139 	 */
140 	void setValue(TreeIter iter, int column, string value)
141 	{
142 		gtk_tree_store_set(gtkTreeStore, iter.getTreeIterStruct(), column, Str.toStringz(value) , -1);
143 	}
144 	
145 	/** ditto */
146 	void setValue(TreeIter iter, int column, int value)
147 	{
148 		gtk_tree_store_set(gtkTreeStore, iter.getTreeIterStruct(), column, value, -1);
149 	}
150 	
151 	/** ditto */
152 	//TODO: confirm we need to destroy the Value instance
153 	void setValue(TreeIter iter, int column, Pixbuf pixbuf)
154 	{
155 		Value v = new Value(pixbuf);
156 		gtk_tree_store_set_value(gtkTreeStore, iter.getTreeIterStruct(), column, v.getValueStruct());
157 	}
158 	
159 	/**
160 	 * sets the values for one row
161 	 * Params:
162 	 *  iter = the row iteractor
163 	 *  columns = an arrays with the columns to set
164 	 *  values = an arrays with the values
165 	 */
166 	void set(TreeIter iter, int[] columns, char*[] values)
167 	{
168 		for ( int i=0 ; i<columns.length && i<values.length; i++ )
169 		{
170 			gtk_tree_store_set(
171 				gtkTreeStore,
172 				iter.getTreeIterStruct(),
173 				columns[i],
174 				values[i],-1);
175 		}
176 	}
177 	
178 	/** ditto */
179 	void set(TreeIter iter, int[] columns, string[] values)
180 	{
181 		for ( int i=0 ; i<columns.length && i<values.length; i++ )
182 		{
183 			gtk_tree_store_set(
184 				gtkTreeStore,
185 				iter.getTreeIterStruct(),
186 				columns[i],
187 				Str.toStringz(values[i]),-1);
188 		}
189 	}
190 	
191 	/**
192 	 * Sets an iteractor values from a tree node.
193 	 * This is the way to add a new row to the tree,
194 	 * the iteractor is either a top level iteractor created from createIter()
195 	 * or a nested iteractor created from append()
196 	 * Params:
197 	 *  iter = the iteractor to set
198 	 *  treeNode = the tree node
199 	 * See_Also: createIter(), append()
200 	 */
201 	void set(TreeIter iter, TreeNode treeNode)
202 	{
203 		int[] cols;
204 		string[] vals;
205 		for ( int i=0 ; i<treeNode.columnCount() ; i++ )
206 		{
207 			//printf(">>>>>>>>>>>>> requesting value for %d\n",i);
208 			cols ~= i;
209 			string value = treeNode.getNodeValue(i);
210 			if ( value  is  null )
211 			{
212 				vals ~= "";
213 			}
214 			else
215 			{
216 				vals ~= value;
217 			}
218 		}
219 		set(iter, cols, vals);
220 	}
221 	
222 	
223 	/**
224 	 * Creates and prepends a new row to tree_store. If parent is non-NULL, then it will prepend
225 	 * the new row before the first child of parent, otherwise it will prepend a row
226 	 * to the top level. iter will be changed to point to this new row. The row
227 	 * will be empty after this function is called. To fill in values, you need to
228 	 * call gtk_tree_store_set() or gtk_tree_store_set_value().
229 	 * Params:
230 	 *  parent = A valid GtkTreeIter, or NULL
231 	 */
232 	public TreeIter prepend(TreeIter parent)
233 	{
234 		TreeIter iter = new TreeIter();
235 		// void gtk_tree_store_prepend (GtkTreeStore *tree_store,  GtkTreeIter *iter,  GtkTreeIter *parent);
236 		gtk_tree_store_prepend(gtkTreeStore, iter.getTreeIterStruct(), (parent is null) ? null : parent.getTreeIterStruct());
237 		return iter;
238 	}
239 	
240 	/**
241 	 * Creates and appends a new row to tree_store. If parent is non-NULL, then it will append the
242 	 * new row after the last child of parent, otherwise it will append a row to
243 	 * the top level. iter will be changed to point to this new row. The row will
244 	 * be empty after this function is called. To fill in values, you need to call
245 	 * gtk_tree_store_set() or gtk_tree_store_set_value().
246 	 * Params:
247 	 *  parent = A valid GtkTreeIter, or NULL
248 	 */
249 	public TreeIter append(TreeIter parent)
250 	{
251 		TreeIter iter = new TreeIter();
252 		// void gtk_tree_store_append (GtkTreeStore *tree_store,  GtkTreeIter *iter,  GtkTreeIter *parent);
253 		gtk_tree_store_append(gtkTreeStore,
254 		iter.getTreeIterStruct(),
255 		(parent is null) ? null : parent.getTreeIterStruct());
256 		return iter;
257 	}
258 
259 	/**
260 	 */
261 
262 	public static GType getType()
263 	{
264 		return gtk_tree_store_get_type();
265 	}
266 
267 	/**
268 	 * Non vararg creation function.  Used primarily by language bindings.
269 	 *
270 	 * Params:
271 	 *     nColumns = number of columns in the tree store
272 	 *     types = an array of #GType types for the columns, from first to last
273 	 *
274 	 * Return: a new #GtkTreeStore
275 	 *
276 	 * Throws: ConstructionException GTK+ fails to create the object.
277 	 */
278 	public this(GType[] types)
279 	{
280 		auto p = gtk_tree_store_newv(cast(int)types.length, types.ptr);
281 		
282 		if(p is null)
283 		{
284 			throw new ConstructionException("null returned by newv");
285 		}
286 		
287 		this(cast(GtkTreeStore*) p, true);
288 	}
289 
290 	/**
291 	 * Appends a new row to @tree_store.  If @parent is non-%NULL, then it will append the
292 	 * new row after the last child of @parent, otherwise it will append a row to
293 	 * the top level.  @iter will be changed to point to this new row.  The row will
294 	 * be empty after this function is called.  To fill in values, you need to call
295 	 * gtk_tree_store_set() or gtk_tree_store_set_value().
296 	 *
297 	 * Params:
298 	 *     iter = An unset #GtkTreeIter to set to the appended row
299 	 *     parent = A valid #GtkTreeIter, or %NULL
300 	 */
301 	public void append(out TreeIter iter, TreeIter parent)
302 	{
303 		GtkTreeIter* outiter = new GtkTreeIter;
304 		
305 		gtk_tree_store_append(gtkTreeStore, outiter, (parent is null) ? null : parent.getTreeIterStruct());
306 		
307 		iter = ObjectG.getDObject!(TreeIter)(outiter);
308 	}
309 
310 	/**
311 	 * Removes all rows from @tree_store
312 	 */
313 	public void clear()
314 	{
315 		gtk_tree_store_clear(gtkTreeStore);
316 	}
317 
318 	/**
319 	 * Creates a new row at @position.  If parent is non-%NULL, then the row will be
320 	 * made a child of @parent.  Otherwise, the row will be created at the toplevel.
321 	 * If @position is -1 or is larger than the number of rows at that level, then
322 	 * the new row will be inserted to the end of the list.  @iter will be changed
323 	 * to point to this new row.  The row will be empty after this function is
324 	 * called.  To fill in values, you need to call gtk_tree_store_set() or
325 	 * gtk_tree_store_set_value().
326 	 *
327 	 * Params:
328 	 *     iter = An unset #GtkTreeIter to set to the new row
329 	 *     parent = A valid #GtkTreeIter, or %NULL
330 	 *     position = position to insert the new row, or -1 for last
331 	 */
332 	public void insert(out TreeIter iter, TreeIter parent, int position)
333 	{
334 		GtkTreeIter* outiter = new GtkTreeIter;
335 		
336 		gtk_tree_store_insert(gtkTreeStore, outiter, (parent is null) ? null : parent.getTreeIterStruct(), position);
337 		
338 		iter = ObjectG.getDObject!(TreeIter)(outiter);
339 	}
340 
341 	/**
342 	 * Inserts a new row after @sibling.  If @sibling is %NULL, then the row will be
343 	 * prepended to @parent ’s children.  If @parent and @sibling are %NULL, then
344 	 * the row will be prepended to the toplevel.  If both @sibling and @parent are
345 	 * set, then @parent must be the parent of @sibling.  When @sibling is set,
346 	 * @parent is optional.
347 	 *
348 	 * @iter will be changed to point to this new row.  The row will be empty after
349 	 * this function is called.  To fill in values, you need to call
350 	 * gtk_tree_store_set() or gtk_tree_store_set_value().
351 	 *
352 	 * Params:
353 	 *     iter = An unset #GtkTreeIter to set to the new row
354 	 *     parent = A valid #GtkTreeIter, or %NULL
355 	 *     sibling = A valid #GtkTreeIter, or %NULL
356 	 */
357 	public void insertAfter(out TreeIter iter, TreeIter parent, TreeIter sibling)
358 	{
359 		GtkTreeIter* outiter = new GtkTreeIter;
360 		
361 		gtk_tree_store_insert_after(gtkTreeStore, outiter, (parent is null) ? null : parent.getTreeIterStruct(), (sibling is null) ? null : sibling.getTreeIterStruct());
362 		
363 		iter = ObjectG.getDObject!(TreeIter)(outiter);
364 	}
365 
366 	/**
367 	 * Inserts a new row before @sibling.  If @sibling is %NULL, then the row will
368 	 * be appended to @parent ’s children.  If @parent and @sibling are %NULL, then
369 	 * the row will be appended to the toplevel.  If both @sibling and @parent are
370 	 * set, then @parent must be the parent of @sibling.  When @sibling is set,
371 	 * @parent is optional.
372 	 *
373 	 * @iter will be changed to point to this new row.  The row will be empty after
374 	 * this function is called.  To fill in values, you need to call
375 	 * gtk_tree_store_set() or gtk_tree_store_set_value().
376 	 *
377 	 * Params:
378 	 *     iter = An unset #GtkTreeIter to set to the new row
379 	 *     parent = A valid #GtkTreeIter, or %NULL
380 	 *     sibling = A valid #GtkTreeIter, or %NULL
381 	 */
382 	public void insertBefore(out TreeIter iter, TreeIter parent, TreeIter sibling)
383 	{
384 		GtkTreeIter* outiter = new GtkTreeIter;
385 		
386 		gtk_tree_store_insert_before(gtkTreeStore, outiter, (parent is null) ? null : parent.getTreeIterStruct(), (sibling is null) ? null : sibling.getTreeIterStruct());
387 		
388 		iter = ObjectG.getDObject!(TreeIter)(outiter);
389 	}
390 
391 	/**
392 	 * A variant of gtk_tree_store_insert_with_values() which takes
393 	 * the columns and values as two arrays, instead of varargs.  This
394 	 * function is mainly intended for language bindings.
395 	 *
396 	 * Params:
397 	 *     iter = An unset #GtkTreeIter to set the new row, or %NULL.
398 	 *     parent = A valid #GtkTreeIter, or %NULL
399 	 *     position = position to insert the new row, or -1 for last
400 	 *     columns = an array of column numbers
401 	 *     values = an array of GValues
402 	 *     nValues = the length of the @columns and @values arrays
403 	 *
404 	 * Since: 2.10
405 	 */
406 	public void insertWithValuesv(out TreeIter iter, TreeIter parent, int position, int[] columns, Value[] values)
407 	{
408 		GtkTreeIter* outiter = new GtkTreeIter;
409 		
410 		GValue[] valuesArray = new GValue[values.length];
411 		for ( int i = 0; i < values.length; i++ )
412 		{
413 			valuesArray[i] = *(values[i].getValueStruct());
414 		}
415 		
416 		gtk_tree_store_insert_with_valuesv(gtkTreeStore, outiter, (parent is null) ? null : parent.getTreeIterStruct(), position, columns.ptr, valuesArray.ptr, cast(int)values.length);
417 		
418 		iter = ObjectG.getDObject!(TreeIter)(outiter);
419 	}
420 
421 	/**
422 	 * Returns %TRUE if @iter is an ancestor of @descendant.  That is, @iter is the
423 	 * parent (or grandparent or great-grandparent) of @descendant.
424 	 *
425 	 * Params:
426 	 *     iter = A valid #GtkTreeIter
427 	 *     descendant = A valid #GtkTreeIter
428 	 *
429 	 * Return: %TRUE, if @iter is an ancestor of @descendant
430 	 */
431 	public bool isAncestor(TreeIter iter, TreeIter descendant)
432 	{
433 		return gtk_tree_store_is_ancestor(gtkTreeStore, (iter is null) ? null : iter.getTreeIterStruct(), (descendant is null) ? null : descendant.getTreeIterStruct()) != 0;
434 	}
435 
436 	/**
437 	 * Returns the depth of @iter.  This will be 0 for anything on the root level, 1
438 	 * for anything down a level, etc.
439 	 *
440 	 * Params:
441 	 *     iter = A valid #GtkTreeIter
442 	 *
443 	 * Return: The depth of @iter
444 	 */
445 	public int iterDepth(TreeIter iter)
446 	{
447 		return gtk_tree_store_iter_depth(gtkTreeStore, (iter is null) ? null : iter.getTreeIterStruct());
448 	}
449 
450 	/**
451 	 * WARNING: This function is slow. Only use it for debugging and/or testing
452 	 * purposes.
453 	 *
454 	 * Checks if the given iter is a valid iter for this #GtkTreeStore.
455 	 *
456 	 * Params:
457 	 *     iter = A #GtkTreeIter.
458 	 *
459 	 * Return: %TRUE if the iter is valid, %FALSE if the iter is invalid.
460 	 *
461 	 * Since: 2.2
462 	 */
463 	public bool iterIsValid(TreeIter iter)
464 	{
465 		return gtk_tree_store_iter_is_valid(gtkTreeStore, (iter is null) ? null : iter.getTreeIterStruct()) != 0;
466 	}
467 
468 	/**
469 	 * Moves @iter in @tree_store to the position after @position. @iter and
470 	 * @position should be in the same level. Note that this function only
471 	 * works with unsorted stores. If @position is %NULL, @iter will be moved
472 	 * to the start of the level.
473 	 *
474 	 * Params:
475 	 *     iter = A #GtkTreeIter.
476 	 *     position = A #GtkTreeIter.
477 	 *
478 	 * Since: 2.2
479 	 */
480 	public void moveAfter(TreeIter iter, TreeIter position)
481 	{
482 		gtk_tree_store_move_after(gtkTreeStore, (iter is null) ? null : iter.getTreeIterStruct(), (position is null) ? null : position.getTreeIterStruct());
483 	}
484 
485 	/**
486 	 * Moves @iter in @tree_store to the position before @position. @iter and
487 	 * @position should be in the same level. Note that this function only
488 	 * works with unsorted stores. If @position is %NULL, @iter will be
489 	 * moved to the end of the level.
490 	 *
491 	 * Params:
492 	 *     iter = A #GtkTreeIter.
493 	 *     position = A #GtkTreeIter or %NULL.
494 	 *
495 	 * Since: 2.2
496 	 */
497 	public void moveBefore(TreeIter iter, TreeIter position)
498 	{
499 		gtk_tree_store_move_before(gtkTreeStore, (iter is null) ? null : iter.getTreeIterStruct(), (position is null) ? null : position.getTreeIterStruct());
500 	}
501 
502 	/**
503 	 * Prepends a new row to @tree_store.  If @parent is non-%NULL, then it will prepend
504 	 * the new row before the first child of @parent, otherwise it will prepend a row
505 	 * to the top level.  @iter will be changed to point to this new row.  The row
506 	 * will be empty after this function is called.  To fill in values, you need to
507 	 * call gtk_tree_store_set() or gtk_tree_store_set_value().
508 	 *
509 	 * Params:
510 	 *     iter = An unset #GtkTreeIter to set to the prepended row
511 	 *     parent = A valid #GtkTreeIter, or %NULL
512 	 */
513 	public void prepend(out TreeIter iter, TreeIter parent)
514 	{
515 		GtkTreeIter* outiter = new GtkTreeIter;
516 		
517 		gtk_tree_store_prepend(gtkTreeStore, outiter, (parent is null) ? null : parent.getTreeIterStruct());
518 		
519 		iter = ObjectG.getDObject!(TreeIter)(outiter);
520 	}
521 
522 	/**
523 	 * Removes @iter from @tree_store.  After being removed, @iter is set to the
524 	 * next valid row at that level, or invalidated if it previously pointed to the
525 	 * last one.
526 	 *
527 	 * Params:
528 	 *     iter = A valid #GtkTreeIter
529 	 *
530 	 * Return: %TRUE if @iter is still valid, %FALSE if not.
531 	 */
532 	public bool remove(TreeIter iter)
533 	{
534 		return gtk_tree_store_remove(gtkTreeStore, (iter is null) ? null : iter.getTreeIterStruct()) != 0;
535 	}
536 
537 	/**
538 	 * Reorders the children of @parent in @tree_store to follow the order
539 	 * indicated by @new_order. Note that this function only works with
540 	 * unsorted stores.
541 	 *
542 	 * Params:
543 	 *     parent = A #GtkTreeIter, or %NULL
544 	 *     newOrder = an array of integers mapping the new position of each child
545 	 *         to its old position before the re-ordering,
546 	 *         i.e. @new_order`[newpos] = oldpos`.
547 	 *
548 	 * Since: 2.2
549 	 */
550 	public void reorder(TreeIter parent, int[] newOrder)
551 	{
552 		gtk_tree_store_reorder(gtkTreeStore, (parent is null) ? null : parent.getTreeIterStruct(), newOrder.ptr);
553 	}
554 
555 	/**
556 	 * This function is meant primarily for #GObjects that inherit from
557 	 * #GtkTreeStore, and should only be used when constructing a new
558 	 * #GtkTreeStore.  It will not function after a row has been added,
559 	 * or a method on the #GtkTreeModel interface is called.
560 	 *
561 	 * Params:
562 	 *     nColumns = Number of columns for the tree store
563 	 *     types = An array of #GType types, one for each column
564 	 */
565 	public void setColumnTypes(GType[] types)
566 	{
567 		gtk_tree_store_set_column_types(gtkTreeStore, cast(int)types.length, types.ptr);
568 	}
569 
570 	/**
571 	 * See gtk_tree_store_set(); this version takes a va_list for
572 	 * use by language bindings.
573 	 *
574 	 * Params:
575 	 *     iter = A valid #GtkTreeIter for the row being modified
576 	 *     varArgs = va_list of column/value pairs
577 	 */
578 	public void setValist(TreeIter iter, void* varArgs)
579 	{
580 		gtk_tree_store_set_valist(gtkTreeStore, (iter is null) ? null : iter.getTreeIterStruct(), varArgs);
581 	}
582 
583 	/**
584 	 * Sets the data in the cell specified by @iter and @column.
585 	 * The type of @value must be convertible to the type of the
586 	 * column.
587 	 *
588 	 * Params:
589 	 *     iter = A valid #GtkTreeIter for the row being modified
590 	 *     column = column number to modify
591 	 *     value = new value for the cell
592 	 */
593 	public void setValue(TreeIter iter, int column, Value value)
594 	{
595 		gtk_tree_store_set_value(gtkTreeStore, (iter is null) ? null : iter.getTreeIterStruct(), column, (value is null) ? null : value.getValueStruct());
596 	}
597 
598 	/**
599 	 * A variant of gtk_tree_store_set_valist() which takes
600 	 * the columns and values as two arrays, instead of varargs.  This
601 	 * function is mainly intended for language bindings or in case
602 	 * the number of columns to change is not known until run-time.
603 	 *
604 	 * Params:
605 	 *     iter = A valid #GtkTreeIter for the row being modified
606 	 *     columns = an array of column numbers
607 	 *     values = an array of GValues
608 	 *     nValues = the length of the @columns and @values arrays
609 	 *
610 	 * Since: 2.12
611 	 */
612 	public void setValuesv(TreeIter iter, int[] columns, Value[] values)
613 	{
614 		GValue[] valuesArray = new GValue[values.length];
615 		for ( int i = 0; i < values.length; i++ )
616 		{
617 			valuesArray[i] = *(values[i].getValueStruct());
618 		}
619 		
620 		gtk_tree_store_set_valuesv(gtkTreeStore, (iter is null) ? null : iter.getTreeIterStruct(), columns.ptr, valuesArray.ptr, cast(int)values.length);
621 	}
622 
623 	/**
624 	 * Swaps @a and @b in the same level of @tree_store. Note that this function
625 	 * only works with unsorted stores.
626 	 *
627 	 * Params:
628 	 *     a = A #GtkTreeIter.
629 	 *     b = Another #GtkTreeIter.
630 	 *
631 	 * Since: 2.2
632 	 */
633 	public void swap(TreeIter a, TreeIter b)
634 	{
635 		gtk_tree_store_swap(gtkTreeStore, (a is null) ? null : a.getTreeIterStruct(), (b is null) ? null : b.getTreeIterStruct());
636 	}
637 }