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