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