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.TreeView; 26 27 private import cairo.Surface; 28 private import gdk.Window; 29 private import glib.ConstructionException; 30 private import glib.ListG; 31 private import glib.Str; 32 private import gobject.ObjectG; 33 private import gobject.Signals; 34 private import gtk.CellRenderer; 35 private import gtk.Container; 36 private import gtk.Entry; 37 private import gtk.ScrollableIF; 38 private import gtk.ScrollableT; 39 private import gtk.TargetEntry; 40 private import gtk.Tooltip; 41 private import gtk.TreeIter; 42 private import gtk.TreeModel; 43 private import gtk.TreeModelIF; 44 private import gtk.TreePath; 45 private import gtk.TreeSelection; 46 private import gtk.TreeViewColumn; 47 private import gtk.Widget; 48 private import gtkc.gtk; 49 public import gtkc.gtktypes; 50 private import std.algorithm; 51 52 53 /** 54 * Widget that displays any object that implements the #GtkTreeModel interface. 55 * 56 * Please refer to the 57 * [tree widget conceptual overview][TreeWidget] 58 * for an overview of all the objects and data types related 59 * to the tree widget and how they work together. 60 * 61 * Several different coordinate systems are exposed in the GtkTreeView API. 62 * These are: 63 * 64 * ![](tree-view-coordinates.png) 65 * 66 * Coordinate systems in GtkTreeView API: 67 * 68 * - Widget coordinates: Coordinates relative to the widget (usually `widget->window`). 69 * 70 * - Bin window coordinates: Coordinates relative to the window that GtkTreeView renders to. 71 * 72 * - Tree coordinates: Coordinates relative to the entire scrollable area of GtkTreeView. These 73 * coordinates start at (0, 0) for row 0 of the tree. 74 * 75 * Several functions are available for converting between the different 76 * coordinate systems. The most common translations are between widget and bin 77 * window coordinates and between bin window and tree coordinates. For the 78 * former you can use gtk_tree_view_convert_widget_to_bin_window_coords() 79 * (and vice versa), for the latter gtk_tree_view_convert_bin_window_to_tree_coords() 80 * (and vice versa). 81 * 82 * # GtkTreeView as GtkBuildable 83 * 84 * The GtkTreeView implementation of the GtkBuildable interface accepts 85 * #GtkTreeViewColumn objects as <child> elements and exposes the internal 86 * #GtkTreeSelection in UI definitions. 87 * 88 * An example of a UI definition fragment with GtkTreeView: 89 * |[ 90 * <object class="GtkTreeView" id="treeview"> 91 * <property name="model">liststore1</property> 92 * <child> 93 * <object class="GtkTreeViewColumn" id="test-column"> 94 * <property name="title">Test</property> 95 * <child> 96 * <object class="GtkCellRendererText" id="test-renderer"/> 97 * <attributes> 98 * <attribute name="text">1</attribute> 99 * </attributes> 100 * </child> 101 * </object> 102 * </child> 103 * <child internal-child="selection"> 104 * <object class="GtkTreeSelection" id="selection"> 105 * <signal name="changed" handler="on_treeview_selection_changed"/> 106 * </object> 107 * </child> 108 * </object> 109 * ]| 110 * 111 * # CSS nodes 112 * 113 * |[<!-- language="plain" --> 114 * treeview.view 115 * ├── header 116 * │ ├── <column header> 117 * ┊ ┊ 118 * │ ╰── <column header> 119 * │ 120 * ╰── [rubberband] 121 * ]| 122 * 123 * GtkTreeView has a main CSS node with name treeview and style class .view. 124 * It has a subnode with name header, which is the parent for all the column 125 * header widgets' CSS nodes. 126 * For rubberband selection, a subnode with name rubberband is used. 127 */ 128 public class TreeView : Container, ScrollableIF 129 { 130 /** the main Gtk struct */ 131 protected GtkTreeView* gtkTreeView; 132 133 /** Get the main Gtk struct */ 134 public GtkTreeView* getTreeViewStruct(bool transferOwnership = false) 135 { 136 if (transferOwnership) 137 ownedRef = false; 138 return gtkTreeView; 139 } 140 141 /** the main Gtk struct as a void* */ 142 protected override void* getStruct() 143 { 144 return cast(void*)gtkTreeView; 145 } 146 147 protected override void setStruct(GObject* obj) 148 { 149 gtkTreeView = cast(GtkTreeView*)obj; 150 super.setStruct(obj); 151 } 152 153 /** 154 * Sets our main struct and passes it to the parent class. 155 */ 156 public this (GtkTreeView* gtkTreeView, bool ownedRef = false) 157 { 158 this.gtkTreeView = gtkTreeView; 159 super(cast(GtkContainer*)gtkTreeView, ownedRef); 160 } 161 162 // add the Scrollable capabilities 163 mixin ScrollableT!(GtkTreeView); 164 165 /** 166 * Expands the row of the iter. 167 * Params: 168 * iter = 169 * openAll = 170 * Returns = 171 */ 172 int expandRow(TreeIter iter, TreeModelIF model, bool openAll) 173 { 174 return expandRow(model.getPath(iter), openAll); 175 } 176 177 /** 178 * gets the first selected iter or null if no rows are selected 179 */ 180 TreeIter getSelectedIter() 181 { 182 TreeIter iter = null; 183 TreeSelection selection = getSelection(); 184 TreeModelIF model = getModel(); 185 TreePath[] paths = selection.getSelectedRows(model); 186 if ( paths.length > 0 ) 187 { 188 iter = new TreeIter(); 189 model.getIter(iter,paths[0]); 190 } 191 return iter; 192 } 193 194 /** */ 195 TreeIter[] getSelectedIters() 196 { 197 TreeIter[] iters; 198 199 TreeIter iter = new TreeIter(); 200 TreeSelection selection = getSelection(); 201 TreeModelIF model = getModel(); 202 TreePath[] paths = selection.getSelectedRows(model); 203 foreach ( TreePath p; selection.getSelectedRows(model) ) 204 { 205 if ( model.getIter(iter,p) ) 206 { 207 iters ~= iter; 208 iter = new TreeIter(); 209 } 210 } 211 212 return iters; 213 } 214 215 /** 216 * Inserts a column and sets it's attributes 217 * Params: 218 * position = 219 * title = 220 * renderer = 221 * editable = 222 * Returns: number of columns including the new one 223 */ 224 int insertEditableColumn(int position, string title, CellRenderer renderer, bool editable) 225 { 226 // OK, this is a trick because of my ignorance on how to pass variable argument lists 227 if ( position < 0 ) 228 { 229 position = getColumns().length(); 230 } 231 int tot = gtk_tree_view_insert_column_with_attributes( 232 gtkTreeView, 233 position, 234 Str.toStringz(title), 235 renderer.getCellRendererStruct(), 236 Str.toStringz("text"),position, 237 Str.toStringz("editable"),2,0); 238 return tot; 239 } 240 241 /** 242 */ 243 244 /** */ 245 public static GType getType() 246 { 247 return gtk_tree_view_get_type(); 248 } 249 250 /** 251 * Creates a new #GtkTreeView widget. 252 * 253 * Returns: A newly created #GtkTreeView widget. 254 * 255 * Throws: ConstructionException GTK+ fails to create the object. 256 */ 257 public this() 258 { 259 auto p = gtk_tree_view_new(); 260 261 if(p is null) 262 { 263 throw new ConstructionException("null returned by new"); 264 } 265 266 this(cast(GtkTreeView*) p); 267 } 268 269 /** 270 * Creates a new #GtkTreeView widget with the model initialized to @model. 271 * 272 * Params: 273 * model = the model. 274 * 275 * Returns: A newly created #GtkTreeView widget. 276 * 277 * Throws: ConstructionException GTK+ fails to create the object. 278 */ 279 public this(TreeModelIF model) 280 { 281 auto p = gtk_tree_view_new_with_model((model is null) ? null : model.getTreeModelStruct()); 282 283 if(p is null) 284 { 285 throw new ConstructionException("null returned by new_with_model"); 286 } 287 288 this(cast(GtkTreeView*) p); 289 } 290 291 /** 292 * Appends @column to the list of columns. If @tree_view has “fixed_height” 293 * mode enabled, then @column must have its “sizing” property set to be 294 * GTK_TREE_VIEW_COLUMN_FIXED. 295 * 296 * Params: 297 * column = The #GtkTreeViewColumn to add. 298 * 299 * Returns: The number of columns in @tree_view after appending. 300 */ 301 public int appendColumn(TreeViewColumn column) 302 { 303 return gtk_tree_view_append_column(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct()); 304 } 305 306 /** 307 * Recursively collapses all visible, expanded nodes in @tree_view. 308 */ 309 public void collapseAll() 310 { 311 gtk_tree_view_collapse_all(gtkTreeView); 312 } 313 314 /** 315 * Collapses a row (hides its child rows, if they exist). 316 * 317 * Params: 318 * path = path to a row in the @tree_view 319 * 320 * Returns: %TRUE if the row was collapsed. 321 */ 322 public bool collapseRow(TreePath path) 323 { 324 return gtk_tree_view_collapse_row(gtkTreeView, (path is null) ? null : path.getTreePathStruct()) != 0; 325 } 326 327 /** 328 * Resizes all columns to their optimal width. Only works after the 329 * treeview has been realized. 330 */ 331 public void columnsAutosize() 332 { 333 gtk_tree_view_columns_autosize(gtkTreeView); 334 } 335 336 /** 337 * Converts bin_window coordinates to coordinates for the 338 * tree (the full scrollable area of the tree). 339 * 340 * Params: 341 * bx = X coordinate relative to bin_window 342 * by = Y coordinate relative to bin_window 343 * tx = return location for tree X coordinate 344 * ty = return location for tree Y coordinate 345 * 346 * Since: 2.12 347 */ 348 public void convertBinWindowToTreeCoords(int bx, int by, out int tx, out int ty) 349 { 350 gtk_tree_view_convert_bin_window_to_tree_coords(gtkTreeView, bx, by, &tx, &ty); 351 } 352 353 /** 354 * Converts bin_window coordinates (see gtk_tree_view_get_bin_window()) 355 * to widget relative coordinates. 356 * 357 * Params: 358 * bx = bin_window X coordinate 359 * by = bin_window Y coordinate 360 * wx = return location for widget X coordinate 361 * wy = return location for widget Y coordinate 362 * 363 * Since: 2.12 364 */ 365 public void convertBinWindowToWidgetCoords(int bx, int by, out int wx, out int wy) 366 { 367 gtk_tree_view_convert_bin_window_to_widget_coords(gtkTreeView, bx, by, &wx, &wy); 368 } 369 370 /** 371 * Converts tree coordinates (coordinates in full scrollable area of the tree) 372 * to bin_window coordinates. 373 * 374 * Params: 375 * tx = tree X coordinate 376 * ty = tree Y coordinate 377 * bx = return location for X coordinate relative to bin_window 378 * by = return location for Y coordinate relative to bin_window 379 * 380 * Since: 2.12 381 */ 382 public void convertTreeToBinWindowCoords(int tx, int ty, out int bx, out int by) 383 { 384 gtk_tree_view_convert_tree_to_bin_window_coords(gtkTreeView, tx, ty, &bx, &by); 385 } 386 387 /** 388 * Converts tree coordinates (coordinates in full scrollable area of the tree) 389 * to widget coordinates. 390 * 391 * Params: 392 * tx = X coordinate relative to the tree 393 * ty = Y coordinate relative to the tree 394 * wx = return location for widget X coordinate 395 * wy = return location for widget Y coordinate 396 * 397 * Since: 2.12 398 */ 399 public void convertTreeToWidgetCoords(int tx, int ty, out int wx, out int wy) 400 { 401 gtk_tree_view_convert_tree_to_widget_coords(gtkTreeView, tx, ty, &wx, &wy); 402 } 403 404 /** 405 * Converts widget coordinates to coordinates for the bin_window 406 * (see gtk_tree_view_get_bin_window()). 407 * 408 * Params: 409 * wx = X coordinate relative to the widget 410 * wy = Y coordinate relative to the widget 411 * bx = return location for bin_window X coordinate 412 * by = return location for bin_window Y coordinate 413 * 414 * Since: 2.12 415 */ 416 public void convertWidgetToBinWindowCoords(int wx, int wy, out int bx, out int by) 417 { 418 gtk_tree_view_convert_widget_to_bin_window_coords(gtkTreeView, wx, wy, &bx, &by); 419 } 420 421 /** 422 * Converts widget coordinates to coordinates for the 423 * tree (the full scrollable area of the tree). 424 * 425 * Params: 426 * wx = X coordinate relative to the widget 427 * wy = Y coordinate relative to the widget 428 * tx = return location for tree X coordinate 429 * ty = return location for tree Y coordinate 430 * 431 * Since: 2.12 432 */ 433 public void convertWidgetToTreeCoords(int wx, int wy, out int tx, out int ty) 434 { 435 gtk_tree_view_convert_widget_to_tree_coords(gtkTreeView, wx, wy, &tx, &ty); 436 } 437 438 /** 439 * Creates a #cairo_surface_t representation of the row at @path. 440 * This image is used for a drag icon. 441 * 442 * Params: 443 * path = a #GtkTreePath in @tree_view 444 * 445 * Returns: a newly-allocated surface of the drag icon. 446 */ 447 public Surface createRowDragIcon(TreePath path) 448 { 449 auto p = gtk_tree_view_create_row_drag_icon(gtkTreeView, (path is null) ? null : path.getTreePathStruct()); 450 451 if(p is null) 452 { 453 return null; 454 } 455 456 return new Surface(cast(cairo_surface_t*) p); 457 } 458 459 /** 460 * Turns @tree_view into a drop destination for automatic DND. Calling 461 * this method sets #GtkTreeView:reorderable to %FALSE. 462 * 463 * Params: 464 * targets = the table of targets that 465 * the drag will support 466 * nTargets = the number of items in @targets 467 * actions = the bitmask of possible actions for a drag from this 468 * widget 469 */ 470 public void enableModelDragDest(TargetEntry[] targets, GdkDragAction actions) 471 { 472 GtkTargetEntry[] targetsArray = new GtkTargetEntry[targets.length]; 473 for ( int i = 0; i < targets.length; i++ ) 474 { 475 targetsArray[i] = *(targets[i].getTargetEntryStruct()); 476 } 477 478 gtk_tree_view_enable_model_drag_dest(gtkTreeView, targetsArray.ptr, cast(int)targets.length, actions); 479 } 480 481 /** 482 * Turns @tree_view into a drag source for automatic DND. Calling this 483 * method sets #GtkTreeView:reorderable to %FALSE. 484 * 485 * Params: 486 * startButtonMask = Mask of allowed buttons to start drag 487 * targets = the table of targets that the drag will support 488 * nTargets = the number of items in @targets 489 * actions = the bitmask of possible actions for a drag from this 490 * widget 491 */ 492 public void enableModelDragSource(GdkModifierType startButtonMask, TargetEntry[] targets, GdkDragAction actions) 493 { 494 GtkTargetEntry[] targetsArray = new GtkTargetEntry[targets.length]; 495 for ( int i = 0; i < targets.length; i++ ) 496 { 497 targetsArray[i] = *(targets[i].getTargetEntryStruct()); 498 } 499 500 gtk_tree_view_enable_model_drag_source(gtkTreeView, startButtonMask, targetsArray.ptr, cast(int)targets.length, actions); 501 } 502 503 /** 504 * Recursively expands all nodes in the @tree_view. 505 */ 506 public void expandAll() 507 { 508 gtk_tree_view_expand_all(gtkTreeView); 509 } 510 511 /** 512 * Opens the row so its children are visible. 513 * 514 * Params: 515 * path = path to a row 516 * openAll = whether to recursively expand, or just expand immediate children 517 * 518 * Returns: %TRUE if the row existed and had children 519 */ 520 public bool expandRow(TreePath path, bool openAll) 521 { 522 return gtk_tree_view_expand_row(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), openAll) != 0; 523 } 524 525 /** 526 * Expands the row at @path. This will also expand all parent rows of 527 * @path as necessary. 528 * 529 * Params: 530 * path = path to a row. 531 * 532 * Since: 2.2 533 */ 534 public void expandToPath(TreePath path) 535 { 536 gtk_tree_view_expand_to_path(gtkTreeView, (path is null) ? null : path.getTreePathStruct()); 537 } 538 539 /** 540 * Gets the setting set by gtk_tree_view_set_activate_on_single_click(). 541 * 542 * Returns: %TRUE if row-activated will be emitted on a single click 543 * 544 * Since: 3.8 545 */ 546 public bool getActivateOnSingleClick() 547 { 548 return gtk_tree_view_get_activate_on_single_click(gtkTreeView) != 0; 549 } 550 551 /** 552 * Fills the bounding rectangle in bin_window coordinates for the cell at the 553 * row specified by @path and the column specified by @column. If @path is 554 * %NULL, or points to a node not found in the tree, the @y and @height fields of 555 * the rectangle will be filled with 0. If @column is %NULL, the @x and @width 556 * fields will be filled with 0. The returned rectangle is equivalent to the 557 * @background_area passed to gtk_cell_renderer_render(). These background 558 * areas tile to cover the entire bin window. Contrast with the @cell_area, 559 * returned by gtk_tree_view_get_cell_area(), which returns only the cell 560 * itself, excluding surrounding borders and the tree expander area. 561 * 562 * Params: 563 * path = a #GtkTreePath for the row, or %NULL to get only horizontal coordinates 564 * column = a #GtkTreeViewColumn for the column, or %NULL to get only vertical coordiantes 565 * rect = rectangle to fill with cell background rect 566 */ 567 public void getBackgroundArea(TreePath path, TreeViewColumn column, out GdkRectangle rect) 568 { 569 gtk_tree_view_get_background_area(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct(), &rect); 570 } 571 572 /** 573 * Returns the window that @tree_view renders to. 574 * This is used primarily to compare to `event->window` 575 * to confirm that the event on @tree_view is on the right window. 576 * 577 * Returns: A #GdkWindow, or %NULL when @tree_view 578 * hasn’t been realized yet. 579 */ 580 public Window getBinWindow() 581 { 582 auto p = gtk_tree_view_get_bin_window(gtkTreeView); 583 584 if(p is null) 585 { 586 return null; 587 } 588 589 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 590 } 591 592 /** 593 * Fills the bounding rectangle in bin_window coordinates for the cell at the 594 * row specified by @path and the column specified by @column. If @path is 595 * %NULL, or points to a path not currently displayed, the @y and @height fields 596 * of the rectangle will be filled with 0. If @column is %NULL, the @x and @width 597 * fields will be filled with 0. The sum of all cell rects does not cover the 598 * entire tree; there are extra pixels in between rows, for example. The 599 * returned rectangle is equivalent to the @cell_area passed to 600 * gtk_cell_renderer_render(). This function is only valid if @tree_view is 601 * realized. 602 * 603 * Params: 604 * path = a #GtkTreePath for the row, or %NULL to get only horizontal coordinates 605 * column = a #GtkTreeViewColumn for the column, or %NULL to get only vertical coordinates 606 * rect = rectangle to fill with cell rect 607 */ 608 public void getCellArea(TreePath path, TreeViewColumn column, out GdkRectangle rect) 609 { 610 gtk_tree_view_get_cell_area(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct(), &rect); 611 } 612 613 /** 614 * Gets the #GtkTreeViewColumn at the given position in the #tree_view. 615 * 616 * Params: 617 * n = The position of the column, counting from 0. 618 * 619 * Returns: The #GtkTreeViewColumn, or %NULL if the 620 * position is outside the range of columns. 621 */ 622 public TreeViewColumn getColumn(int n) 623 { 624 auto p = gtk_tree_view_get_column(gtkTreeView, n); 625 626 if(p is null) 627 { 628 return null; 629 } 630 631 return ObjectG.getDObject!(TreeViewColumn)(cast(GtkTreeViewColumn*) p); 632 } 633 634 /** 635 * Returns a #GList of all the #GtkTreeViewColumn s currently in @tree_view. 636 * The returned list must be freed with g_list_free (). 637 * 638 * Returns: A list of #GtkTreeViewColumn s 639 */ 640 public ListG getColumns() 641 { 642 auto p = gtk_tree_view_get_columns(gtkTreeView); 643 644 if(p is null) 645 { 646 return null; 647 } 648 649 return new ListG(cast(GList*) p); 650 } 651 652 /** 653 * Fills in @path and @focus_column with the current path and focus column. If 654 * the cursor isn’t currently set, then *@path will be %NULL. If no column 655 * currently has focus, then *@focus_column will be %NULL. 656 * 657 * The returned #GtkTreePath must be freed with gtk_tree_path_free() when 658 * you are done with it. 659 * 660 * Params: 661 * path = A pointer to be 662 * filled with the current cursor path, or %NULL 663 * focusColumn = A 664 * pointer to be filled with the current focus column, or %NULL 665 */ 666 public void getCursor(out TreePath path, out TreeViewColumn focusColumn) 667 { 668 GtkTreePath* outpath = null; 669 GtkTreeViewColumn* outfocusColumn = null; 670 671 gtk_tree_view_get_cursor(gtkTreeView, &outpath, &outfocusColumn); 672 673 path = ObjectG.getDObject!(TreePath)(outpath); 674 focusColumn = ObjectG.getDObject!(TreeViewColumn)(outfocusColumn); 675 } 676 677 /** 678 * Determines the destination row for a given position. @drag_x and 679 * @drag_y are expected to be in widget coordinates. This function is only 680 * meaningful if @tree_view is realized. Therefore this function will always 681 * return %FALSE if @tree_view is not realized or does not have a model. 682 * 683 * Params: 684 * dragX = the position to determine the destination row for 685 * dragY = the position to determine the destination row for 686 * path = Return location for the path of 687 * the highlighted row, or %NULL. 688 * pos = Return location for the drop position, or 689 * %NULL 690 * 691 * Returns: whether there is a row at the given position, %TRUE if this 692 * is indeed the case. 693 */ 694 public bool getDestRowAtPos(int dragX, int dragY, out TreePath path, out GtkTreeViewDropPosition pos) 695 { 696 GtkTreePath* outpath = null; 697 698 auto p = gtk_tree_view_get_dest_row_at_pos(gtkTreeView, dragX, dragY, &outpath, &pos) != 0; 699 700 path = ObjectG.getDObject!(TreePath)(outpath); 701 702 return p; 703 } 704 705 /** 706 * Gets information about the row that is highlighted for feedback. 707 * 708 * Params: 709 * path = Return location for the path of the highlighted row, or %NULL. 710 * pos = Return location for the drop position, or %NULL 711 */ 712 public void getDragDestRow(out TreePath path, out GtkTreeViewDropPosition pos) 713 { 714 GtkTreePath* outpath = null; 715 716 gtk_tree_view_get_drag_dest_row(gtkTreeView, &outpath, &pos); 717 718 path = ObjectG.getDObject!(TreePath)(outpath); 719 } 720 721 /** 722 * Returns whether or not the tree allows to start interactive searching 723 * by typing in text. 724 * 725 * Returns: whether or not to let the user search interactively 726 */ 727 public bool getEnableSearch() 728 { 729 return gtk_tree_view_get_enable_search(gtkTreeView) != 0; 730 } 731 732 /** 733 * Returns whether or not tree lines are drawn in @tree_view. 734 * 735 * Returns: %TRUE if tree lines are drawn in @tree_view, %FALSE 736 * otherwise. 737 * 738 * Since: 2.10 739 */ 740 public bool getEnableTreeLines() 741 { 742 return gtk_tree_view_get_enable_tree_lines(gtkTreeView) != 0; 743 } 744 745 /** 746 * Returns the column that is the current expander column. 747 * This column has the expander arrow drawn next to it. 748 * 749 * Returns: The expander column. 750 */ 751 public TreeViewColumn getExpanderColumn() 752 { 753 auto p = gtk_tree_view_get_expander_column(gtkTreeView); 754 755 if(p is null) 756 { 757 return null; 758 } 759 760 return ObjectG.getDObject!(TreeViewColumn)(cast(GtkTreeViewColumn*) p); 761 } 762 763 /** 764 * Returns whether fixed height mode is turned on for @tree_view. 765 * 766 * Returns: %TRUE if @tree_view is in fixed height mode 767 * 768 * Since: 2.6 769 */ 770 public bool getFixedHeightMode() 771 { 772 return gtk_tree_view_get_fixed_height_mode(gtkTreeView) != 0; 773 } 774 775 /** 776 * Returns which grid lines are enabled in @tree_view. 777 * 778 * Returns: a #GtkTreeViewGridLines value indicating which grid lines 779 * are enabled. 780 * 781 * Since: 2.10 782 */ 783 public GtkTreeViewGridLines getGridLines() 784 { 785 return gtk_tree_view_get_grid_lines(gtkTreeView); 786 } 787 788 /** 789 * Returns whether all header columns are clickable. 790 * 791 * Returns: %TRUE if all header columns are clickable, otherwise %FALSE 792 * 793 * Since: 2.10 794 */ 795 public bool getHeadersClickable() 796 { 797 return gtk_tree_view_get_headers_clickable(gtkTreeView) != 0; 798 } 799 800 /** 801 * Returns %TRUE if the headers on the @tree_view are visible. 802 * 803 * Returns: Whether the headers are visible or not. 804 */ 805 public bool getHeadersVisible() 806 { 807 return gtk_tree_view_get_headers_visible(gtkTreeView) != 0; 808 } 809 810 /** 811 * Returns whether hover expansion mode is turned on for @tree_view. 812 * 813 * Returns: %TRUE if @tree_view is in hover expansion mode 814 * 815 * Since: 2.6 816 */ 817 public bool getHoverExpand() 818 { 819 return gtk_tree_view_get_hover_expand(gtkTreeView) != 0; 820 } 821 822 /** 823 * Returns whether hover selection mode is turned on for @tree_view. 824 * 825 * Returns: %TRUE if @tree_view is in hover selection mode 826 * 827 * Since: 2.6 828 */ 829 public bool getHoverSelection() 830 { 831 return gtk_tree_view_get_hover_selection(gtkTreeView) != 0; 832 } 833 834 /** 835 * Returns the amount, in pixels, of extra indentation for child levels 836 * in @tree_view. 837 * 838 * Returns: the amount of extra indentation for child levels in 839 * @tree_view. A return value of 0 means that this feature is disabled. 840 * 841 * Since: 2.12 842 */ 843 public int getLevelIndentation() 844 { 845 return gtk_tree_view_get_level_indentation(gtkTreeView); 846 } 847 848 /** 849 * Returns the model the #GtkTreeView is based on. Returns %NULL if the 850 * model is unset. 851 * 852 * Returns: A #GtkTreeModel, or %NULL if 853 * none is currently being used. 854 */ 855 public TreeModelIF getModel() 856 { 857 auto p = gtk_tree_view_get_model(gtkTreeView); 858 859 if(p is null) 860 { 861 return null; 862 } 863 864 return ObjectG.getDObject!(TreeModel, TreeModelIF)(cast(GtkTreeModel*) p); 865 } 866 867 /** 868 * Queries the number of columns in the given @tree_view. 869 * 870 * Returns: The number of columns in the @tree_view 871 * 872 * Since: 3.4 873 */ 874 public uint getNColumns() 875 { 876 return gtk_tree_view_get_n_columns(gtkTreeView); 877 } 878 879 /** 880 * Finds the path at the point (@x, @y), relative to bin_window coordinates 881 * (please see gtk_tree_view_get_bin_window()). 882 * That is, @x and @y are relative to an events coordinates. @x and @y must 883 * come from an event on the @tree_view only where `event->window == 884 * gtk_tree_view_get_bin_window ()`. It is primarily for 885 * things like popup menus. If @path is non-%NULL, then it will be filled 886 * with the #GtkTreePath at that point. This path should be freed with 887 * gtk_tree_path_free(). If @column is non-%NULL, then it will be filled 888 * with the column at that point. @cell_x and @cell_y return the coordinates 889 * relative to the cell background (i.e. the @background_area passed to 890 * gtk_cell_renderer_render()). This function is only meaningful if 891 * @tree_view is realized. Therefore this function will always return %FALSE 892 * if @tree_view is not realized or does not have a model. 893 * 894 * For converting widget coordinates (eg. the ones you get from 895 * GtkWidget::query-tooltip), please see 896 * gtk_tree_view_convert_widget_to_bin_window_coords(). 897 * 898 * Params: 899 * x = The x position to be identified (relative to bin_window). 900 * y = The y position to be identified (relative to bin_window). 901 * path = A pointer to a #GtkTreePath 902 * pointer to be filled in, or %NULL 903 * column = A pointer to 904 * a #GtkTreeViewColumn pointer to be filled in, or %NULL 905 * cellX = A pointer where the X coordinate 906 * relative to the cell can be placed, or %NULL 907 * cellY = A pointer where the Y coordinate 908 * relative to the cell can be placed, or %NULL 909 * 910 * Returns: %TRUE if a row exists at that coordinate. 911 */ 912 public bool getPathAtPos(int x, int y, out TreePath path, out TreeViewColumn column, out int cellX, out int cellY) 913 { 914 GtkTreePath* outpath = null; 915 GtkTreeViewColumn* outcolumn = null; 916 917 auto p = gtk_tree_view_get_path_at_pos(gtkTreeView, x, y, &outpath, &outcolumn, &cellX, &cellY) != 0; 918 919 path = ObjectG.getDObject!(TreePath)(outpath); 920 column = ObjectG.getDObject!(TreeViewColumn)(outcolumn); 921 922 return p; 923 } 924 925 /** 926 * Retrieves whether the user can reorder the tree via drag-and-drop. See 927 * gtk_tree_view_set_reorderable(). 928 * 929 * Returns: %TRUE if the tree can be reordered. 930 */ 931 public bool getReorderable() 932 { 933 return gtk_tree_view_get_reorderable(gtkTreeView) != 0; 934 } 935 936 /** 937 * Returns the current row separator function. 938 * 939 * Returns: the current row separator function. 940 * 941 * Since: 2.6 942 */ 943 public GtkTreeViewRowSeparatorFunc getRowSeparatorFunc() 944 { 945 return gtk_tree_view_get_row_separator_func(gtkTreeView); 946 } 947 948 /** 949 * Returns whether rubber banding is turned on for @tree_view. If the 950 * selection mode is #GTK_SELECTION_MULTIPLE, rubber banding will allow the 951 * user to select multiple rows by dragging the mouse. 952 * 953 * Returns: %TRUE if rubber banding in @tree_view is enabled. 954 * 955 * Since: 2.10 956 */ 957 public bool getRubberBanding() 958 { 959 return gtk_tree_view_get_rubber_banding(gtkTreeView) != 0; 960 } 961 962 /** 963 * Gets the setting set by gtk_tree_view_set_rules_hint(). 964 * 965 * Returns: %TRUE if the hint is set 966 */ 967 public bool getRulesHint() 968 { 969 return gtk_tree_view_get_rules_hint(gtkTreeView) != 0; 970 } 971 972 /** 973 * Gets the column searched on by the interactive search code. 974 * 975 * Returns: the column the interactive search code searches in. 976 */ 977 public int getSearchColumn() 978 { 979 return gtk_tree_view_get_search_column(gtkTreeView); 980 } 981 982 /** 983 * Returns the #GtkEntry which is currently in use as interactive search 984 * entry for @tree_view. In case the built-in entry is being used, %NULL 985 * will be returned. 986 * 987 * Returns: the entry currently in use as search entry. 988 * 989 * Since: 2.10 990 */ 991 public Entry getSearchEntry() 992 { 993 auto p = gtk_tree_view_get_search_entry(gtkTreeView); 994 995 if(p is null) 996 { 997 return null; 998 } 999 1000 return ObjectG.getDObject!(Entry)(cast(GtkEntry*) p); 1001 } 1002 1003 /** 1004 * Returns the compare function currently in use. 1005 * 1006 * Returns: the currently used compare function for the search code. 1007 */ 1008 public GtkTreeViewSearchEqualFunc getSearchEqualFunc() 1009 { 1010 return gtk_tree_view_get_search_equal_func(gtkTreeView); 1011 } 1012 1013 /** 1014 * Returns the positioning function currently in use. 1015 * 1016 * Returns: the currently used function for positioning the search dialog. 1017 * 1018 * Since: 2.10 1019 */ 1020 public GtkTreeViewSearchPositionFunc getSearchPositionFunc() 1021 { 1022 return gtk_tree_view_get_search_position_func(gtkTreeView); 1023 } 1024 1025 /** 1026 * Gets the #GtkTreeSelection associated with @tree_view. 1027 * 1028 * Returns: A #GtkTreeSelection object. 1029 */ 1030 public TreeSelection getSelection() 1031 { 1032 auto p = gtk_tree_view_get_selection(gtkTreeView); 1033 1034 if(p is null) 1035 { 1036 return null; 1037 } 1038 1039 return ObjectG.getDObject!(TreeSelection)(cast(GtkTreeSelection*) p); 1040 } 1041 1042 /** 1043 * Returns whether or not expanders are drawn in @tree_view. 1044 * 1045 * Returns: %TRUE if expanders are drawn in @tree_view, %FALSE 1046 * otherwise. 1047 * 1048 * Since: 2.12 1049 */ 1050 public bool getShowExpanders() 1051 { 1052 return gtk_tree_view_get_show_expanders(gtkTreeView) != 0; 1053 } 1054 1055 /** 1056 * Returns the column of @tree_view’s model which is being used for 1057 * displaying tooltips on @tree_view’s rows. 1058 * 1059 * Returns: the index of the tooltip column that is currently being 1060 * used, or -1 if this is disabled. 1061 * 1062 * Since: 2.12 1063 */ 1064 public int getTooltipColumn() 1065 { 1066 return gtk_tree_view_get_tooltip_column(gtkTreeView); 1067 } 1068 1069 /** 1070 * This function is supposed to be used in a #GtkWidget::query-tooltip 1071 * signal handler for #GtkTreeView. The @x, @y and @keyboard_tip values 1072 * which are received in the signal handler, should be passed to this 1073 * function without modification. 1074 * 1075 * The return value indicates whether there is a tree view row at the given 1076 * coordinates (%TRUE) or not (%FALSE) for mouse tooltips. For keyboard 1077 * tooltips the row returned will be the cursor row. When %TRUE, then any of 1078 * @model, @path and @iter which have been provided will be set to point to 1079 * that row and the corresponding model. @x and @y will always be converted 1080 * to be relative to @tree_view’s bin_window if @keyboard_tooltip is %FALSE. 1081 * 1082 * Params: 1083 * x = the x coordinate (relative to widget coordinates) 1084 * y = the y coordinate (relative to widget coordinates) 1085 * keyboardTip = whether this is a keyboard tooltip or not 1086 * model = a pointer to 1087 * receive a #GtkTreeModel or %NULL 1088 * path = a pointer to receive a #GtkTreePath or %NULL 1089 * iter = a pointer to receive a #GtkTreeIter or %NULL 1090 * 1091 * Returns: whether or not the given tooltip context points to a row. 1092 * 1093 * Since: 2.12 1094 */ 1095 public bool getTooltipContext(ref int x, ref int y, bool keyboardTip, out TreeModelIF model, out TreePath path, out TreeIter iter) 1096 { 1097 GtkTreeModel* outmodel = null; 1098 GtkTreePath* outpath = null; 1099 GtkTreeIter* outiter = gMalloc!GtkTreeIter(); 1100 1101 auto p = gtk_tree_view_get_tooltip_context(gtkTreeView, &x, &y, keyboardTip, &outmodel, &outpath, outiter) != 0; 1102 1103 model = ObjectG.getDObject!(TreeModel, TreeModelIF)(outmodel); 1104 path = ObjectG.getDObject!(TreePath)(outpath); 1105 iter = ObjectG.getDObject!(TreeIter)(outiter, true); 1106 1107 return p; 1108 } 1109 1110 /** 1111 * Sets @start_path and @end_path to be the first and last visible path. 1112 * Note that there may be invisible paths in between. 1113 * 1114 * The paths should be freed with gtk_tree_path_free() after use. 1115 * 1116 * Params: 1117 * startPath = Return location for start of region, 1118 * or %NULL. 1119 * endPath = Return location for end of region, or %NULL. 1120 * 1121 * Returns: %TRUE, if valid paths were placed in @start_path and @end_path. 1122 * 1123 * Since: 2.8 1124 */ 1125 public bool getVisibleRange(out TreePath startPath, out TreePath endPath) 1126 { 1127 GtkTreePath* outstartPath = null; 1128 GtkTreePath* outendPath = null; 1129 1130 auto p = gtk_tree_view_get_visible_range(gtkTreeView, &outstartPath, &outendPath) != 0; 1131 1132 startPath = ObjectG.getDObject!(TreePath)(outstartPath); 1133 endPath = ObjectG.getDObject!(TreePath)(outendPath); 1134 1135 return p; 1136 } 1137 1138 /** 1139 * Fills @visible_rect with the currently-visible region of the 1140 * buffer, in tree coordinates. Convert to bin_window coordinates with 1141 * gtk_tree_view_convert_tree_to_bin_window_coords(). 1142 * Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire 1143 * scrollable area of the tree. 1144 * 1145 * Params: 1146 * visibleRect = rectangle to fill 1147 */ 1148 public void getVisibleRect(out GdkRectangle visibleRect) 1149 { 1150 gtk_tree_view_get_visible_rect(gtkTreeView, &visibleRect); 1151 } 1152 1153 /** 1154 * This inserts the @column into the @tree_view at @position. If @position is 1155 * -1, then the column is inserted at the end. If @tree_view has 1156 * “fixed_height” mode enabled, then @column must have its “sizing” property 1157 * set to be GTK_TREE_VIEW_COLUMN_FIXED. 1158 * 1159 * Params: 1160 * column = The #GtkTreeViewColumn to be inserted. 1161 * position = The position to insert @column in. 1162 * 1163 * Returns: The number of columns in @tree_view after insertion. 1164 */ 1165 public int insertColumn(TreeViewColumn column, int position) 1166 { 1167 return gtk_tree_view_insert_column(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct(), position); 1168 } 1169 1170 /** 1171 * Convenience function that inserts a new column into the #GtkTreeView 1172 * with the given cell renderer and a #GtkTreeCellDataFunc to set cell renderer 1173 * attributes (normally using data from the model). See also 1174 * gtk_tree_view_column_set_cell_data_func(), gtk_tree_view_column_pack_start(). 1175 * If @tree_view has “fixed_height” mode enabled, then the new column will have its 1176 * “sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED. 1177 * 1178 * Params: 1179 * position = Position to insert, -1 for append 1180 * title = column title 1181 * cell = cell renderer for column 1182 * func = function to set attributes of cell renderer 1183 * data = data for @func 1184 * dnotify = destroy notifier for @data 1185 * 1186 * Returns: number of columns in the tree view post-insert 1187 */ 1188 public int insertColumnWithDataFunc(int position, string title, CellRenderer cell, GtkTreeCellDataFunc func, void* data, GDestroyNotify dnotify) 1189 { 1190 return gtk_tree_view_insert_column_with_data_func(gtkTreeView, position, Str.toStringz(title), (cell is null) ? null : cell.getCellRendererStruct(), func, data, dnotify); 1191 } 1192 1193 /** 1194 * Determine whether the point (@x, @y) in @tree_view is blank, that is no 1195 * cell content nor an expander arrow is drawn at the location. If so, the 1196 * location can be considered as the background. You might wish to take 1197 * special action on clicks on the background, such as clearing a current 1198 * selection, having a custom context menu or starting rubber banding. 1199 * 1200 * The @x and @y coordinate that are provided must be relative to bin_window 1201 * coordinates. That is, @x and @y must come from an event on @tree_view 1202 * where `event->window == gtk_tree_view_get_bin_window ()`. 1203 * 1204 * For converting widget coordinates (eg. the ones you get from 1205 * GtkWidget::query-tooltip), please see 1206 * gtk_tree_view_convert_widget_to_bin_window_coords(). 1207 * 1208 * The @path, @column, @cell_x and @cell_y arguments will be filled in 1209 * likewise as for gtk_tree_view_get_path_at_pos(). Please see 1210 * gtk_tree_view_get_path_at_pos() for more information. 1211 * 1212 * Params: 1213 * x = The x position to be identified (relative to bin_window) 1214 * y = The y position to be identified (relative to bin_window) 1215 * path = A pointer to a #GtkTreePath pointer to be filled in, or %NULL 1216 * column = A pointer to a #GtkTreeViewColumn pointer to be filled in, or %NULL 1217 * cellX = A pointer where the X coordinate relative to the cell can be placed, or %NULL 1218 * cellY = A pointer where the Y coordinate relative to the cell can be placed, or %NULL 1219 * 1220 * Returns: %TRUE if the area at the given coordinates is blank, 1221 * %FALSE otherwise. 1222 * 1223 * Since: 3.0 1224 */ 1225 public bool isBlankAtPos(int x, int y, out TreePath path, out TreeViewColumn column, out int cellX, out int cellY) 1226 { 1227 GtkTreePath* outpath = null; 1228 GtkTreeViewColumn* outcolumn = null; 1229 1230 auto p = gtk_tree_view_is_blank_at_pos(gtkTreeView, x, y, &outpath, &outcolumn, &cellX, &cellY) != 0; 1231 1232 path = ObjectG.getDObject!(TreePath)(outpath); 1233 column = ObjectG.getDObject!(TreeViewColumn)(outcolumn); 1234 1235 return p; 1236 } 1237 1238 /** 1239 * Returns whether a rubber banding operation is currently being done 1240 * in @tree_view. 1241 * 1242 * Returns: %TRUE if a rubber banding operation is currently being 1243 * done in @tree_view. 1244 * 1245 * Since: 2.12 1246 */ 1247 public bool isRubberBandingActive() 1248 { 1249 return gtk_tree_view_is_rubber_banding_active(gtkTreeView) != 0; 1250 } 1251 1252 /** 1253 * Calls @func on all expanded rows. 1254 * 1255 * Params: 1256 * func = A function to be called 1257 * data = User data to be passed to the function. 1258 */ 1259 public void mapExpandedRows(GtkTreeViewMappingFunc func, void* data) 1260 { 1261 gtk_tree_view_map_expanded_rows(gtkTreeView, func, data); 1262 } 1263 1264 /** 1265 * Moves @column to be after to @base_column. If @base_column is %NULL, then 1266 * @column is placed in the first position. 1267 * 1268 * Params: 1269 * column = The #GtkTreeViewColumn to be moved. 1270 * baseColumn = The #GtkTreeViewColumn to be moved relative to, or %NULL. 1271 */ 1272 public void moveColumnAfter(TreeViewColumn column, TreeViewColumn baseColumn) 1273 { 1274 gtk_tree_view_move_column_after(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct(), (baseColumn is null) ? null : baseColumn.getTreeViewColumnStruct()); 1275 } 1276 1277 /** 1278 * Removes @column from @tree_view. 1279 * 1280 * Params: 1281 * column = The #GtkTreeViewColumn to remove. 1282 * 1283 * Returns: The number of columns in @tree_view after removing. 1284 */ 1285 public int removeColumn(TreeViewColumn column) 1286 { 1287 return gtk_tree_view_remove_column(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct()); 1288 } 1289 1290 /** 1291 * Activates the cell determined by @path and @column. 1292 * 1293 * Params: 1294 * path = The #GtkTreePath to be activated. 1295 * column = The #GtkTreeViewColumn to be activated. 1296 */ 1297 public void rowActivated(TreePath path, TreeViewColumn column) 1298 { 1299 gtk_tree_view_row_activated(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct()); 1300 } 1301 1302 /** 1303 * Returns %TRUE if the node pointed to by @path is expanded in @tree_view. 1304 * 1305 * Params: 1306 * path = A #GtkTreePath to test expansion state. 1307 * 1308 * Returns: %TRUE if #path is expanded. 1309 */ 1310 public bool rowExpanded(TreePath path) 1311 { 1312 return gtk_tree_view_row_expanded(gtkTreeView, (path is null) ? null : path.getTreePathStruct()) != 0; 1313 } 1314 1315 /** 1316 * Moves the alignments of @tree_view to the position specified by @column and 1317 * @path. If @column is %NULL, then no horizontal scrolling occurs. Likewise, 1318 * if @path is %NULL no vertical scrolling occurs. At a minimum, one of @column 1319 * or @path need to be non-%NULL. @row_align determines where the row is 1320 * placed, and @col_align determines where @column is placed. Both are expected 1321 * to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means 1322 * right/bottom alignment, 0.5 means center. 1323 * 1324 * If @use_align is %FALSE, then the alignment arguments are ignored, and the 1325 * tree does the minimum amount of work to scroll the cell onto the screen. 1326 * This means that the cell will be scrolled to the edge closest to its current 1327 * position. If the cell is currently visible on the screen, nothing is done. 1328 * 1329 * This function only works if the model is set, and @path is a valid row on the 1330 * model. If the model changes before the @tree_view is realized, the centered 1331 * path will be modified to reflect this change. 1332 * 1333 * Params: 1334 * path = The path of the row to move to, or %NULL. 1335 * column = The #GtkTreeViewColumn to move horizontally to, or %NULL. 1336 * useAlign = whether to use alignment arguments, or %FALSE. 1337 * rowAlign = The vertical alignment of the row specified by @path. 1338 * colAlign = The horizontal alignment of the column specified by @column. 1339 */ 1340 public void scrollToCell(TreePath path, TreeViewColumn column, bool useAlign, float rowAlign, float colAlign) 1341 { 1342 gtk_tree_view_scroll_to_cell(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct(), useAlign, rowAlign, colAlign); 1343 } 1344 1345 /** 1346 * Scrolls the tree view such that the top-left corner of the visible 1347 * area is @tree_x, @tree_y, where @tree_x and @tree_y are specified 1348 * in tree coordinates. The @tree_view must be realized before 1349 * this function is called. If it isn't, you probably want to be 1350 * using gtk_tree_view_scroll_to_cell(). 1351 * 1352 * If either @tree_x or @tree_y are -1, then that direction isn’t scrolled. 1353 * 1354 * Params: 1355 * treeX = X coordinate of new top-left pixel of visible area, or -1 1356 * treeY = Y coordinate of new top-left pixel of visible area, or -1 1357 */ 1358 public void scrollToPoint(int treeX, int treeY) 1359 { 1360 gtk_tree_view_scroll_to_point(gtkTreeView, treeX, treeY); 1361 } 1362 1363 /** 1364 * Cause the #GtkTreeView::row-activated signal to be emitted 1365 * on a single click instead of a double click. 1366 * 1367 * Params: 1368 * single = %TRUE to emit row-activated on a single click 1369 * 1370 * Since: 3.8 1371 */ 1372 public void setActivateOnSingleClick(bool single) 1373 { 1374 gtk_tree_view_set_activate_on_single_click(gtkTreeView, single); 1375 } 1376 1377 /** 1378 * Sets a user function for determining where a column may be dropped when 1379 * dragged. This function is called on every column pair in turn at the 1380 * beginning of a column drag to determine where a drop can take place. The 1381 * arguments passed to @func are: the @tree_view, the #GtkTreeViewColumn being 1382 * dragged, the two #GtkTreeViewColumn s determining the drop spot, and 1383 * @user_data. If either of the #GtkTreeViewColumn arguments for the drop spot 1384 * are %NULL, then they indicate an edge. If @func is set to be %NULL, then 1385 * @tree_view reverts to the default behavior of allowing all columns to be 1386 * dropped everywhere. 1387 * 1388 * Params: 1389 * func = A function to determine which columns are reorderable, or %NULL. 1390 * userData = User data to be passed to @func, or %NULL 1391 * destroy = Destroy notifier for @user_data, or %NULL 1392 */ 1393 public void setColumnDragFunction(GtkTreeViewColumnDropFunc func, void* userData, GDestroyNotify destroy) 1394 { 1395 gtk_tree_view_set_column_drag_function(gtkTreeView, func, userData, destroy); 1396 } 1397 1398 /** 1399 * Sets the current keyboard focus to be at @path, and selects it. This is 1400 * useful when you want to focus the user’s attention on a particular row. If 1401 * @focus_column is not %NULL, then focus is given to the column specified by 1402 * it. Additionally, if @focus_column is specified, and @start_editing is 1403 * %TRUE, then editing should be started in the specified cell. 1404 * This function is often followed by @gtk_widget_grab_focus (@tree_view) 1405 * in order to give keyboard focus to the widget. Please note that editing 1406 * can only happen when the widget is realized. 1407 * 1408 * If @path is invalid for @model, the current cursor (if any) will be unset 1409 * and the function will return without failing. 1410 * 1411 * Params: 1412 * path = A #GtkTreePath 1413 * focusColumn = A #GtkTreeViewColumn, or %NULL 1414 * startEditing = %TRUE if the specified cell should start being edited. 1415 */ 1416 public void setCursor(TreePath path, TreeViewColumn focusColumn, bool startEditing) 1417 { 1418 gtk_tree_view_set_cursor(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (focusColumn is null) ? null : focusColumn.getTreeViewColumnStruct(), startEditing); 1419 } 1420 1421 /** 1422 * Sets the current keyboard focus to be at @path, and selects it. This is 1423 * useful when you want to focus the user’s attention on a particular row. If 1424 * @focus_column is not %NULL, then focus is given to the column specified by 1425 * it. If @focus_column and @focus_cell are not %NULL, and @focus_column 1426 * contains 2 or more editable or activatable cells, then focus is given to 1427 * the cell specified by @focus_cell. Additionally, if @focus_column is 1428 * specified, and @start_editing is %TRUE, then editing should be started in 1429 * the specified cell. This function is often followed by 1430 * @gtk_widget_grab_focus (@tree_view) in order to give keyboard focus to the 1431 * widget. Please note that editing can only happen when the widget is 1432 * realized. 1433 * 1434 * If @path is invalid for @model, the current cursor (if any) will be unset 1435 * and the function will return without failing. 1436 * 1437 * Params: 1438 * path = A #GtkTreePath 1439 * focusColumn = A #GtkTreeViewColumn, or %NULL 1440 * focusCell = A #GtkCellRenderer, or %NULL 1441 * startEditing = %TRUE if the specified cell should start being edited. 1442 * 1443 * Since: 2.2 1444 */ 1445 public void setCursorOnCell(TreePath path, TreeViewColumn focusColumn, CellRenderer focusCell, bool startEditing) 1446 { 1447 gtk_tree_view_set_cursor_on_cell(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (focusColumn is null) ? null : focusColumn.getTreeViewColumnStruct(), (focusCell is null) ? null : focusCell.getCellRendererStruct(), startEditing); 1448 } 1449 1450 /** 1451 * This function should almost never be used. It is meant for private use by 1452 * ATK for determining the number of visible children that are removed when the 1453 * user collapses a row, or a row is deleted. 1454 * 1455 * Deprecated: Accessibility does not need the function anymore. 1456 * 1457 * Params: 1458 * func = Function to be called when a view row is destroyed, or %NULL 1459 * data = User data to be passed to @func, or %NULL 1460 * destroy = Destroy notifier for @data, or %NULL 1461 */ 1462 public void setDestroyCountFunc(GtkTreeDestroyCountFunc func, void* data, GDestroyNotify destroy) 1463 { 1464 gtk_tree_view_set_destroy_count_func(gtkTreeView, func, data, destroy); 1465 } 1466 1467 /** 1468 * Sets the row that is highlighted for feedback. 1469 * If @path is %NULL, an existing highlight is removed. 1470 * 1471 * Params: 1472 * path = The path of the row to highlight, or %NULL 1473 * pos = Specifies whether to drop before, after or into the row 1474 */ 1475 public void setDragDestRow(TreePath path, GtkTreeViewDropPosition pos) 1476 { 1477 gtk_tree_view_set_drag_dest_row(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), pos); 1478 } 1479 1480 /** 1481 * If @enable_search is set, then the user can type in text to search through 1482 * the tree interactively (this is sometimes called "typeahead find"). 1483 * 1484 * Note that even if this is %FALSE, the user can still initiate a search 1485 * using the “start-interactive-search” key binding. 1486 * 1487 * Params: 1488 * enableSearch = %TRUE, if the user can search interactively 1489 */ 1490 public void setEnableSearch(bool enableSearch) 1491 { 1492 gtk_tree_view_set_enable_search(gtkTreeView, enableSearch); 1493 } 1494 1495 /** 1496 * Sets whether to draw lines interconnecting the expanders in @tree_view. 1497 * This does not have any visible effects for lists. 1498 * 1499 * Params: 1500 * enabled = %TRUE to enable tree line drawing, %FALSE otherwise. 1501 * 1502 * Since: 2.10 1503 */ 1504 public void setEnableTreeLines(bool enabled) 1505 { 1506 gtk_tree_view_set_enable_tree_lines(gtkTreeView, enabled); 1507 } 1508 1509 /** 1510 * Sets the column to draw the expander arrow at. It must be in @tree_view. 1511 * If @column is %NULL, then the expander arrow is always at the first 1512 * visible column. 1513 * 1514 * If you do not want expander arrow to appear in your tree, set the 1515 * expander column to a hidden column. 1516 * 1517 * Params: 1518 * column = %NULL, or the column to draw the expander arrow at. 1519 */ 1520 public void setExpanderColumn(TreeViewColumn column) 1521 { 1522 gtk_tree_view_set_expander_column(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct()); 1523 } 1524 1525 /** 1526 * Enables or disables the fixed height mode of @tree_view. 1527 * Fixed height mode speeds up #GtkTreeView by assuming that all 1528 * rows have the same height. 1529 * Only enable this option if all rows are the same height and all 1530 * columns are of type %GTK_TREE_VIEW_COLUMN_FIXED. 1531 * 1532 * Params: 1533 * enable = %TRUE to enable fixed height mode 1534 * 1535 * Since: 2.6 1536 */ 1537 public void setFixedHeightMode(bool enable) 1538 { 1539 gtk_tree_view_set_fixed_height_mode(gtkTreeView, enable); 1540 } 1541 1542 /** 1543 * Sets which grid lines to draw in @tree_view. 1544 * 1545 * Params: 1546 * gridLines = a #GtkTreeViewGridLines value indicating which grid lines to 1547 * enable. 1548 * 1549 * Since: 2.10 1550 */ 1551 public void setGridLines(GtkTreeViewGridLines gridLines) 1552 { 1553 gtk_tree_view_set_grid_lines(gtkTreeView, gridLines); 1554 } 1555 1556 /** 1557 * Allow the column title buttons to be clicked. 1558 * 1559 * Params: 1560 * setting = %TRUE if the columns are clickable. 1561 */ 1562 public void setHeadersClickable(bool setting) 1563 { 1564 gtk_tree_view_set_headers_clickable(gtkTreeView, setting); 1565 } 1566 1567 /** 1568 * Sets the visibility state of the headers. 1569 * 1570 * Params: 1571 * headersVisible = %TRUE if the headers are visible 1572 */ 1573 public void setHeadersVisible(bool headersVisible) 1574 { 1575 gtk_tree_view_set_headers_visible(gtkTreeView, headersVisible); 1576 } 1577 1578 /** 1579 * Enables or disables the hover expansion mode of @tree_view. 1580 * Hover expansion makes rows expand or collapse if the pointer 1581 * moves over them. 1582 * 1583 * Params: 1584 * expand = %TRUE to enable hover selection mode 1585 * 1586 * Since: 2.6 1587 */ 1588 public void setHoverExpand(bool expand) 1589 { 1590 gtk_tree_view_set_hover_expand(gtkTreeView, expand); 1591 } 1592 1593 /** 1594 * Enables or disables the hover selection mode of @tree_view. 1595 * Hover selection makes the selected row follow the pointer. 1596 * Currently, this works only for the selection modes 1597 * %GTK_SELECTION_SINGLE and %GTK_SELECTION_BROWSE. 1598 * 1599 * Params: 1600 * hover = %TRUE to enable hover selection mode 1601 * 1602 * Since: 2.6 1603 */ 1604 public void setHoverSelection(bool hover) 1605 { 1606 gtk_tree_view_set_hover_selection(gtkTreeView, hover); 1607 } 1608 1609 /** 1610 * Sets the amount of extra indentation for child levels to use in @tree_view 1611 * in addition to the default indentation. The value should be specified in 1612 * pixels, a value of 0 disables this feature and in this case only the default 1613 * indentation will be used. 1614 * This does not have any visible effects for lists. 1615 * 1616 * Params: 1617 * indentation = the amount, in pixels, of extra indentation in @tree_view. 1618 * 1619 * Since: 2.12 1620 */ 1621 public void setLevelIndentation(int indentation) 1622 { 1623 gtk_tree_view_set_level_indentation(gtkTreeView, indentation); 1624 } 1625 1626 /** 1627 * Sets the model for a #GtkTreeView. If the @tree_view already has a model 1628 * set, it will remove it before setting the new model. If @model is %NULL, 1629 * then it will unset the old model. 1630 * 1631 * Params: 1632 * model = The model. 1633 */ 1634 public void setModel(TreeModelIF model) 1635 { 1636 gtk_tree_view_set_model(gtkTreeView, (model is null) ? null : model.getTreeModelStruct()); 1637 } 1638 1639 /** 1640 * This function is a convenience function to allow you to reorder 1641 * models that support the #GtkTreeDragSourceIface and the 1642 * #GtkTreeDragDestIface. Both #GtkTreeStore and #GtkListStore support 1643 * these. If @reorderable is %TRUE, then the user can reorder the 1644 * model by dragging and dropping rows. The developer can listen to 1645 * these changes by connecting to the model’s #GtkTreeModel::row-inserted 1646 * and #GtkTreeModel::row-deleted signals. The reordering is implemented 1647 * by setting up the tree view as a drag source and destination. 1648 * Therefore, drag and drop can not be used in a reorderable view for any 1649 * other purpose. 1650 * 1651 * This function does not give you any degree of control over the order -- any 1652 * reordering is allowed. If more control is needed, you should probably 1653 * handle drag and drop manually. 1654 * 1655 * Params: 1656 * reorderable = %TRUE, if the tree can be reordered. 1657 */ 1658 public void setReorderable(bool reorderable) 1659 { 1660 gtk_tree_view_set_reorderable(gtkTreeView, reorderable); 1661 } 1662 1663 /** 1664 * Sets the row separator function, which is used to determine 1665 * whether a row should be drawn as a separator. If the row separator 1666 * function is %NULL, no separators are drawn. This is the default value. 1667 * 1668 * Params: 1669 * func = a #GtkTreeViewRowSeparatorFunc 1670 * data = user data to pass to @func, or %NULL 1671 * destroy = destroy notifier for @data, or %NULL 1672 * 1673 * Since: 2.6 1674 */ 1675 public void setRowSeparatorFunc(GtkTreeViewRowSeparatorFunc func, void* data, GDestroyNotify destroy) 1676 { 1677 gtk_tree_view_set_row_separator_func(gtkTreeView, func, data, destroy); 1678 } 1679 1680 /** 1681 * Enables or disables rubber banding in @tree_view. If the selection mode 1682 * is #GTK_SELECTION_MULTIPLE, rubber banding will allow the user to select 1683 * multiple rows by dragging the mouse. 1684 * 1685 * Params: 1686 * enable = %TRUE to enable rubber banding 1687 * 1688 * Since: 2.10 1689 */ 1690 public void setRubberBanding(bool enable) 1691 { 1692 gtk_tree_view_set_rubber_banding(gtkTreeView, enable); 1693 } 1694 1695 /** 1696 * Sets a hint for the theme to draw even/odd rows in the @tree_view 1697 * with different colors, also known as "zebra striping". 1698 * 1699 * This function tells the GTK+ theme that the user interface for your 1700 * application requires users to read across tree rows and associate 1701 * cells with one another. 1702 * 1703 * Do not use it just because you prefer the appearance of the ruled 1704 * tree; that’s a question for the theme. Some themes will draw tree 1705 * rows in alternating colors even when rules are turned off, and 1706 * users who prefer that appearance all the time can choose those 1707 * themes. You should call this function only as a semantic hint to 1708 * the theme engine that your tree makes alternating colors useful 1709 * from a functional standpoint (since it has lots of columns, 1710 * generally). 1711 * 1712 * Params: 1713 * setting = %TRUE if the tree requires reading across rows 1714 */ 1715 public void setRulesHint(bool setting) 1716 { 1717 gtk_tree_view_set_rules_hint(gtkTreeView, setting); 1718 } 1719 1720 /** 1721 * Sets @column as the column where the interactive search code should 1722 * search in for the current model. 1723 * 1724 * If the search column is set, users can use the “start-interactive-search” 1725 * key binding to bring up search popup. The enable-search property controls 1726 * whether simply typing text will also start an interactive search. 1727 * 1728 * Note that @column refers to a column of the current model. The search 1729 * column is reset to -1 when the model is changed. 1730 * 1731 * Params: 1732 * column = the column of the model to search in, or -1 to disable searching 1733 */ 1734 public void setSearchColumn(int column) 1735 { 1736 gtk_tree_view_set_search_column(gtkTreeView, column); 1737 } 1738 1739 /** 1740 * Sets the entry which the interactive search code will use for this 1741 * @tree_view. This is useful when you want to provide a search entry 1742 * in our interface at all time at a fixed position. Passing %NULL for 1743 * @entry will make the interactive search code use the built-in popup 1744 * entry again. 1745 * 1746 * Params: 1747 * entry = the entry the interactive search code of @tree_view should use or %NULL 1748 * 1749 * Since: 2.10 1750 */ 1751 public void setSearchEntry(Entry entry) 1752 { 1753 gtk_tree_view_set_search_entry(gtkTreeView, (entry is null) ? null : entry.getEntryStruct()); 1754 } 1755 1756 /** 1757 * Sets the compare function for the interactive search capabilities; note 1758 * that somewhat like strcmp() returning 0 for equality 1759 * #GtkTreeViewSearchEqualFunc returns %FALSE on matches. 1760 * 1761 * Params: 1762 * searchEqualFunc = the compare function to use during the search 1763 * searchUserData = user data to pass to @search_equal_func, or %NULL 1764 * searchDestroy = Destroy notifier for @search_user_data, or %NULL 1765 */ 1766 public void setSearchEqualFunc(GtkTreeViewSearchEqualFunc searchEqualFunc, void* searchUserData, GDestroyNotify searchDestroy) 1767 { 1768 gtk_tree_view_set_search_equal_func(gtkTreeView, searchEqualFunc, searchUserData, searchDestroy); 1769 } 1770 1771 /** 1772 * Sets the function to use when positioning the search dialog. 1773 * 1774 * Params: 1775 * func = the function to use to position the search dialog, or %NULL 1776 * to use the default search position function 1777 * data = user data to pass to @func, or %NULL 1778 * destroy = Destroy notifier for @data, or %NULL 1779 * 1780 * Since: 2.10 1781 */ 1782 public void setSearchPositionFunc(GtkTreeViewSearchPositionFunc func, void* data, GDestroyNotify destroy) 1783 { 1784 gtk_tree_view_set_search_position_func(gtkTreeView, func, data, destroy); 1785 } 1786 1787 /** 1788 * Sets whether to draw and enable expanders and indent child rows in 1789 * @tree_view. When disabled there will be no expanders visible in trees 1790 * and there will be no way to expand and collapse rows by default. Also 1791 * note that hiding the expanders will disable the default indentation. You 1792 * can set a custom indentation in this case using 1793 * gtk_tree_view_set_level_indentation(). 1794 * This does not have any visible effects for lists. 1795 * 1796 * Params: 1797 * enabled = %TRUE to enable expander drawing, %FALSE otherwise. 1798 * 1799 * Since: 2.12 1800 */ 1801 public void setShowExpanders(bool enabled) 1802 { 1803 gtk_tree_view_set_show_expanders(gtkTreeView, enabled); 1804 } 1805 1806 /** 1807 * Sets the tip area of @tooltip to the area @path, @column and @cell have 1808 * in common. For example if @path is %NULL and @column is set, the tip 1809 * area will be set to the full area covered by @column. See also 1810 * gtk_tooltip_set_tip_area(). 1811 * 1812 * Note that if @path is not specified and @cell is set and part of a column 1813 * containing the expander, the tooltip might not show and hide at the correct 1814 * position. In such cases @path must be set to the current node under the 1815 * mouse cursor for this function to operate correctly. 1816 * 1817 * See also gtk_tree_view_set_tooltip_column() for a simpler alternative. 1818 * 1819 * Params: 1820 * tooltip = a #GtkTooltip 1821 * path = a #GtkTreePath or %NULL 1822 * column = a #GtkTreeViewColumn or %NULL 1823 * cell = a #GtkCellRenderer or %NULL 1824 * 1825 * Since: 2.12 1826 */ 1827 public void setTooltipCell(Tooltip tooltip, TreePath path, TreeViewColumn column, CellRenderer cell) 1828 { 1829 gtk_tree_view_set_tooltip_cell(gtkTreeView, (tooltip is null) ? null : tooltip.getTooltipStruct(), (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct(), (cell is null) ? null : cell.getCellRendererStruct()); 1830 } 1831 1832 /** 1833 * If you only plan to have simple (text-only) tooltips on full rows, you 1834 * can use this function to have #GtkTreeView handle these automatically 1835 * for you. @column should be set to the column in @tree_view’s model 1836 * containing the tooltip texts, or -1 to disable this feature. 1837 * 1838 * When enabled, #GtkWidget:has-tooltip will be set to %TRUE and 1839 * @tree_view will connect a #GtkWidget::query-tooltip signal handler. 1840 * 1841 * Note that the signal handler sets the text with gtk_tooltip_set_markup(), 1842 * so &, <, etc have to be escaped in the text. 1843 * 1844 * Params: 1845 * column = an integer, which is a valid column number for @tree_view’s model 1846 * 1847 * Since: 2.12 1848 */ 1849 public void setTooltipColumn(int column) 1850 { 1851 gtk_tree_view_set_tooltip_column(gtkTreeView, column); 1852 } 1853 1854 /** 1855 * Sets the tip area of @tooltip to be the area covered by the row at @path. 1856 * See also gtk_tree_view_set_tooltip_column() for a simpler alternative. 1857 * See also gtk_tooltip_set_tip_area(). 1858 * 1859 * Params: 1860 * tooltip = a #GtkTooltip 1861 * path = a #GtkTreePath 1862 * 1863 * Since: 2.12 1864 */ 1865 public void setTooltipRow(Tooltip tooltip, TreePath path) 1866 { 1867 gtk_tree_view_set_tooltip_row(gtkTreeView, (tooltip is null) ? null : tooltip.getTooltipStruct(), (path is null) ? null : path.getTreePathStruct()); 1868 } 1869 1870 /** 1871 * Undoes the effect of 1872 * gtk_tree_view_enable_model_drag_dest(). Calling this method sets 1873 * #GtkTreeView:reorderable to %FALSE. 1874 */ 1875 public void unsetRowsDragDest() 1876 { 1877 gtk_tree_view_unset_rows_drag_dest(gtkTreeView); 1878 } 1879 1880 /** 1881 * Undoes the effect of 1882 * gtk_tree_view_enable_model_drag_source(). Calling this method sets 1883 * #GtkTreeView:reorderable to %FALSE. 1884 */ 1885 public void unsetRowsDragSource() 1886 { 1887 gtk_tree_view_unset_rows_drag_source(gtkTreeView); 1888 } 1889 1890 protected class OnColumnsChangedDelegateWrapper 1891 { 1892 static OnColumnsChangedDelegateWrapper[] listeners; 1893 void delegate(TreeView) dlg; 1894 gulong handlerId; 1895 1896 this(void delegate(TreeView) dlg) 1897 { 1898 this.dlg = dlg; 1899 this.listeners ~= this; 1900 } 1901 1902 void remove(OnColumnsChangedDelegateWrapper source) 1903 { 1904 foreach(index, wrapper; listeners) 1905 { 1906 if (wrapper.handlerId == source.handlerId) 1907 { 1908 listeners[index] = null; 1909 listeners = std.algorithm.remove(listeners, index); 1910 break; 1911 } 1912 } 1913 } 1914 } 1915 1916 /** 1917 * The number of columns of the treeview has changed. 1918 */ 1919 gulong addOnColumnsChanged(void delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1920 { 1921 auto wrapper = new OnColumnsChangedDelegateWrapper(dlg); 1922 wrapper.handlerId = Signals.connectData( 1923 this, 1924 "columns-changed", 1925 cast(GCallback)&callBackColumnsChanged, 1926 cast(void*)wrapper, 1927 cast(GClosureNotify)&callBackColumnsChangedDestroy, 1928 connectFlags); 1929 return wrapper.handlerId; 1930 } 1931 1932 extern(C) static void callBackColumnsChanged(GtkTreeView* treeviewStruct, OnColumnsChangedDelegateWrapper wrapper) 1933 { 1934 wrapper.dlg(wrapper.outer); 1935 } 1936 1937 extern(C) static void callBackColumnsChangedDestroy(OnColumnsChangedDelegateWrapper wrapper, GClosure* closure) 1938 { 1939 wrapper.remove(wrapper); 1940 } 1941 1942 protected class OnCursorChangedDelegateWrapper 1943 { 1944 static OnCursorChangedDelegateWrapper[] listeners; 1945 void delegate(TreeView) dlg; 1946 gulong handlerId; 1947 1948 this(void delegate(TreeView) dlg) 1949 { 1950 this.dlg = dlg; 1951 this.listeners ~= this; 1952 } 1953 1954 void remove(OnCursorChangedDelegateWrapper source) 1955 { 1956 foreach(index, wrapper; listeners) 1957 { 1958 if (wrapper.handlerId == source.handlerId) 1959 { 1960 listeners[index] = null; 1961 listeners = std.algorithm.remove(listeners, index); 1962 break; 1963 } 1964 } 1965 } 1966 } 1967 1968 /** 1969 * The position of the cursor (focused cell) has changed. 1970 */ 1971 gulong addOnCursorChanged(void delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1972 { 1973 auto wrapper = new OnCursorChangedDelegateWrapper(dlg); 1974 wrapper.handlerId = Signals.connectData( 1975 this, 1976 "cursor-changed", 1977 cast(GCallback)&callBackCursorChanged, 1978 cast(void*)wrapper, 1979 cast(GClosureNotify)&callBackCursorChangedDestroy, 1980 connectFlags); 1981 return wrapper.handlerId; 1982 } 1983 1984 extern(C) static void callBackCursorChanged(GtkTreeView* treeviewStruct, OnCursorChangedDelegateWrapper wrapper) 1985 { 1986 wrapper.dlg(wrapper.outer); 1987 } 1988 1989 extern(C) static void callBackCursorChangedDestroy(OnCursorChangedDelegateWrapper wrapper, GClosure* closure) 1990 { 1991 wrapper.remove(wrapper); 1992 } 1993 1994 protected class OnExpandCollapseCursorRowDelegateWrapper 1995 { 1996 static OnExpandCollapseCursorRowDelegateWrapper[] listeners; 1997 bool delegate(bool, bool, bool, TreeView) dlg; 1998 gulong handlerId; 1999 2000 this(bool delegate(bool, bool, bool, TreeView) dlg) 2001 { 2002 this.dlg = dlg; 2003 this.listeners ~= this; 2004 } 2005 2006 void remove(OnExpandCollapseCursorRowDelegateWrapper source) 2007 { 2008 foreach(index, wrapper; listeners) 2009 { 2010 if (wrapper.handlerId == source.handlerId) 2011 { 2012 listeners[index] = null; 2013 listeners = std.algorithm.remove(listeners, index); 2014 break; 2015 } 2016 } 2017 } 2018 } 2019 2020 /** */ 2021 gulong addOnExpandCollapseCursorRow(bool delegate(bool, bool, bool, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2022 { 2023 auto wrapper = new OnExpandCollapseCursorRowDelegateWrapper(dlg); 2024 wrapper.handlerId = Signals.connectData( 2025 this, 2026 "expand-collapse-cursor-row", 2027 cast(GCallback)&callBackExpandCollapseCursorRow, 2028 cast(void*)wrapper, 2029 cast(GClosureNotify)&callBackExpandCollapseCursorRowDestroy, 2030 connectFlags); 2031 return wrapper.handlerId; 2032 } 2033 2034 extern(C) static int callBackExpandCollapseCursorRow(GtkTreeView* treeviewStruct, bool object, bool p0, bool p1, OnExpandCollapseCursorRowDelegateWrapper wrapper) 2035 { 2036 return wrapper.dlg(object, p0, p1, wrapper.outer); 2037 } 2038 2039 extern(C) static void callBackExpandCollapseCursorRowDestroy(OnExpandCollapseCursorRowDelegateWrapper wrapper, GClosure* closure) 2040 { 2041 wrapper.remove(wrapper); 2042 } 2043 2044 protected class OnMoveCursorDelegateWrapper 2045 { 2046 static OnMoveCursorDelegateWrapper[] listeners; 2047 bool delegate(GtkMovementStep, int, TreeView) dlg; 2048 gulong handlerId; 2049 2050 this(bool delegate(GtkMovementStep, int, TreeView) dlg) 2051 { 2052 this.dlg = dlg; 2053 this.listeners ~= this; 2054 } 2055 2056 void remove(OnMoveCursorDelegateWrapper source) 2057 { 2058 foreach(index, wrapper; listeners) 2059 { 2060 if (wrapper.handlerId == source.handlerId) 2061 { 2062 listeners[index] = null; 2063 listeners = std.algorithm.remove(listeners, index); 2064 break; 2065 } 2066 } 2067 } 2068 } 2069 2070 /** 2071 * The #GtkTreeView::move-cursor signal is a [keybinding 2072 * signal][GtkBindingSignal] which gets emitted when the user 2073 * presses one of the cursor keys. 2074 * 2075 * Applications should not connect to it, but may emit it with 2076 * g_signal_emit_by_name() if they need to control the cursor 2077 * programmatically. In contrast to gtk_tree_view_set_cursor() and 2078 * gtk_tree_view_set_cursor_on_cell() when moving horizontally 2079 * #GtkTreeView::move-cursor does not reset the current selection. 2080 * 2081 * Params: 2082 * step = the granularity of the move, as a 2083 * #GtkMovementStep. %GTK_MOVEMENT_LOGICAL_POSITIONS, 2084 * %GTK_MOVEMENT_VISUAL_POSITIONS, %GTK_MOVEMENT_DISPLAY_LINES, 2085 * %GTK_MOVEMENT_PAGES and %GTK_MOVEMENT_BUFFER_ENDS are 2086 * supported. %GTK_MOVEMENT_LOGICAL_POSITIONS and 2087 * %GTK_MOVEMENT_VISUAL_POSITIONS are treated identically. 2088 * direction = the direction to move: +1 to move forwards; 2089 * -1 to move backwards. The resulting movement is 2090 * undefined for all other values. 2091 * 2092 * Returns: %TRUE if @step is supported, %FALSE otherwise. 2093 */ 2094 gulong addOnMoveCursor(bool delegate(GtkMovementStep, int, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2095 { 2096 auto wrapper = new OnMoveCursorDelegateWrapper(dlg); 2097 wrapper.handlerId = Signals.connectData( 2098 this, 2099 "move-cursor", 2100 cast(GCallback)&callBackMoveCursor, 2101 cast(void*)wrapper, 2102 cast(GClosureNotify)&callBackMoveCursorDestroy, 2103 connectFlags); 2104 return wrapper.handlerId; 2105 } 2106 2107 extern(C) static int callBackMoveCursor(GtkTreeView* treeviewStruct, GtkMovementStep step, int direction, OnMoveCursorDelegateWrapper wrapper) 2108 { 2109 return wrapper.dlg(step, direction, wrapper.outer); 2110 } 2111 2112 extern(C) static void callBackMoveCursorDestroy(OnMoveCursorDelegateWrapper wrapper, GClosure* closure) 2113 { 2114 wrapper.remove(wrapper); 2115 } 2116 2117 protected class OnRowActivatedDelegateWrapper 2118 { 2119 static OnRowActivatedDelegateWrapper[] listeners; 2120 void delegate(TreePath, TreeViewColumn, TreeView) dlg; 2121 gulong handlerId; 2122 2123 this(void delegate(TreePath, TreeViewColumn, TreeView) dlg) 2124 { 2125 this.dlg = dlg; 2126 this.listeners ~= this; 2127 } 2128 2129 void remove(OnRowActivatedDelegateWrapper source) 2130 { 2131 foreach(index, wrapper; listeners) 2132 { 2133 if (wrapper.handlerId == source.handlerId) 2134 { 2135 listeners[index] = null; 2136 listeners = std.algorithm.remove(listeners, index); 2137 break; 2138 } 2139 } 2140 } 2141 } 2142 2143 /** 2144 * The "row-activated" signal is emitted when the method 2145 * gtk_tree_view_row_activated() is called, when the user double 2146 * clicks a treeview row with the "activate-on-single-click" 2147 * property set to %FALSE, or when the user single clicks a row when 2148 * the "activate-on-single-click" property set to %TRUE. It is also 2149 * emitted when a non-editable row is selected and one of the keys: 2150 * Space, Shift+Space, Return or Enter is pressed. 2151 * 2152 * For selection handling refer to the 2153 * [tree widget conceptual overview][TreeWidget] 2154 * as well as #GtkTreeSelection. 2155 * 2156 * Params: 2157 * path = the #GtkTreePath for the activated row 2158 * column = the #GtkTreeViewColumn in which the activation occurred 2159 */ 2160 gulong addOnRowActivated(void delegate(TreePath, TreeViewColumn, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2161 { 2162 auto wrapper = new OnRowActivatedDelegateWrapper(dlg); 2163 wrapper.handlerId = Signals.connectData( 2164 this, 2165 "row-activated", 2166 cast(GCallback)&callBackRowActivated, 2167 cast(void*)wrapper, 2168 cast(GClosureNotify)&callBackRowActivatedDestroy, 2169 connectFlags); 2170 return wrapper.handlerId; 2171 } 2172 2173 extern(C) static void callBackRowActivated(GtkTreeView* treeviewStruct, GtkTreePath* path, GtkTreeViewColumn* column, OnRowActivatedDelegateWrapper wrapper) 2174 { 2175 wrapper.dlg(ObjectG.getDObject!(TreePath)(path), ObjectG.getDObject!(TreeViewColumn)(column), wrapper.outer); 2176 } 2177 2178 extern(C) static void callBackRowActivatedDestroy(OnRowActivatedDelegateWrapper wrapper, GClosure* closure) 2179 { 2180 wrapper.remove(wrapper); 2181 } 2182 2183 protected class OnRowCollapsedDelegateWrapper 2184 { 2185 static OnRowCollapsedDelegateWrapper[] listeners; 2186 void delegate(TreeIter, TreePath, TreeView) dlg; 2187 gulong handlerId; 2188 2189 this(void delegate(TreeIter, TreePath, TreeView) dlg) 2190 { 2191 this.dlg = dlg; 2192 this.listeners ~= this; 2193 } 2194 2195 void remove(OnRowCollapsedDelegateWrapper source) 2196 { 2197 foreach(index, wrapper; listeners) 2198 { 2199 if (wrapper.handlerId == source.handlerId) 2200 { 2201 listeners[index] = null; 2202 listeners = std.algorithm.remove(listeners, index); 2203 break; 2204 } 2205 } 2206 } 2207 } 2208 2209 /** 2210 * The given row has been collapsed (child nodes are hidden). 2211 * 2212 * Params: 2213 * iter = the tree iter of the collapsed row 2214 * path = a tree path that points to the row 2215 */ 2216 gulong addOnRowCollapsed(void delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2217 { 2218 auto wrapper = new OnRowCollapsedDelegateWrapper(dlg); 2219 wrapper.handlerId = Signals.connectData( 2220 this, 2221 "row-collapsed", 2222 cast(GCallback)&callBackRowCollapsed, 2223 cast(void*)wrapper, 2224 cast(GClosureNotify)&callBackRowCollapsedDestroy, 2225 connectFlags); 2226 return wrapper.handlerId; 2227 } 2228 2229 extern(C) static void callBackRowCollapsed(GtkTreeView* treeviewStruct, GtkTreeIter* iter, GtkTreePath* path, OnRowCollapsedDelegateWrapper wrapper) 2230 { 2231 wrapper.dlg(ObjectG.getDObject!(TreeIter)(iter), ObjectG.getDObject!(TreePath)(path), wrapper.outer); 2232 } 2233 2234 extern(C) static void callBackRowCollapsedDestroy(OnRowCollapsedDelegateWrapper wrapper, GClosure* closure) 2235 { 2236 wrapper.remove(wrapper); 2237 } 2238 2239 protected class OnRowExpandedDelegateWrapper 2240 { 2241 static OnRowExpandedDelegateWrapper[] listeners; 2242 void delegate(TreeIter, TreePath, TreeView) dlg; 2243 gulong handlerId; 2244 2245 this(void delegate(TreeIter, TreePath, TreeView) dlg) 2246 { 2247 this.dlg = dlg; 2248 this.listeners ~= this; 2249 } 2250 2251 void remove(OnRowExpandedDelegateWrapper source) 2252 { 2253 foreach(index, wrapper; listeners) 2254 { 2255 if (wrapper.handlerId == source.handlerId) 2256 { 2257 listeners[index] = null; 2258 listeners = std.algorithm.remove(listeners, index); 2259 break; 2260 } 2261 } 2262 } 2263 } 2264 2265 /** 2266 * The given row has been expanded (child nodes are shown). 2267 * 2268 * Params: 2269 * iter = the tree iter of the expanded row 2270 * path = a tree path that points to the row 2271 */ 2272 gulong addOnRowExpanded(void delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2273 { 2274 auto wrapper = new OnRowExpandedDelegateWrapper(dlg); 2275 wrapper.handlerId = Signals.connectData( 2276 this, 2277 "row-expanded", 2278 cast(GCallback)&callBackRowExpanded, 2279 cast(void*)wrapper, 2280 cast(GClosureNotify)&callBackRowExpandedDestroy, 2281 connectFlags); 2282 return wrapper.handlerId; 2283 } 2284 2285 extern(C) static void callBackRowExpanded(GtkTreeView* treeviewStruct, GtkTreeIter* iter, GtkTreePath* path, OnRowExpandedDelegateWrapper wrapper) 2286 { 2287 wrapper.dlg(ObjectG.getDObject!(TreeIter)(iter), ObjectG.getDObject!(TreePath)(path), wrapper.outer); 2288 } 2289 2290 extern(C) static void callBackRowExpandedDestroy(OnRowExpandedDelegateWrapper wrapper, GClosure* closure) 2291 { 2292 wrapper.remove(wrapper); 2293 } 2294 2295 protected class OnSelectAllDelegateWrapper 2296 { 2297 static OnSelectAllDelegateWrapper[] listeners; 2298 bool delegate(TreeView) dlg; 2299 gulong handlerId; 2300 2301 this(bool delegate(TreeView) dlg) 2302 { 2303 this.dlg = dlg; 2304 this.listeners ~= this; 2305 } 2306 2307 void remove(OnSelectAllDelegateWrapper source) 2308 { 2309 foreach(index, wrapper; listeners) 2310 { 2311 if (wrapper.handlerId == source.handlerId) 2312 { 2313 listeners[index] = null; 2314 listeners = std.algorithm.remove(listeners, index); 2315 break; 2316 } 2317 } 2318 } 2319 } 2320 2321 /** */ 2322 gulong addOnSelectAll(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2323 { 2324 auto wrapper = new OnSelectAllDelegateWrapper(dlg); 2325 wrapper.handlerId = Signals.connectData( 2326 this, 2327 "select-all", 2328 cast(GCallback)&callBackSelectAll, 2329 cast(void*)wrapper, 2330 cast(GClosureNotify)&callBackSelectAllDestroy, 2331 connectFlags); 2332 return wrapper.handlerId; 2333 } 2334 2335 extern(C) static int callBackSelectAll(GtkTreeView* treeviewStruct, OnSelectAllDelegateWrapper wrapper) 2336 { 2337 return wrapper.dlg(wrapper.outer); 2338 } 2339 2340 extern(C) static void callBackSelectAllDestroy(OnSelectAllDelegateWrapper wrapper, GClosure* closure) 2341 { 2342 wrapper.remove(wrapper); 2343 } 2344 2345 protected class OnSelectCursorParentDelegateWrapper 2346 { 2347 static OnSelectCursorParentDelegateWrapper[] listeners; 2348 bool delegate(TreeView) dlg; 2349 gulong handlerId; 2350 2351 this(bool delegate(TreeView) dlg) 2352 { 2353 this.dlg = dlg; 2354 this.listeners ~= this; 2355 } 2356 2357 void remove(OnSelectCursorParentDelegateWrapper source) 2358 { 2359 foreach(index, wrapper; listeners) 2360 { 2361 if (wrapper.handlerId == source.handlerId) 2362 { 2363 listeners[index] = null; 2364 listeners = std.algorithm.remove(listeners, index); 2365 break; 2366 } 2367 } 2368 } 2369 } 2370 2371 /** */ 2372 gulong addOnSelectCursorParent(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2373 { 2374 auto wrapper = new OnSelectCursorParentDelegateWrapper(dlg); 2375 wrapper.handlerId = Signals.connectData( 2376 this, 2377 "select-cursor-parent", 2378 cast(GCallback)&callBackSelectCursorParent, 2379 cast(void*)wrapper, 2380 cast(GClosureNotify)&callBackSelectCursorParentDestroy, 2381 connectFlags); 2382 return wrapper.handlerId; 2383 } 2384 2385 extern(C) static int callBackSelectCursorParent(GtkTreeView* treeviewStruct, OnSelectCursorParentDelegateWrapper wrapper) 2386 { 2387 return wrapper.dlg(wrapper.outer); 2388 } 2389 2390 extern(C) static void callBackSelectCursorParentDestroy(OnSelectCursorParentDelegateWrapper wrapper, GClosure* closure) 2391 { 2392 wrapper.remove(wrapper); 2393 } 2394 2395 protected class OnSelectCursorRowDelegateWrapper 2396 { 2397 static OnSelectCursorRowDelegateWrapper[] listeners; 2398 bool delegate(bool, TreeView) dlg; 2399 gulong handlerId; 2400 2401 this(bool delegate(bool, TreeView) dlg) 2402 { 2403 this.dlg = dlg; 2404 this.listeners ~= this; 2405 } 2406 2407 void remove(OnSelectCursorRowDelegateWrapper source) 2408 { 2409 foreach(index, wrapper; listeners) 2410 { 2411 if (wrapper.handlerId == source.handlerId) 2412 { 2413 listeners[index] = null; 2414 listeners = std.algorithm.remove(listeners, index); 2415 break; 2416 } 2417 } 2418 } 2419 } 2420 2421 /** */ 2422 gulong addOnSelectCursorRow(bool delegate(bool, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2423 { 2424 auto wrapper = new OnSelectCursorRowDelegateWrapper(dlg); 2425 wrapper.handlerId = Signals.connectData( 2426 this, 2427 "select-cursor-row", 2428 cast(GCallback)&callBackSelectCursorRow, 2429 cast(void*)wrapper, 2430 cast(GClosureNotify)&callBackSelectCursorRowDestroy, 2431 connectFlags); 2432 return wrapper.handlerId; 2433 } 2434 2435 extern(C) static int callBackSelectCursorRow(GtkTreeView* treeviewStruct, bool object, OnSelectCursorRowDelegateWrapper wrapper) 2436 { 2437 return wrapper.dlg(object, wrapper.outer); 2438 } 2439 2440 extern(C) static void callBackSelectCursorRowDestroy(OnSelectCursorRowDelegateWrapper wrapper, GClosure* closure) 2441 { 2442 wrapper.remove(wrapper); 2443 } 2444 2445 protected class OnStartInteractiveSearchDelegateWrapper 2446 { 2447 static OnStartInteractiveSearchDelegateWrapper[] listeners; 2448 bool delegate(TreeView) dlg; 2449 gulong handlerId; 2450 2451 this(bool delegate(TreeView) dlg) 2452 { 2453 this.dlg = dlg; 2454 this.listeners ~= this; 2455 } 2456 2457 void remove(OnStartInteractiveSearchDelegateWrapper source) 2458 { 2459 foreach(index, wrapper; listeners) 2460 { 2461 if (wrapper.handlerId == source.handlerId) 2462 { 2463 listeners[index] = null; 2464 listeners = std.algorithm.remove(listeners, index); 2465 break; 2466 } 2467 } 2468 } 2469 } 2470 2471 /** */ 2472 gulong addOnStartInteractiveSearch(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2473 { 2474 auto wrapper = new OnStartInteractiveSearchDelegateWrapper(dlg); 2475 wrapper.handlerId = Signals.connectData( 2476 this, 2477 "start-interactive-search", 2478 cast(GCallback)&callBackStartInteractiveSearch, 2479 cast(void*)wrapper, 2480 cast(GClosureNotify)&callBackStartInteractiveSearchDestroy, 2481 connectFlags); 2482 return wrapper.handlerId; 2483 } 2484 2485 extern(C) static int callBackStartInteractiveSearch(GtkTreeView* treeviewStruct, OnStartInteractiveSearchDelegateWrapper wrapper) 2486 { 2487 return wrapper.dlg(wrapper.outer); 2488 } 2489 2490 extern(C) static void callBackStartInteractiveSearchDestroy(OnStartInteractiveSearchDelegateWrapper wrapper, GClosure* closure) 2491 { 2492 wrapper.remove(wrapper); 2493 } 2494 2495 protected class OnTestCollapseRowDelegateWrapper 2496 { 2497 static OnTestCollapseRowDelegateWrapper[] listeners; 2498 bool delegate(TreeIter, TreePath, TreeView) dlg; 2499 gulong handlerId; 2500 2501 this(bool delegate(TreeIter, TreePath, TreeView) dlg) 2502 { 2503 this.dlg = dlg; 2504 this.listeners ~= this; 2505 } 2506 2507 void remove(OnTestCollapseRowDelegateWrapper source) 2508 { 2509 foreach(index, wrapper; listeners) 2510 { 2511 if (wrapper.handlerId == source.handlerId) 2512 { 2513 listeners[index] = null; 2514 listeners = std.algorithm.remove(listeners, index); 2515 break; 2516 } 2517 } 2518 } 2519 } 2520 2521 /** 2522 * The given row is about to be collapsed (hide its children nodes). Use this 2523 * signal if you need to control the collapsibility of individual rows. 2524 * 2525 * Params: 2526 * iter = the tree iter of the row to collapse 2527 * path = a tree path that points to the row 2528 * 2529 * Returns: %FALSE to allow collapsing, %TRUE to reject 2530 */ 2531 gulong addOnTestCollapseRow(bool delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2532 { 2533 auto wrapper = new OnTestCollapseRowDelegateWrapper(dlg); 2534 wrapper.handlerId = Signals.connectData( 2535 this, 2536 "test-collapse-row", 2537 cast(GCallback)&callBackTestCollapseRow, 2538 cast(void*)wrapper, 2539 cast(GClosureNotify)&callBackTestCollapseRowDestroy, 2540 connectFlags); 2541 return wrapper.handlerId; 2542 } 2543 2544 extern(C) static int callBackTestCollapseRow(GtkTreeView* treeviewStruct, GtkTreeIter* iter, GtkTreePath* path, OnTestCollapseRowDelegateWrapper wrapper) 2545 { 2546 return wrapper.dlg(ObjectG.getDObject!(TreeIter)(iter), ObjectG.getDObject!(TreePath)(path), wrapper.outer); 2547 } 2548 2549 extern(C) static void callBackTestCollapseRowDestroy(OnTestCollapseRowDelegateWrapper wrapper, GClosure* closure) 2550 { 2551 wrapper.remove(wrapper); 2552 } 2553 2554 protected class OnTestExpandRowDelegateWrapper 2555 { 2556 static OnTestExpandRowDelegateWrapper[] listeners; 2557 bool delegate(TreeIter, TreePath, TreeView) dlg; 2558 gulong handlerId; 2559 2560 this(bool delegate(TreeIter, TreePath, TreeView) dlg) 2561 { 2562 this.dlg = dlg; 2563 this.listeners ~= this; 2564 } 2565 2566 void remove(OnTestExpandRowDelegateWrapper source) 2567 { 2568 foreach(index, wrapper; listeners) 2569 { 2570 if (wrapper.handlerId == source.handlerId) 2571 { 2572 listeners[index] = null; 2573 listeners = std.algorithm.remove(listeners, index); 2574 break; 2575 } 2576 } 2577 } 2578 } 2579 2580 /** 2581 * The given row is about to be expanded (show its children nodes). Use this 2582 * signal if you need to control the expandability of individual rows. 2583 * 2584 * Params: 2585 * iter = the tree iter of the row to expand 2586 * path = a tree path that points to the row 2587 * 2588 * Returns: %FALSE to allow expansion, %TRUE to reject 2589 */ 2590 gulong addOnTestExpandRow(bool delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2591 { 2592 auto wrapper = new OnTestExpandRowDelegateWrapper(dlg); 2593 wrapper.handlerId = Signals.connectData( 2594 this, 2595 "test-expand-row", 2596 cast(GCallback)&callBackTestExpandRow, 2597 cast(void*)wrapper, 2598 cast(GClosureNotify)&callBackTestExpandRowDestroy, 2599 connectFlags); 2600 return wrapper.handlerId; 2601 } 2602 2603 extern(C) static int callBackTestExpandRow(GtkTreeView* treeviewStruct, GtkTreeIter* iter, GtkTreePath* path, OnTestExpandRowDelegateWrapper wrapper) 2604 { 2605 return wrapper.dlg(ObjectG.getDObject!(TreeIter)(iter), ObjectG.getDObject!(TreePath)(path), wrapper.outer); 2606 } 2607 2608 extern(C) static void callBackTestExpandRowDestroy(OnTestExpandRowDelegateWrapper wrapper, GClosure* closure) 2609 { 2610 wrapper.remove(wrapper); 2611 } 2612 2613 protected class OnToggleCursorRowDelegateWrapper 2614 { 2615 static OnToggleCursorRowDelegateWrapper[] listeners; 2616 bool delegate(TreeView) dlg; 2617 gulong handlerId; 2618 2619 this(bool delegate(TreeView) dlg) 2620 { 2621 this.dlg = dlg; 2622 this.listeners ~= this; 2623 } 2624 2625 void remove(OnToggleCursorRowDelegateWrapper source) 2626 { 2627 foreach(index, wrapper; listeners) 2628 { 2629 if (wrapper.handlerId == source.handlerId) 2630 { 2631 listeners[index] = null; 2632 listeners = std.algorithm.remove(listeners, index); 2633 break; 2634 } 2635 } 2636 } 2637 } 2638 2639 /** */ 2640 gulong addOnToggleCursorRow(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2641 { 2642 auto wrapper = new OnToggleCursorRowDelegateWrapper(dlg); 2643 wrapper.handlerId = Signals.connectData( 2644 this, 2645 "toggle-cursor-row", 2646 cast(GCallback)&callBackToggleCursorRow, 2647 cast(void*)wrapper, 2648 cast(GClosureNotify)&callBackToggleCursorRowDestroy, 2649 connectFlags); 2650 return wrapper.handlerId; 2651 } 2652 2653 extern(C) static int callBackToggleCursorRow(GtkTreeView* treeviewStruct, OnToggleCursorRowDelegateWrapper wrapper) 2654 { 2655 return wrapper.dlg(wrapper.outer); 2656 } 2657 2658 extern(C) static void callBackToggleCursorRowDestroy(OnToggleCursorRowDelegateWrapper wrapper, GClosure* closure) 2659 { 2660 wrapper.remove(wrapper); 2661 } 2662 2663 protected class OnUnselectAllDelegateWrapper 2664 { 2665 static OnUnselectAllDelegateWrapper[] listeners; 2666 bool delegate(TreeView) dlg; 2667 gulong handlerId; 2668 2669 this(bool delegate(TreeView) dlg) 2670 { 2671 this.dlg = dlg; 2672 this.listeners ~= this; 2673 } 2674 2675 void remove(OnUnselectAllDelegateWrapper source) 2676 { 2677 foreach(index, wrapper; listeners) 2678 { 2679 if (wrapper.handlerId == source.handlerId) 2680 { 2681 listeners[index] = null; 2682 listeners = std.algorithm.remove(listeners, index); 2683 break; 2684 } 2685 } 2686 } 2687 } 2688 2689 /** */ 2690 gulong addOnUnselectAll(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2691 { 2692 auto wrapper = new OnUnselectAllDelegateWrapper(dlg); 2693 wrapper.handlerId = Signals.connectData( 2694 this, 2695 "unselect-all", 2696 cast(GCallback)&callBackUnselectAll, 2697 cast(void*)wrapper, 2698 cast(GClosureNotify)&callBackUnselectAllDestroy, 2699 connectFlags); 2700 return wrapper.handlerId; 2701 } 2702 2703 extern(C) static int callBackUnselectAll(GtkTreeView* treeviewStruct, OnUnselectAllDelegateWrapper wrapper) 2704 { 2705 return wrapper.dlg(wrapper.outer); 2706 } 2707 2708 extern(C) static void callBackUnselectAllDestroy(OnUnselectAllDelegateWrapper wrapper, GClosure* closure) 2709 { 2710 wrapper.remove(wrapper); 2711 } 2712 }