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.TreeViewColumn;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtk.BuildableIF;
32 private import gtk.BuildableT;
33 private import gtk.Button;
34 private import gtk.CellArea;
35 private import gtk.CellLayoutIF;
36 private import gtk.CellLayoutT;
37 private import gtk.CellRenderer;
38 private import gtk.TreeIter;
39 private import gtk.TreeModelIF;
40 private import gtk.TreeView;
41 private import gtk.Widget;
42 public  import gtkc.gdktypes;
43 private import gtkc.gtk;
44 public  import gtkc.gtktypes;
45 private import std.algorithm;
46 
47 
48 /**
49  * The GtkTreeViewColumn object represents a visible column in a #GtkTreeView widget.
50  * It allows to set properties of the column header, and functions as a holding pen for
51  * the cell renderers which determine how the data in the column is displayed.
52  * 
53  * Please refer to the [tree widget conceptual overview][TreeWidget]
54  * for an overview of all the objects and data types related to the tree widget and how
55  * they work together.
56  */
57 public class TreeViewColumn : ObjectG, BuildableIF, CellLayoutIF
58 {
59 	/** the main Gtk struct */
60 	protected GtkTreeViewColumn* gtkTreeViewColumn;
61 
62 	/** Get the main Gtk struct */
63 	public GtkTreeViewColumn* getTreeViewColumnStruct()
64 	{
65 		return gtkTreeViewColumn;
66 	}
67 
68 	/** the main Gtk struct as a void* */
69 	protected override void* getStruct()
70 	{
71 		return cast(void*)gtkTreeViewColumn;
72 	}
73 
74 	protected override void setStruct(GObject* obj)
75 	{
76 		gtkTreeViewColumn = cast(GtkTreeViewColumn*)obj;
77 		super.setStruct(obj);
78 	}
79 
80 	/**
81 	 * Sets our main struct and passes it to the parent class.
82 	 */
83 	public this (GtkTreeViewColumn* gtkTreeViewColumn, bool ownedRef = false)
84 	{
85 		this.gtkTreeViewColumn = gtkTreeViewColumn;
86 		super(cast(GObject*)gtkTreeViewColumn, ownedRef);
87 	}
88 
89 	// add the Buildable capabilities
90 	mixin BuildableT!(GtkTreeViewColumn);
91 
92 	// add the CellLayout capabilities
93 	mixin CellLayoutT!(GtkTreeViewColumn);
94 
95 	/**
96 	 * Creates a new Tree view column
97 	 * Params:
98 	 *  header = th column header text
99 	 *  renderer = the rederer for the column cells
100 	 *  type = the type of data to be displayed (shouldn't this be on the renderer?)
101 	 *  column = the column number
102 	 * Throws: ConstructionException GTK+ fails to create the object.
103 	 */
104 	this(string header, CellRenderer renderer, string type, int column)
105 	{
106 		auto p = gtk_tree_view_column_new_with_attributes(
107 			Str.toStringz(header),
108 			renderer.getCellRendererStruct(),
109 			Str.toStringz(type),
110 			column,
111 			null);
112 		
113 		if(p is null)
114 		{
115 			throw new ConstructionException("null returned by gtk_tree_view_column_new_with_attributes");
116 		}
117 		
118 		this(p);
119 	}
120 	
121 	/**
122 	 * Returns the button used in the treeview column header
123 	 * Returns: The button for the column header. [transfer none] Since 3.0
124 	 */
125 	public Button getButton()
126 	{
127 		// GtkWidget * gtk_tree_view_column_get_button (GtkTreeViewColumn *tree_column);
128 		auto p = gtk_tree_view_column_get_button(gtkTreeViewColumn);
129 		if(p is null)
130 		{
131 			return null;
132 		}
133 		return new Button(cast(GtkButton*) p);
134 	}
135 	
136 	/**
137 	 * Returns the GtkTreeView wherein tree_column has been inserted.
138 	 * If column is currently not inserted in any tree view, NULL is
139 	 * returned.
140 	 * Since 2.12
141 	 * Returns: The tree view wherein column has been inserted if any, NULL otherwise. [transfer none]
142 	 */
143 	public TreeView getTreeView()
144 	{
145 		// GtkWidget * gtk_tree_view_column_get_tree_view (GtkTreeViewColumn *tree_column);
146 		auto p = gtk_tree_view_column_get_tree_view(gtkTreeViewColumn);
147 		if(p is null)
148 		{
149 			return null;
150 		}
151 		return new TreeView(cast(GtkTreeView*) p);
152 	}
153 
154 	/**
155 	 */
156 
157 	/** */
158 	public static GType getType()
159 	{
160 		return gtk_tree_view_column_get_type();
161 	}
162 
163 	/**
164 	 * Creates a new #GtkTreeViewColumn.
165 	 *
166 	 * Return: A newly created #GtkTreeViewColumn.
167 	 *
168 	 * Throws: ConstructionException GTK+ fails to create the object.
169 	 */
170 	public this()
171 	{
172 		auto p = gtk_tree_view_column_new();
173 		
174 		if(p is null)
175 		{
176 			throw new ConstructionException("null returned by new");
177 		}
178 		
179 		this(cast(GtkTreeViewColumn*) p);
180 	}
181 
182 	/**
183 	 * Creates a new #GtkTreeViewColumn using @area to render its cells.
184 	 *
185 	 * Params:
186 	 *     area = the #GtkCellArea that the newly created column should use to layout cells.
187 	 *
188 	 * Return: A newly created #GtkTreeViewColumn.
189 	 *
190 	 * Since: 3.0
191 	 *
192 	 * Throws: ConstructionException GTK+ fails to create the object.
193 	 */
194 	public this(CellArea area)
195 	{
196 		auto p = gtk_tree_view_column_new_with_area((area is null) ? null : area.getCellAreaStruct());
197 		
198 		if(p is null)
199 		{
200 			throw new ConstructionException("null returned by new_with_area");
201 		}
202 		
203 		this(cast(GtkTreeViewColumn*) p);
204 	}
205 
206 	/**
207 	 * Obtains the horizontal position and size of a cell in a column. If the
208 	 * cell is not found in the column, @start_pos and @width are not changed and
209 	 * %FALSE is returned.
210 	 *
211 	 * Params:
212 	 *     cellRenderer = a #GtkCellRenderer
213 	 *     xOffset = return location for the horizontal
214 	 *         position of @cell within @tree_column, may be %NULL
215 	 *     width = return location for the width of @cell,
216 	 *         may be %NULL
217 	 *
218 	 * Return: %TRUE if @cell belongs to @tree_column.
219 	 */
220 	public bool cellGetPosition(CellRenderer cellRenderer, out int xOffset, out int width)
221 	{
222 		return gtk_tree_view_column_cell_get_position(gtkTreeViewColumn, (cellRenderer is null) ? null : cellRenderer.getCellRendererStruct(), &xOffset, &width) != 0;
223 	}
224 
225 	/**
226 	 * Obtains the width and height needed to render the column.  This is used
227 	 * primarily by the #GtkTreeView.
228 	 *
229 	 * Params:
230 	 *     cellArea = The area a cell in the column will be allocated, or %NULL
231 	 *     xOffset = location to return x offset of a cell relative to @cell_area, or %NULL
232 	 *     yOffset = location to return y offset of a cell relative to @cell_area, or %NULL
233 	 *     width = location to return width needed to render a cell, or %NULL
234 	 *     height = location to return height needed to render a cell, or %NULL
235 	 */
236 	public void cellGetSize(GdkRectangle* cellArea, out int xOffset, out int yOffset, out int width, out int height)
237 	{
238 		gtk_tree_view_column_cell_get_size(gtkTreeViewColumn, cellArea, &xOffset, &yOffset, &width, &height);
239 	}
240 
241 	/**
242 	 * Returns %TRUE if any of the cells packed into the @tree_column are visible.
243 	 * For this to be meaningful, you must first initialize the cells with
244 	 * gtk_tree_view_column_cell_set_cell_data()
245 	 *
246 	 * Return: %TRUE, if any of the cells packed into the @tree_column are currently visible
247 	 */
248 	public bool cellIsVisible()
249 	{
250 		return gtk_tree_view_column_cell_is_visible(gtkTreeViewColumn) != 0;
251 	}
252 
253 	/**
254 	 * Sets the cell renderer based on the @tree_model and @iter.  That is, for
255 	 * every attribute mapping in @tree_column, it will get a value from the set
256 	 * column on the @iter, and use that value to set the attribute on the cell
257 	 * renderer.  This is used primarily by the #GtkTreeView.
258 	 *
259 	 * Params:
260 	 *     treeModel = The #GtkTreeModel to to get the cell renderers attributes from.
261 	 *     iter = The #GtkTreeIter to to get the cell renderer’s attributes from.
262 	 *     isExpander = %TRUE, if the row has children
263 	 *     isExpanded = %TRUE, if the row has visible children
264 	 */
265 	public void cellSetCellData(TreeModelIF treeModel, TreeIter iter, bool isExpander, bool isExpanded)
266 	{
267 		gtk_tree_view_column_cell_set_cell_data(gtkTreeViewColumn, (treeModel is null) ? null : treeModel.getTreeModelStruct(), (iter is null) ? null : iter.getTreeIterStruct(), isExpander, isExpanded);
268 	}
269 
270 	/**
271 	 * Emits the “clicked” signal on the column.  This function will only work if
272 	 * @tree_column is clickable.
273 	 */
274 	public void clicked()
275 	{
276 		gtk_tree_view_column_clicked(gtkTreeViewColumn);
277 	}
278 
279 	/**
280 	 * Sets the current keyboard focus to be at @cell, if the column contains
281 	 * 2 or more editable and activatable cells.
282 	 *
283 	 * Params:
284 	 *     cell = A #GtkCellRenderer
285 	 *
286 	 * Since: 2.2
287 	 */
288 	public void focusCell(CellRenderer cell)
289 	{
290 		gtk_tree_view_column_focus_cell(gtkTreeViewColumn, (cell is null) ? null : cell.getCellRendererStruct());
291 	}
292 
293 	/**
294 	 * Returns the current x alignment of @tree_column.  This value can range
295 	 * between 0.0 and 1.0.
296 	 *
297 	 * Return: The current alignent of @tree_column.
298 	 */
299 	public float getAlignment()
300 	{
301 		return gtk_tree_view_column_get_alignment(gtkTreeViewColumn);
302 	}
303 
304 	/**
305 	 * Returns %TRUE if the user can click on the header for the column.
306 	 *
307 	 * Return: %TRUE if user can click the column header.
308 	 */
309 	public bool getClickable()
310 	{
311 		return gtk_tree_view_column_get_clickable(gtkTreeViewColumn) != 0;
312 	}
313 
314 	/**
315 	 * Returns %TRUE if the column expands to fill available space.
316 	 *
317 	 * Return: %TRUE if the column expands to fill available space.
318 	 *
319 	 * Since: 2.4
320 	 */
321 	public bool getExpand()
322 	{
323 		return gtk_tree_view_column_get_expand(gtkTreeViewColumn) != 0;
324 	}
325 
326 	/**
327 	 * Gets the fixed width of the column.  This may not be the actual displayed
328 	 * width of the column; for that, use gtk_tree_view_column_get_width().
329 	 *
330 	 * Return: The fixed width of the column.
331 	 */
332 	public int getFixedWidth()
333 	{
334 		return gtk_tree_view_column_get_fixed_width(gtkTreeViewColumn);
335 	}
336 
337 	/**
338 	 * Returns the maximum width in pixels of the @tree_column, or -1 if no maximum
339 	 * width is set.
340 	 *
341 	 * Return: The maximum width of the @tree_column.
342 	 */
343 	public int getMaxWidth()
344 	{
345 		return gtk_tree_view_column_get_max_width(gtkTreeViewColumn);
346 	}
347 
348 	/**
349 	 * Returns the minimum width in pixels of the @tree_column, or -1 if no minimum
350 	 * width is set.
351 	 *
352 	 * Return: The minimum width of the @tree_column.
353 	 */
354 	public int getMinWidth()
355 	{
356 		return gtk_tree_view_column_get_min_width(gtkTreeViewColumn);
357 	}
358 
359 	/**
360 	 * Returns %TRUE if the @tree_column can be reordered by the user.
361 	 *
362 	 * Return: %TRUE if the @tree_column can be reordered by the user.
363 	 */
364 	public bool getReorderable()
365 	{
366 		return gtk_tree_view_column_get_reorderable(gtkTreeViewColumn) != 0;
367 	}
368 
369 	/**
370 	 * Returns %TRUE if the @tree_column can be resized by the end user.
371 	 *
372 	 * Return: %TRUE, if the @tree_column can be resized.
373 	 */
374 	public bool getResizable()
375 	{
376 		return gtk_tree_view_column_get_resizable(gtkTreeViewColumn) != 0;
377 	}
378 
379 	/**
380 	 * Returns the current type of @tree_column.
381 	 *
382 	 * Return: The type of @tree_column.
383 	 */
384 	public GtkTreeViewColumnSizing getSizing()
385 	{
386 		return gtk_tree_view_column_get_sizing(gtkTreeViewColumn);
387 	}
388 
389 	/**
390 	 * Gets the logical @sort_column_id that the model sorts on when this
391 	 * column is selected for sorting.
392 	 * See gtk_tree_view_column_set_sort_column_id().
393 	 *
394 	 * Return: the current @sort_column_id for this column, or -1 if
395 	 *     this column can’t be used for sorting.
396 	 */
397 	public int getSortColumnId()
398 	{
399 		return gtk_tree_view_column_get_sort_column_id(gtkTreeViewColumn);
400 	}
401 
402 	/**
403 	 * Gets the value set by gtk_tree_view_column_set_sort_indicator().
404 	 *
405 	 * Return: whether the sort indicator arrow is displayed
406 	 */
407 	public bool getSortIndicator()
408 	{
409 		return gtk_tree_view_column_get_sort_indicator(gtkTreeViewColumn) != 0;
410 	}
411 
412 	/**
413 	 * Gets the value set by gtk_tree_view_column_set_sort_order().
414 	 *
415 	 * Return: the sort order the sort indicator is indicating
416 	 */
417 	public GtkSortType getSortOrder()
418 	{
419 		return gtk_tree_view_column_get_sort_order(gtkTreeViewColumn);
420 	}
421 
422 	/**
423 	 * Returns the spacing of @tree_column.
424 	 *
425 	 * Return: the spacing of @tree_column.
426 	 */
427 	public int getSpacing()
428 	{
429 		return gtk_tree_view_column_get_spacing(gtkTreeViewColumn);
430 	}
431 
432 	/**
433 	 * Returns the title of the widget.
434 	 *
435 	 * Return: the title of the column. This string should not be
436 	 *     modified or freed.
437 	 */
438 	public string getTitle()
439 	{
440 		return Str.toString(gtk_tree_view_column_get_title(gtkTreeViewColumn));
441 	}
442 
443 	/**
444 	 * Returns %TRUE if @tree_column is visible.
445 	 *
446 	 * Return: whether the column is visible or not.  If it is visible, then
447 	 *     the tree will show the column.
448 	 */
449 	public bool getVisible()
450 	{
451 		return gtk_tree_view_column_get_visible(gtkTreeViewColumn) != 0;
452 	}
453 
454 	/**
455 	 * Returns the #GtkWidget in the button on the column header.
456 	 * If a custom widget has not been set then %NULL is returned.
457 	 *
458 	 * Return: The #GtkWidget in the column
459 	 *     header, or %NULL
460 	 */
461 	public Widget getWidget()
462 	{
463 		auto p = gtk_tree_view_column_get_widget(gtkTreeViewColumn);
464 		
465 		if(p is null)
466 		{
467 			return null;
468 		}
469 		
470 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
471 	}
472 
473 	/**
474 	 * Returns the current size of @tree_column in pixels.
475 	 *
476 	 * Return: The current width of @tree_column.
477 	 */
478 	public int getWidth()
479 	{
480 		return gtk_tree_view_column_get_width(gtkTreeViewColumn);
481 	}
482 
483 	/**
484 	 * Returns the current X offset of @tree_column in pixels.
485 	 *
486 	 * Return: The current X offset of @tree_column.
487 	 *
488 	 * Since: 3.2
489 	 */
490 	public int getXOffset()
491 	{
492 		return gtk_tree_view_column_get_x_offset(gtkTreeViewColumn);
493 	}
494 
495 	/**
496 	 * Flags the column, and the cell renderers added to this column, to have
497 	 * their sizes renegotiated.
498 	 *
499 	 * Since: 2.8
500 	 */
501 	public void queueResize()
502 	{
503 		gtk_tree_view_column_queue_resize(gtkTreeViewColumn);
504 	}
505 
506 	/**
507 	 * Sets the alignment of the title or custom widget inside the column header.
508 	 * The alignment determines its location inside the button -- 0.0 for left, 0.5
509 	 * for center, 1.0 for right.
510 	 *
511 	 * Params:
512 	 *     xalign = The alignment, which is between [0.0 and 1.0] inclusive.
513 	 */
514 	public void setAlignment(float xalign)
515 	{
516 		gtk_tree_view_column_set_alignment(gtkTreeViewColumn, xalign);
517 	}
518 
519 	/**
520 	 * Sets the #GtkTreeCellDataFunc to use for the column.  This
521 	 * function is used instead of the standard attributes mapping for
522 	 * setting the column value, and should set the value of @tree_column's
523 	 * cell renderer as appropriate.  @func may be %NULL to remove an
524 	 * older one.
525 	 *
526 	 * Params:
527 	 *     cellRenderer = A #GtkCellRenderer
528 	 *     func = The #GtkTreeCellDataFunc to use.
529 	 *     funcData = The user data for @func.
530 	 *     destroy = The destroy notification for @func_data
531 	 */
532 	public void setCellDataFunc(CellRenderer cellRenderer, GtkTreeCellDataFunc func, void* funcData, GDestroyNotify destroy)
533 	{
534 		gtk_tree_view_column_set_cell_data_func(gtkTreeViewColumn, (cellRenderer is null) ? null : cellRenderer.getCellRendererStruct(), func, funcData, destroy);
535 	}
536 
537 	/**
538 	 * Sets the header to be active if @clickable is %TRUE.  When the header is
539 	 * active, then it can take keyboard focus, and can be clicked.
540 	 *
541 	 * Params:
542 	 *     clickable = %TRUE if the header is active.
543 	 */
544 	public void setClickable(bool clickable)
545 	{
546 		gtk_tree_view_column_set_clickable(gtkTreeViewColumn, clickable);
547 	}
548 
549 	/**
550 	 * Sets the column to take available extra space.  This space is shared equally
551 	 * amongst all columns that have the expand set to %TRUE.  If no column has this
552 	 * option set, then the last column gets all extra space.  By default, every
553 	 * column is created with this %FALSE.
554 	 *
555 	 * Along with “fixed-width”, the “expand” property changes when the column is
556 	 * resized by the user.
557 	 *
558 	 * Params:
559 	 *     expand = %TRUE if the column should expand to fill available space.
560 	 *
561 	 * Since: 2.4
562 	 */
563 	public void setExpand(bool expand)
564 	{
565 		gtk_tree_view_column_set_expand(gtkTreeViewColumn, expand);
566 	}
567 
568 	/**
569 	 * If @fixed_width is not -1, sets the fixed width of @tree_column; otherwise
570 	 * unsets it.  The effective value of @fixed_width is clamped between the
571 	 * minimum and maximum width of the column; however, the value stored in the
572 	 * “fixed-width” property is not clamped.  If the column sizing is
573 	 * #GTK_TREE_VIEW_COLUMN_GROW_ONLY or #GTK_TREE_VIEW_COLUMN_AUTOSIZE, setting
574 	 * a fixed width overrides the automatically calculated width.  Note that
575 	 * @fixed_width is only a hint to GTK+; the width actually allocated to the
576 	 * column may be greater or less than requested.
577 	 *
578 	 * Along with “expand”, the “fixed-width” property changes when the column is
579 	 * resized by the user.
580 	 *
581 	 * Params:
582 	 *     fixedWidth = The new fixed width, in pixels, or -1.
583 	 */
584 	public void setFixedWidth(int fixedWidth)
585 	{
586 		gtk_tree_view_column_set_fixed_width(gtkTreeViewColumn, fixedWidth);
587 	}
588 
589 	/**
590 	 * Sets the maximum width of the @tree_column.  If @max_width is -1, then the
591 	 * maximum width is unset.  Note, the column can actually be wider than max
592 	 * width if it’s the last column in a view.  In this case, the column expands to
593 	 * fill any extra space.
594 	 *
595 	 * Params:
596 	 *     maxWidth = The maximum width of the column in pixels, or -1.
597 	 */
598 	public void setMaxWidth(int maxWidth)
599 	{
600 		gtk_tree_view_column_set_max_width(gtkTreeViewColumn, maxWidth);
601 	}
602 
603 	/**
604 	 * Sets the minimum width of the @tree_column.  If @min_width is -1, then the
605 	 * minimum width is unset.
606 	 *
607 	 * Params:
608 	 *     minWidth = The minimum width of the column in pixels, or -1.
609 	 */
610 	public void setMinWidth(int minWidth)
611 	{
612 		gtk_tree_view_column_set_min_width(gtkTreeViewColumn, minWidth);
613 	}
614 
615 	/**
616 	 * If @reorderable is %TRUE, then the column can be reordered by the end user
617 	 * dragging the header.
618 	 *
619 	 * Params:
620 	 *     reorderable = %TRUE, if the column can be reordered.
621 	 */
622 	public void setReorderable(bool reorderable)
623 	{
624 		gtk_tree_view_column_set_reorderable(gtkTreeViewColumn, reorderable);
625 	}
626 
627 	/**
628 	 * If @resizable is %TRUE, then the user can explicitly resize the column by
629 	 * grabbing the outer edge of the column button.  If resizable is %TRUE and
630 	 * sizing mode of the column is #GTK_TREE_VIEW_COLUMN_AUTOSIZE, then the sizing
631 	 * mode is changed to #GTK_TREE_VIEW_COLUMN_GROW_ONLY.
632 	 *
633 	 * Params:
634 	 *     resizable = %TRUE, if the column can be resized
635 	 */
636 	public void setResizable(bool resizable)
637 	{
638 		gtk_tree_view_column_set_resizable(gtkTreeViewColumn, resizable);
639 	}
640 
641 	/**
642 	 * Sets the growth behavior of @tree_column to @type.
643 	 *
644 	 * Params:
645 	 *     type = The #GtkTreeViewColumnSizing.
646 	 */
647 	public void setSizing(GtkTreeViewColumnSizing type)
648 	{
649 		gtk_tree_view_column_set_sizing(gtkTreeViewColumn, type);
650 	}
651 
652 	/**
653 	 * Sets the logical @sort_column_id that this column sorts on when this column
654 	 * is selected for sorting.  Doing so makes the column header clickable.
655 	 *
656 	 * Params:
657 	 *     sortColumnId = The @sort_column_id of the model to sort on.
658 	 */
659 	public void setSortColumnId(int sortColumnId)
660 	{
661 		gtk_tree_view_column_set_sort_column_id(gtkTreeViewColumn, sortColumnId);
662 	}
663 
664 	/**
665 	 * Call this function with a @setting of %TRUE to display an arrow in
666 	 * the header button indicating the column is sorted. Call
667 	 * gtk_tree_view_column_set_sort_order() to change the direction of
668 	 * the arrow.
669 	 *
670 	 * Params:
671 	 *     setting = %TRUE to display an indicator that the column is sorted
672 	 */
673 	public void setSortIndicator(bool setting)
674 	{
675 		gtk_tree_view_column_set_sort_indicator(gtkTreeViewColumn, setting);
676 	}
677 
678 	/**
679 	 * Changes the appearance of the sort indicator.
680 	 *
681 	 * This does not actually sort the model.  Use
682 	 * gtk_tree_view_column_set_sort_column_id() if you want automatic sorting
683 	 * support.  This function is primarily for custom sorting behavior, and should
684 	 * be used in conjunction with gtk_tree_sortable_set_sort_column_id() to do
685 	 * that. For custom models, the mechanism will vary.
686 	 *
687 	 * The sort indicator changes direction to indicate normal sort or reverse sort.
688 	 * Note that you must have the sort indicator enabled to see anything when
689 	 * calling this function; see gtk_tree_view_column_set_sort_indicator().
690 	 *
691 	 * Params:
692 	 *     order = sort order that the sort indicator should indicate
693 	 */
694 	public void setSortOrder(GtkSortType order)
695 	{
696 		gtk_tree_view_column_set_sort_order(gtkTreeViewColumn, order);
697 	}
698 
699 	/**
700 	 * Sets the spacing field of @tree_column, which is the number of pixels to
701 	 * place between cell renderers packed into it.
702 	 *
703 	 * Params:
704 	 *     spacing = distance between cell renderers in pixels.
705 	 */
706 	public void setSpacing(int spacing)
707 	{
708 		gtk_tree_view_column_set_spacing(gtkTreeViewColumn, spacing);
709 	}
710 
711 	/**
712 	 * Sets the title of the @tree_column.  If a custom widget has been set, then
713 	 * this value is ignored.
714 	 *
715 	 * Params:
716 	 *     title = The title of the @tree_column.
717 	 */
718 	public void setTitle(string title)
719 	{
720 		gtk_tree_view_column_set_title(gtkTreeViewColumn, Str.toStringz(title));
721 	}
722 
723 	/**
724 	 * Sets the visibility of @tree_column.
725 	 *
726 	 * Params:
727 	 *     visible = %TRUE if the @tree_column is visible.
728 	 */
729 	public void setVisible(bool visible)
730 	{
731 		gtk_tree_view_column_set_visible(gtkTreeViewColumn, visible);
732 	}
733 
734 	/**
735 	 * Sets the widget in the header to be @widget.  If widget is %NULL, then the
736 	 * header button is set with a #GtkLabel set to the title of @tree_column.
737 	 *
738 	 * Params:
739 	 *     widget = A child #GtkWidget, or %NULL.
740 	 */
741 	public void setWidget(Widget widget)
742 	{
743 		gtk_tree_view_column_set_widget(gtkTreeViewColumn, (widget is null) ? null : widget.getWidgetStruct());
744 	}
745 
746 	protected class OnClickedDelegateWrapper
747 	{
748 		void delegate(TreeViewColumn) dlg;
749 		gulong handlerId;
750 		ConnectFlags flags;
751 		this(void delegate(TreeViewColumn) dlg, gulong handlerId, ConnectFlags flags)
752 		{
753 			this.dlg = dlg;
754 			this.handlerId = handlerId;
755 			this.flags = flags;
756 		}
757 	}
758 	protected OnClickedDelegateWrapper[] onClickedListeners;
759 
760 	/** */
761 	gulong addOnClicked(void delegate(TreeViewColumn) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
762 	{
763 		onClickedListeners ~= new OnClickedDelegateWrapper(dlg, 0, connectFlags);
764 		onClickedListeners[onClickedListeners.length - 1].handlerId = Signals.connectData(
765 			this,
766 			"clicked",
767 			cast(GCallback)&callBackClicked,
768 			cast(void*)onClickedListeners[onClickedListeners.length - 1],
769 			cast(GClosureNotify)&callBackClickedDestroy,
770 			connectFlags);
771 		return onClickedListeners[onClickedListeners.length - 1].handlerId;
772 	}
773 	
774 	extern(C) static void callBackClicked(GtkTreeViewColumn* treeviewcolumnStruct,OnClickedDelegateWrapper wrapper)
775 	{
776 		wrapper.dlg(wrapper.outer);
777 	}
778 	
779 	extern(C) static void callBackClickedDestroy(OnClickedDelegateWrapper wrapper, GClosure* closure)
780 	{
781 		wrapper.outer.internalRemoveOnClicked(wrapper);
782 	}
783 
784 	protected void internalRemoveOnClicked(OnClickedDelegateWrapper source)
785 	{
786 		foreach(index, wrapper; onClickedListeners)
787 		{
788 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
789 			{
790 				onClickedListeners[index] = null;
791 				onClickedListeners = std.algorithm.remove(onClickedListeners, index);
792 				break;
793 			}
794 		}
795 	}
796 	
797 }