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