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