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