1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.TreeView; 26 27 private import cairo.Surface; 28 private import gdk.Window; 29 private import glib.ConstructionException; 30 private import glib.ListG; 31 private import glib.Str; 32 private import gobject.ObjectG; 33 private import gobject.Signals; 34 private import gtk.CellRenderer; 35 private import gtk.Container; 36 private import gtk.Entry; 37 private import gtk.ScrollableIF; 38 private import gtk.ScrollableT; 39 private import gtk.TargetEntry; 40 private import gtk.Tooltip; 41 private import gtk.TreeIter; 42 private import gtk.TreeModel; 43 private import gtk.TreeModelIF; 44 private import gtk.TreePath; 45 private import gtk.TreeSelection; 46 private import gtk.TreeViewColumn; 47 private import gtk.Widget; 48 public import gtkc.gdktypes; 49 private import gtkc.gtk; 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() 136 { 137 return gtkTreeView; 138 } 139 140 /** the main Gtk struct as a void* */ 141 protected override void* getStruct() 142 { 143 return cast(void*)gtkTreeView; 144 } 145 146 protected override void setStruct(GObject* obj) 147 { 148 gtkTreeView = cast(GtkTreeView*)obj; 149 super.setStruct(obj); 150 } 151 152 /** 153 * Sets our main struct and passes it to the parent class. 154 */ 155 public this (GtkTreeView* gtkTreeView, bool ownedRef = false) 156 { 157 this.gtkTreeView = gtkTreeView; 158 super(cast(GtkContainer*)gtkTreeView, ownedRef); 159 } 160 161 // add the Scrollable capabilities 162 mixin ScrollableT!(GtkTreeView); 163 164 /** 165 * Expands the row of the iter. 166 * Params: 167 * iter = 168 * openAll = 169 * Returns = 170 */ 171 int expandRow(TreeIter iter, TreeModelIF model, bool openAll) 172 { 173 return expandRow(model.getPath(iter), openAll); 174 } 175 176 /** 177 * gets the first selected iter or null if no rows are selected 178 */ 179 TreeIter getSelectedIter() 180 { 181 TreeIter iter = null; 182 TreeSelection selection = getSelection(); 183 TreeModelIF model = getModel(); 184 TreePath[] paths = selection.getSelectedRows(model); 185 if ( paths.length > 0 ) 186 { 187 iter = new TreeIter(); 188 model.getIter(iter,paths[0]); 189 } 190 return iter; 191 } 192 193 /** */ 194 TreeIter[] getSelectedIters() 195 { 196 TreeIter[] iters; 197 198 TreeIter iter = new TreeIter(); 199 TreeSelection selection = getSelection(); 200 TreeModelIF model = getModel(); 201 TreePath[] paths = selection.getSelectedRows(model); 202 foreach ( TreePath p; selection.getSelectedRows(model) ) 203 { 204 if ( model.getIter(iter,p) ) 205 { 206 iters ~= iter; 207 iter = new TreeIter(); 208 } 209 } 210 211 return iters; 212 } 213 214 /** 215 * Inserts a column and sets it's attributes 216 * Params: 217 * position = 218 * title = 219 * renderer = 220 * editable = 221 * Returns: number of columns including the new one 222 */ 223 int insertEditableColumn(int position, string title, CellRenderer renderer, bool editable) 224 { 225 // OK, this is a trick because of my ignorance on how to pass variable argument lists 226 if ( position < 0 ) 227 { 228 position = getColumns().length(); 229 } 230 int tot = gtk_tree_view_insert_column_with_attributes( 231 gtkTreeView, 232 position, 233 Str.toStringz(title), 234 renderer.getCellRendererStruct(), 235 Str.toStringz("text"),position, 236 Str.toStringz("editable"),2,0); 237 return tot; 238 } 239 240 /** 241 */ 242 243 /** */ 244 public static GType getType() 245 { 246 return gtk_tree_view_get_type(); 247 } 248 249 /** 250 * Creates a new #GtkTreeView widget. 251 * 252 * Return: A newly created #GtkTreeView widget. 253 * 254 * Throws: ConstructionException GTK+ fails to create the object. 255 */ 256 public this() 257 { 258 auto p = gtk_tree_view_new(); 259 260 if(p is null) 261 { 262 throw new ConstructionException("null returned by new"); 263 } 264 265 this(cast(GtkTreeView*) p); 266 } 267 268 /** 269 * Creates a new #GtkTreeView widget with the model initialized to @model. 270 * 271 * Params: 272 * model = the model. 273 * 274 * Return: A newly created #GtkTreeView widget. 275 * 276 * Throws: ConstructionException GTK+ fails to create the object. 277 */ 278 public this(TreeModelIF model) 279 { 280 auto p = gtk_tree_view_new_with_model((model is null) ? null : model.getTreeModelStruct()); 281 282 if(p is null) 283 { 284 throw new ConstructionException("null returned by new_with_model"); 285 } 286 287 this(cast(GtkTreeView*) p); 288 } 289 290 /** 291 * Appends @column to the list of columns. If @tree_view has “fixed_height” 292 * mode enabled, then @column must have its “sizing” property set to be 293 * GTK_TREE_VIEW_COLUMN_FIXED. 294 * 295 * Params: 296 * column = The #GtkTreeViewColumn to add. 297 * 298 * Return: The number of columns in @tree_view after appending. 299 */ 300 public int appendColumn(TreeViewColumn column) 301 { 302 return gtk_tree_view_append_column(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct()); 303 } 304 305 /** 306 * Recursively collapses all visible, expanded nodes in @tree_view. 307 */ 308 public void collapseAll() 309 { 310 gtk_tree_view_collapse_all(gtkTreeView); 311 } 312 313 /** 314 * Collapses a row (hides its child rows, if they exist). 315 * 316 * Params: 317 * path = path to a row in the @tree_view 318 * 319 * Return: %TRUE if the row was collapsed. 320 */ 321 public bool collapseRow(TreePath path) 322 { 323 return gtk_tree_view_collapse_row(gtkTreeView, (path is null) ? null : path.getTreePathStruct()) != 0; 324 } 325 326 /** 327 * Resizes all columns to their optimal width. Only works after the 328 * treeview has been realized. 329 */ 330 public void columnsAutosize() 331 { 332 gtk_tree_view_columns_autosize(gtkTreeView); 333 } 334 335 /** 336 * Converts bin_window coordinates to coordinates for the 337 * tree (the full scrollable area of the tree). 338 * 339 * Params: 340 * bx = X coordinate relative to bin_window 341 * by = Y coordinate relative to bin_window 342 * tx = return location for tree X coordinate 343 * ty = return location for tree Y coordinate 344 * 345 * Since: 2.12 346 */ 347 public void convertBinWindowToTreeCoords(int bx, int by, out int tx, out int ty) 348 { 349 gtk_tree_view_convert_bin_window_to_tree_coords(gtkTreeView, bx, by, &tx, &ty); 350 } 351 352 /** 353 * Converts bin_window coordinates (see gtk_tree_view_get_bin_window()) 354 * to widget relative coordinates. 355 * 356 * Params: 357 * bx = bin_window X coordinate 358 * by = bin_window Y coordinate 359 * wx = return location for widget X coordinate 360 * wy = return location for widget Y coordinate 361 * 362 * Since: 2.12 363 */ 364 public void convertBinWindowToWidgetCoords(int bx, int by, out int wx, out int wy) 365 { 366 gtk_tree_view_convert_bin_window_to_widget_coords(gtkTreeView, bx, by, &wx, &wy); 367 } 368 369 /** 370 * Converts tree coordinates (coordinates in full scrollable area of the tree) 371 * to bin_window coordinates. 372 * 373 * Params: 374 * tx = tree X coordinate 375 * ty = tree Y coordinate 376 * bx = return location for X coordinate relative to bin_window 377 * by = return location for Y coordinate relative to bin_window 378 * 379 * Since: 2.12 380 */ 381 public void convertTreeToBinWindowCoords(int tx, int ty, out int bx, out int by) 382 { 383 gtk_tree_view_convert_tree_to_bin_window_coords(gtkTreeView, tx, ty, &bx, &by); 384 } 385 386 /** 387 * Converts tree coordinates (coordinates in full scrollable area of the tree) 388 * to widget coordinates. 389 * 390 * Params: 391 * tx = X coordinate relative to the tree 392 * ty = Y coordinate relative to the tree 393 * wx = return location for widget X coordinate 394 * wy = return location for widget Y coordinate 395 * 396 * Since: 2.12 397 */ 398 public void convertTreeToWidgetCoords(int tx, int ty, out int wx, out int wy) 399 { 400 gtk_tree_view_convert_tree_to_widget_coords(gtkTreeView, tx, ty, &wx, &wy); 401 } 402 403 /** 404 * Converts widget coordinates to coordinates for the bin_window 405 * (see gtk_tree_view_get_bin_window()). 406 * 407 * Params: 408 * wx = X coordinate relative to the widget 409 * wy = Y coordinate relative to the widget 410 * bx = return location for bin_window X coordinate 411 * by = return location for bin_window Y coordinate 412 * 413 * Since: 2.12 414 */ 415 public void convertWidgetToBinWindowCoords(int wx, int wy, out int bx, out int by) 416 { 417 gtk_tree_view_convert_widget_to_bin_window_coords(gtkTreeView, wx, wy, &bx, &by); 418 } 419 420 /** 421 * Converts widget coordinates to coordinates for the 422 * tree (the full scrollable area of the tree). 423 * 424 * Params: 425 * wx = X coordinate relative to the widget 426 * wy = Y coordinate relative to the widget 427 * tx = return location for tree X coordinate 428 * ty = return location for tree Y coordinate 429 * 430 * Since: 2.12 431 */ 432 public void convertWidgetToTreeCoords(int wx, int wy, out int tx, out int ty) 433 { 434 gtk_tree_view_convert_widget_to_tree_coords(gtkTreeView, wx, wy, &tx, &ty); 435 } 436 437 /** 438 * Creates a #cairo_surface_t representation of the row at @path. 439 * This image is used for a drag icon. 440 * 441 * Params: 442 * path = a #GtkTreePath in @tree_view 443 * 444 * Return: a newly-allocated surface of the drag icon. 445 */ 446 public Surface createRowDragIcon(TreePath path) 447 { 448 auto p = gtk_tree_view_create_row_drag_icon(gtkTreeView, (path is null) ? null : path.getTreePathStruct()); 449 450 if(p is null) 451 { 452 return null; 453 } 454 455 return new Surface(cast(cairo_surface_t*) p); 456 } 457 458 /** 459 * Turns @tree_view into a drop destination for automatic DND. Calling 460 * this method sets #GtkTreeView:reorderable to %FALSE. 461 * 462 * Params: 463 * targets = the table of targets that 464 * the drag will support 465 * nTargets = the number of items in @targets 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 * nTargets = the number of items in @targets 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 * Return: %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 * Return: %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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: %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 * Return: 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 * Return: %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 * Return: 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 * Return: %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 * Return: 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 * Return: %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 * Return: %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 * Return: 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 * Return: 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!(TreeModel, TreeModelIF)(cast(GtkTreeModel*) p); 864 } 865 866 /** 867 * Queries the number of columns in the given @tree_view. 868 * 869 * Return: 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 * Return: %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 * Return: %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 * Return: 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 * Return: %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 * Return: %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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: %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 * Return: 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 * Return: 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 = gMalloc!GtkTreeIter(); 1099 1100 auto p = gtk_tree_view_get_tooltip_context(gtkTreeView, &x, &y, keyboardTip, &outmodel, &outpath, outiter) != 0; 1101 1102 model = ObjectG.getDObject!(TreeModel, 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 * Return: %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 * Return: 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 * Return: 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 * Return: %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 * Return: %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 * Return: 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 * Return: %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 ConnectFlags flags; 1894 this(void delegate(TreeView) dlg, gulong handlerId, ConnectFlags flags) 1895 { 1896 this.dlg = dlg; 1897 this.handlerId = handlerId; 1898 this.flags = flags; 1899 } 1900 } 1901 protected OnColumnsChangedDelegateWrapper[] onColumnsChangedListeners; 1902 1903 /** 1904 * The number of columns of the treeview has changed. 1905 */ 1906 gulong addOnColumnsChanged(void delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1907 { 1908 onColumnsChangedListeners ~= new OnColumnsChangedDelegateWrapper(dlg, 0, connectFlags); 1909 onColumnsChangedListeners[onColumnsChangedListeners.length - 1].handlerId = Signals.connectData( 1910 this, 1911 "columns-changed", 1912 cast(GCallback)&callBackColumnsChanged, 1913 cast(void*)onColumnsChangedListeners[onColumnsChangedListeners.length - 1], 1914 cast(GClosureNotify)&callBackColumnsChangedDestroy, 1915 connectFlags); 1916 return onColumnsChangedListeners[onColumnsChangedListeners.length - 1].handlerId; 1917 } 1918 1919 extern(C) static void callBackColumnsChanged(GtkTreeView* treeviewStruct,OnColumnsChangedDelegateWrapper wrapper) 1920 { 1921 wrapper.dlg(wrapper.outer); 1922 } 1923 1924 extern(C) static void callBackColumnsChangedDestroy(OnColumnsChangedDelegateWrapper wrapper, GClosure* closure) 1925 { 1926 wrapper.outer.internalRemoveOnColumnsChanged(wrapper); 1927 } 1928 1929 protected void internalRemoveOnColumnsChanged(OnColumnsChangedDelegateWrapper source) 1930 { 1931 foreach(index, wrapper; onColumnsChangedListeners) 1932 { 1933 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 1934 { 1935 onColumnsChangedListeners[index] = null; 1936 onColumnsChangedListeners = std.algorithm.remove(onColumnsChangedListeners, index); 1937 break; 1938 } 1939 } 1940 } 1941 1942 1943 protected class OnCursorChangedDelegateWrapper 1944 { 1945 void delegate(TreeView) dlg; 1946 gulong handlerId; 1947 ConnectFlags flags; 1948 this(void delegate(TreeView) dlg, gulong handlerId, ConnectFlags flags) 1949 { 1950 this.dlg = dlg; 1951 this.handlerId = handlerId; 1952 this.flags = flags; 1953 } 1954 } 1955 protected OnCursorChangedDelegateWrapper[] onCursorChangedListeners; 1956 1957 /** 1958 * The position of the cursor (focused cell) has changed. 1959 */ 1960 gulong addOnCursorChanged(void delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1961 { 1962 onCursorChangedListeners ~= new OnCursorChangedDelegateWrapper(dlg, 0, connectFlags); 1963 onCursorChangedListeners[onCursorChangedListeners.length - 1].handlerId = Signals.connectData( 1964 this, 1965 "cursor-changed", 1966 cast(GCallback)&callBackCursorChanged, 1967 cast(void*)onCursorChangedListeners[onCursorChangedListeners.length - 1], 1968 cast(GClosureNotify)&callBackCursorChangedDestroy, 1969 connectFlags); 1970 return onCursorChangedListeners[onCursorChangedListeners.length - 1].handlerId; 1971 } 1972 1973 extern(C) static void callBackCursorChanged(GtkTreeView* treeviewStruct,OnCursorChangedDelegateWrapper wrapper) 1974 { 1975 wrapper.dlg(wrapper.outer); 1976 } 1977 1978 extern(C) static void callBackCursorChangedDestroy(OnCursorChangedDelegateWrapper wrapper, GClosure* closure) 1979 { 1980 wrapper.outer.internalRemoveOnCursorChanged(wrapper); 1981 } 1982 1983 protected void internalRemoveOnCursorChanged(OnCursorChangedDelegateWrapper source) 1984 { 1985 foreach(index, wrapper; onCursorChangedListeners) 1986 { 1987 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 1988 { 1989 onCursorChangedListeners[index] = null; 1990 onCursorChangedListeners = std.algorithm.remove(onCursorChangedListeners, index); 1991 break; 1992 } 1993 } 1994 } 1995 1996 1997 protected class OnExpandCollapseCursorRowDelegateWrapper 1998 { 1999 bool delegate(bool, bool, bool, TreeView) dlg; 2000 gulong handlerId; 2001 ConnectFlags flags; 2002 this(bool delegate(bool, bool, bool, TreeView) dlg, gulong handlerId, ConnectFlags flags) 2003 { 2004 this.dlg = dlg; 2005 this.handlerId = handlerId; 2006 this.flags = flags; 2007 } 2008 } 2009 protected OnExpandCollapseCursorRowDelegateWrapper[] onExpandCollapseCursorRowListeners; 2010 2011 /** */ 2012 gulong addOnExpandCollapseCursorRow(bool delegate(bool, bool, bool, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2013 { 2014 onExpandCollapseCursorRowListeners ~= new OnExpandCollapseCursorRowDelegateWrapper(dlg, 0, connectFlags); 2015 onExpandCollapseCursorRowListeners[onExpandCollapseCursorRowListeners.length - 1].handlerId = Signals.connectData( 2016 this, 2017 "expand-collapse-cursor-row", 2018 cast(GCallback)&callBackExpandCollapseCursorRow, 2019 cast(void*)onExpandCollapseCursorRowListeners[onExpandCollapseCursorRowListeners.length - 1], 2020 cast(GClosureNotify)&callBackExpandCollapseCursorRowDestroy, 2021 connectFlags); 2022 return onExpandCollapseCursorRowListeners[onExpandCollapseCursorRowListeners.length - 1].handlerId; 2023 } 2024 2025 extern(C) static int callBackExpandCollapseCursorRow(GtkTreeView* treeviewStruct, bool object, bool p0, bool p1,OnExpandCollapseCursorRowDelegateWrapper wrapper) 2026 { 2027 return wrapper.dlg(object, p0, p1, wrapper.outer); 2028 } 2029 2030 extern(C) static void callBackExpandCollapseCursorRowDestroy(OnExpandCollapseCursorRowDelegateWrapper wrapper, GClosure* closure) 2031 { 2032 wrapper.outer.internalRemoveOnExpandCollapseCursorRow(wrapper); 2033 } 2034 2035 protected void internalRemoveOnExpandCollapseCursorRow(OnExpandCollapseCursorRowDelegateWrapper source) 2036 { 2037 foreach(index, wrapper; onExpandCollapseCursorRowListeners) 2038 { 2039 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2040 { 2041 onExpandCollapseCursorRowListeners[index] = null; 2042 onExpandCollapseCursorRowListeners = std.algorithm.remove(onExpandCollapseCursorRowListeners, index); 2043 break; 2044 } 2045 } 2046 } 2047 2048 2049 protected class OnMoveCursorDelegateWrapper 2050 { 2051 bool delegate(GtkMovementStep, int, TreeView) dlg; 2052 gulong handlerId; 2053 ConnectFlags flags; 2054 this(bool delegate(GtkMovementStep, int, TreeView) dlg, gulong handlerId, ConnectFlags flags) 2055 { 2056 this.dlg = dlg; 2057 this.handlerId = handlerId; 2058 this.flags = flags; 2059 } 2060 } 2061 protected OnMoveCursorDelegateWrapper[] onMoveCursorListeners; 2062 2063 /** 2064 * The #GtkTreeView::move-cursor signal is a [keybinding 2065 * signal][GtkBindingSignal] which gets emitted when the user 2066 * presses one of the cursor keys. 2067 * 2068 * Applications should not connect to it, but may emit it with 2069 * g_signal_emit_by_name() if they need to control the cursor 2070 * programmatically. In contrast to gtk_tree_view_set_cursor() and 2071 * gtk_tree_view_set_cursor_on_cell() when moving horizontally 2072 * #GtkTreeView::move-cursor does not reset the current selection. 2073 * 2074 * Params: 2075 * step = the granularity of the move, as a 2076 * #GtkMovementStep. %GTK_MOVEMENT_LOGICAL_POSITIONS, 2077 * %GTK_MOVEMENT_VISUAL_POSITIONS, %GTK_MOVEMENT_DISPLAY_LINES, 2078 * %GTK_MOVEMENT_PAGES and %GTK_MOVEMENT_BUFFER_ENDS are 2079 * supported. %GTK_MOVEMENT_LOGICAL_POSITIONS and 2080 * %GTK_MOVEMENT_VISUAL_POSITIONS are treated identically. 2081 * direction = the direction to move: +1 to move forwards; 2082 * -1 to move backwards. The resulting movement is 2083 * undefined for all other values. 2084 * 2085 * Return: %TRUE if @step is supported, %FALSE otherwise. 2086 */ 2087 gulong addOnMoveCursor(bool delegate(GtkMovementStep, int, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2088 { 2089 onMoveCursorListeners ~= new OnMoveCursorDelegateWrapper(dlg, 0, connectFlags); 2090 onMoveCursorListeners[onMoveCursorListeners.length - 1].handlerId = Signals.connectData( 2091 this, 2092 "move-cursor", 2093 cast(GCallback)&callBackMoveCursor, 2094 cast(void*)onMoveCursorListeners[onMoveCursorListeners.length - 1], 2095 cast(GClosureNotify)&callBackMoveCursorDestroy, 2096 connectFlags); 2097 return onMoveCursorListeners[onMoveCursorListeners.length - 1].handlerId; 2098 } 2099 2100 extern(C) static int callBackMoveCursor(GtkTreeView* treeviewStruct, GtkMovementStep step, int direction,OnMoveCursorDelegateWrapper wrapper) 2101 { 2102 return wrapper.dlg(step, direction, wrapper.outer); 2103 } 2104 2105 extern(C) static void callBackMoveCursorDestroy(OnMoveCursorDelegateWrapper wrapper, GClosure* closure) 2106 { 2107 wrapper.outer.internalRemoveOnMoveCursor(wrapper); 2108 } 2109 2110 protected void internalRemoveOnMoveCursor(OnMoveCursorDelegateWrapper source) 2111 { 2112 foreach(index, wrapper; onMoveCursorListeners) 2113 { 2114 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2115 { 2116 onMoveCursorListeners[index] = null; 2117 onMoveCursorListeners = std.algorithm.remove(onMoveCursorListeners, index); 2118 break; 2119 } 2120 } 2121 } 2122 2123 2124 protected class OnRowActivatedDelegateWrapper 2125 { 2126 void delegate(TreePath, TreeViewColumn, TreeView) dlg; 2127 gulong handlerId; 2128 ConnectFlags flags; 2129 this(void delegate(TreePath, TreeViewColumn, TreeView) dlg, gulong handlerId, ConnectFlags flags) 2130 { 2131 this.dlg = dlg; 2132 this.handlerId = handlerId; 2133 this.flags = flags; 2134 } 2135 } 2136 protected OnRowActivatedDelegateWrapper[] onRowActivatedListeners; 2137 2138 /** 2139 * The "row-activated" signal is emitted when the method 2140 * gtk_tree_view_row_activated() is called, when the user double 2141 * clicks a treeview row with the "activate-on-single-click" 2142 * property set to %FALSE, or when the user single clicks a row when 2143 * the "activate-on-single-click" property set to %TRUE. It is also 2144 * emitted when a non-editable row is selected and one of the keys: 2145 * Space, Shift+Space, Return or Enter is pressed. 2146 * 2147 * For selection handling refer to the 2148 * [tree widget conceptual overview][TreeWidget] 2149 * as well as #GtkTreeSelection. 2150 * 2151 * Params: 2152 * path = the #GtkTreePath for the activated row 2153 * column = the #GtkTreeViewColumn in which the activation occurred 2154 */ 2155 gulong addOnRowActivated(void delegate(TreePath, TreeViewColumn, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2156 { 2157 onRowActivatedListeners ~= new OnRowActivatedDelegateWrapper(dlg, 0, connectFlags); 2158 onRowActivatedListeners[onRowActivatedListeners.length - 1].handlerId = Signals.connectData( 2159 this, 2160 "row-activated", 2161 cast(GCallback)&callBackRowActivated, 2162 cast(void*)onRowActivatedListeners[onRowActivatedListeners.length - 1], 2163 cast(GClosureNotify)&callBackRowActivatedDestroy, 2164 connectFlags); 2165 return onRowActivatedListeners[onRowActivatedListeners.length - 1].handlerId; 2166 } 2167 2168 extern(C) static void callBackRowActivated(GtkTreeView* treeviewStruct, GtkTreePath* path, GtkTreeViewColumn* column,OnRowActivatedDelegateWrapper wrapper) 2169 { 2170 wrapper.dlg(ObjectG.getDObject!(TreePath)(path), ObjectG.getDObject!(TreeViewColumn)(column), wrapper.outer); 2171 } 2172 2173 extern(C) static void callBackRowActivatedDestroy(OnRowActivatedDelegateWrapper wrapper, GClosure* closure) 2174 { 2175 wrapper.outer.internalRemoveOnRowActivated(wrapper); 2176 } 2177 2178 protected void internalRemoveOnRowActivated(OnRowActivatedDelegateWrapper source) 2179 { 2180 foreach(index, wrapper; onRowActivatedListeners) 2181 { 2182 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2183 { 2184 onRowActivatedListeners[index] = null; 2185 onRowActivatedListeners = std.algorithm.remove(onRowActivatedListeners, index); 2186 break; 2187 } 2188 } 2189 } 2190 2191 2192 protected class OnRowCollapsedDelegateWrapper 2193 { 2194 void delegate(TreeIter, TreePath, TreeView) dlg; 2195 gulong handlerId; 2196 ConnectFlags flags; 2197 this(void delegate(TreeIter, TreePath, TreeView) dlg, gulong handlerId, ConnectFlags flags) 2198 { 2199 this.dlg = dlg; 2200 this.handlerId = handlerId; 2201 this.flags = flags; 2202 } 2203 } 2204 protected OnRowCollapsedDelegateWrapper[] onRowCollapsedListeners; 2205 2206 /** 2207 * The given row has been collapsed (child nodes are hidden). 2208 * 2209 * Params: 2210 * iter = the tree iter of the collapsed row 2211 * path = a tree path that points to the row 2212 */ 2213 gulong addOnRowCollapsed(void delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2214 { 2215 onRowCollapsedListeners ~= new OnRowCollapsedDelegateWrapper(dlg, 0, connectFlags); 2216 onRowCollapsedListeners[onRowCollapsedListeners.length - 1].handlerId = Signals.connectData( 2217 this, 2218 "row-collapsed", 2219 cast(GCallback)&callBackRowCollapsed, 2220 cast(void*)onRowCollapsedListeners[onRowCollapsedListeners.length - 1], 2221 cast(GClosureNotify)&callBackRowCollapsedDestroy, 2222 connectFlags); 2223 return onRowCollapsedListeners[onRowCollapsedListeners.length - 1].handlerId; 2224 } 2225 2226 extern(C) static void callBackRowCollapsed(GtkTreeView* treeviewStruct, GtkTreeIter* iter, GtkTreePath* path,OnRowCollapsedDelegateWrapper wrapper) 2227 { 2228 wrapper.dlg(ObjectG.getDObject!(TreeIter)(iter), ObjectG.getDObject!(TreePath)(path), wrapper.outer); 2229 } 2230 2231 extern(C) static void callBackRowCollapsedDestroy(OnRowCollapsedDelegateWrapper wrapper, GClosure* closure) 2232 { 2233 wrapper.outer.internalRemoveOnRowCollapsed(wrapper); 2234 } 2235 2236 protected void internalRemoveOnRowCollapsed(OnRowCollapsedDelegateWrapper source) 2237 { 2238 foreach(index, wrapper; onRowCollapsedListeners) 2239 { 2240 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2241 { 2242 onRowCollapsedListeners[index] = null; 2243 onRowCollapsedListeners = std.algorithm.remove(onRowCollapsedListeners, index); 2244 break; 2245 } 2246 } 2247 } 2248 2249 2250 protected class OnRowExpandedDelegateWrapper 2251 { 2252 void delegate(TreeIter, TreePath, TreeView) dlg; 2253 gulong handlerId; 2254 ConnectFlags flags; 2255 this(void delegate(TreeIter, TreePath, TreeView) dlg, gulong handlerId, ConnectFlags flags) 2256 { 2257 this.dlg = dlg; 2258 this.handlerId = handlerId; 2259 this.flags = flags; 2260 } 2261 } 2262 protected 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 onRowExpandedListeners ~= new OnRowExpandedDelegateWrapper(dlg, 0, connectFlags); 2274 onRowExpandedListeners[onRowExpandedListeners.length - 1].handlerId = Signals.connectData( 2275 this, 2276 "row-expanded", 2277 cast(GCallback)&callBackRowExpanded, 2278 cast(void*)onRowExpandedListeners[onRowExpandedListeners.length - 1], 2279 cast(GClosureNotify)&callBackRowExpandedDestroy, 2280 connectFlags); 2281 return onRowExpandedListeners[onRowExpandedListeners.length - 1].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.outer.internalRemoveOnRowExpanded(wrapper); 2292 } 2293 2294 protected void internalRemoveOnRowExpanded(OnRowExpandedDelegateWrapper source) 2295 { 2296 foreach(index, wrapper; onRowExpandedListeners) 2297 { 2298 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2299 { 2300 onRowExpandedListeners[index] = null; 2301 onRowExpandedListeners = std.algorithm.remove(onRowExpandedListeners, index); 2302 break; 2303 } 2304 } 2305 } 2306 2307 2308 protected class OnSelectAllDelegateWrapper 2309 { 2310 bool delegate(TreeView) dlg; 2311 gulong handlerId; 2312 ConnectFlags flags; 2313 this(bool delegate(TreeView) dlg, gulong handlerId, ConnectFlags flags) 2314 { 2315 this.dlg = dlg; 2316 this.handlerId = handlerId; 2317 this.flags = flags; 2318 } 2319 } 2320 protected OnSelectAllDelegateWrapper[] onSelectAllListeners; 2321 2322 /** */ 2323 gulong addOnSelectAll(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2324 { 2325 onSelectAllListeners ~= new OnSelectAllDelegateWrapper(dlg, 0, connectFlags); 2326 onSelectAllListeners[onSelectAllListeners.length - 1].handlerId = Signals.connectData( 2327 this, 2328 "select-all", 2329 cast(GCallback)&callBackSelectAll, 2330 cast(void*)onSelectAllListeners[onSelectAllListeners.length - 1], 2331 cast(GClosureNotify)&callBackSelectAllDestroy, 2332 connectFlags); 2333 return onSelectAllListeners[onSelectAllListeners.length - 1].handlerId; 2334 } 2335 2336 extern(C) static int callBackSelectAll(GtkTreeView* treeviewStruct,OnSelectAllDelegateWrapper wrapper) 2337 { 2338 return wrapper.dlg(wrapper.outer); 2339 } 2340 2341 extern(C) static void callBackSelectAllDestroy(OnSelectAllDelegateWrapper wrapper, GClosure* closure) 2342 { 2343 wrapper.outer.internalRemoveOnSelectAll(wrapper); 2344 } 2345 2346 protected void internalRemoveOnSelectAll(OnSelectAllDelegateWrapper source) 2347 { 2348 foreach(index, wrapper; onSelectAllListeners) 2349 { 2350 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2351 { 2352 onSelectAllListeners[index] = null; 2353 onSelectAllListeners = std.algorithm.remove(onSelectAllListeners, index); 2354 break; 2355 } 2356 } 2357 } 2358 2359 2360 protected class OnSelectCursorParentDelegateWrapper 2361 { 2362 bool delegate(TreeView) dlg; 2363 gulong handlerId; 2364 ConnectFlags flags; 2365 this(bool delegate(TreeView) dlg, gulong handlerId, ConnectFlags flags) 2366 { 2367 this.dlg = dlg; 2368 this.handlerId = handlerId; 2369 this.flags = flags; 2370 } 2371 } 2372 protected OnSelectCursorParentDelegateWrapper[] onSelectCursorParentListeners; 2373 2374 /** */ 2375 gulong addOnSelectCursorParent(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2376 { 2377 onSelectCursorParentListeners ~= new OnSelectCursorParentDelegateWrapper(dlg, 0, connectFlags); 2378 onSelectCursorParentListeners[onSelectCursorParentListeners.length - 1].handlerId = Signals.connectData( 2379 this, 2380 "select-cursor-parent", 2381 cast(GCallback)&callBackSelectCursorParent, 2382 cast(void*)onSelectCursorParentListeners[onSelectCursorParentListeners.length - 1], 2383 cast(GClosureNotify)&callBackSelectCursorParentDestroy, 2384 connectFlags); 2385 return onSelectCursorParentListeners[onSelectCursorParentListeners.length - 1].handlerId; 2386 } 2387 2388 extern(C) static int callBackSelectCursorParent(GtkTreeView* treeviewStruct,OnSelectCursorParentDelegateWrapper wrapper) 2389 { 2390 return wrapper.dlg(wrapper.outer); 2391 } 2392 2393 extern(C) static void callBackSelectCursorParentDestroy(OnSelectCursorParentDelegateWrapper wrapper, GClosure* closure) 2394 { 2395 wrapper.outer.internalRemoveOnSelectCursorParent(wrapper); 2396 } 2397 2398 protected void internalRemoveOnSelectCursorParent(OnSelectCursorParentDelegateWrapper source) 2399 { 2400 foreach(index, wrapper; onSelectCursorParentListeners) 2401 { 2402 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2403 { 2404 onSelectCursorParentListeners[index] = null; 2405 onSelectCursorParentListeners = std.algorithm.remove(onSelectCursorParentListeners, index); 2406 break; 2407 } 2408 } 2409 } 2410 2411 2412 protected class OnSelectCursorRowDelegateWrapper 2413 { 2414 bool delegate(bool, TreeView) dlg; 2415 gulong handlerId; 2416 ConnectFlags flags; 2417 this(bool delegate(bool, TreeView) dlg, gulong handlerId, ConnectFlags flags) 2418 { 2419 this.dlg = dlg; 2420 this.handlerId = handlerId; 2421 this.flags = flags; 2422 } 2423 } 2424 protected OnSelectCursorRowDelegateWrapper[] onSelectCursorRowListeners; 2425 2426 /** */ 2427 gulong addOnSelectCursorRow(bool delegate(bool, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2428 { 2429 onSelectCursorRowListeners ~= new OnSelectCursorRowDelegateWrapper(dlg, 0, connectFlags); 2430 onSelectCursorRowListeners[onSelectCursorRowListeners.length - 1].handlerId = Signals.connectData( 2431 this, 2432 "select-cursor-row", 2433 cast(GCallback)&callBackSelectCursorRow, 2434 cast(void*)onSelectCursorRowListeners[onSelectCursorRowListeners.length - 1], 2435 cast(GClosureNotify)&callBackSelectCursorRowDestroy, 2436 connectFlags); 2437 return onSelectCursorRowListeners[onSelectCursorRowListeners.length - 1].handlerId; 2438 } 2439 2440 extern(C) static int callBackSelectCursorRow(GtkTreeView* treeviewStruct, bool object,OnSelectCursorRowDelegateWrapper wrapper) 2441 { 2442 return wrapper.dlg(object, wrapper.outer); 2443 } 2444 2445 extern(C) static void callBackSelectCursorRowDestroy(OnSelectCursorRowDelegateWrapper wrapper, GClosure* closure) 2446 { 2447 wrapper.outer.internalRemoveOnSelectCursorRow(wrapper); 2448 } 2449 2450 protected void internalRemoveOnSelectCursorRow(OnSelectCursorRowDelegateWrapper source) 2451 { 2452 foreach(index, wrapper; onSelectCursorRowListeners) 2453 { 2454 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2455 { 2456 onSelectCursorRowListeners[index] = null; 2457 onSelectCursorRowListeners = std.algorithm.remove(onSelectCursorRowListeners, index); 2458 break; 2459 } 2460 } 2461 } 2462 2463 2464 protected class OnStartInteractiveSearchDelegateWrapper 2465 { 2466 bool delegate(TreeView) dlg; 2467 gulong handlerId; 2468 ConnectFlags flags; 2469 this(bool delegate(TreeView) dlg, gulong handlerId, ConnectFlags flags) 2470 { 2471 this.dlg = dlg; 2472 this.handlerId = handlerId; 2473 this.flags = flags; 2474 } 2475 } 2476 protected OnStartInteractiveSearchDelegateWrapper[] onStartInteractiveSearchListeners; 2477 2478 /** */ 2479 gulong addOnStartInteractiveSearch(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2480 { 2481 onStartInteractiveSearchListeners ~= new OnStartInteractiveSearchDelegateWrapper(dlg, 0, connectFlags); 2482 onStartInteractiveSearchListeners[onStartInteractiveSearchListeners.length - 1].handlerId = Signals.connectData( 2483 this, 2484 "start-interactive-search", 2485 cast(GCallback)&callBackStartInteractiveSearch, 2486 cast(void*)onStartInteractiveSearchListeners[onStartInteractiveSearchListeners.length - 1], 2487 cast(GClosureNotify)&callBackStartInteractiveSearchDestroy, 2488 connectFlags); 2489 return onStartInteractiveSearchListeners[onStartInteractiveSearchListeners.length - 1].handlerId; 2490 } 2491 2492 extern(C) static int callBackStartInteractiveSearch(GtkTreeView* treeviewStruct,OnStartInteractiveSearchDelegateWrapper wrapper) 2493 { 2494 return wrapper.dlg(wrapper.outer); 2495 } 2496 2497 extern(C) static void callBackStartInteractiveSearchDestroy(OnStartInteractiveSearchDelegateWrapper wrapper, GClosure* closure) 2498 { 2499 wrapper.outer.internalRemoveOnStartInteractiveSearch(wrapper); 2500 } 2501 2502 protected void internalRemoveOnStartInteractiveSearch(OnStartInteractiveSearchDelegateWrapper source) 2503 { 2504 foreach(index, wrapper; onStartInteractiveSearchListeners) 2505 { 2506 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2507 { 2508 onStartInteractiveSearchListeners[index] = null; 2509 onStartInteractiveSearchListeners = std.algorithm.remove(onStartInteractiveSearchListeners, index); 2510 break; 2511 } 2512 } 2513 } 2514 2515 2516 protected class OnTestCollapseRowDelegateWrapper 2517 { 2518 bool delegate(TreeIter, TreePath, TreeView) dlg; 2519 gulong handlerId; 2520 ConnectFlags flags; 2521 this(bool delegate(TreeIter, TreePath, TreeView) dlg, gulong handlerId, ConnectFlags flags) 2522 { 2523 this.dlg = dlg; 2524 this.handlerId = handlerId; 2525 this.flags = flags; 2526 } 2527 } 2528 protected OnTestCollapseRowDelegateWrapper[] onTestCollapseRowListeners; 2529 2530 /** 2531 * The given row is about to be collapsed (hide its children nodes). Use this 2532 * signal if you need to control the collapsibility of individual rows. 2533 * 2534 * Params: 2535 * iter = the tree iter of the row to collapse 2536 * path = a tree path that points to the row 2537 * 2538 * Return: %FALSE to allow collapsing, %TRUE to reject 2539 */ 2540 gulong addOnTestCollapseRow(bool delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2541 { 2542 onTestCollapseRowListeners ~= new OnTestCollapseRowDelegateWrapper(dlg, 0, connectFlags); 2543 onTestCollapseRowListeners[onTestCollapseRowListeners.length - 1].handlerId = Signals.connectData( 2544 this, 2545 "test-collapse-row", 2546 cast(GCallback)&callBackTestCollapseRow, 2547 cast(void*)onTestCollapseRowListeners[onTestCollapseRowListeners.length - 1], 2548 cast(GClosureNotify)&callBackTestCollapseRowDestroy, 2549 connectFlags); 2550 return onTestCollapseRowListeners[onTestCollapseRowListeners.length - 1].handlerId; 2551 } 2552 2553 extern(C) static int callBackTestCollapseRow(GtkTreeView* treeviewStruct, GtkTreeIter* iter, GtkTreePath* path,OnTestCollapseRowDelegateWrapper wrapper) 2554 { 2555 return wrapper.dlg(ObjectG.getDObject!(TreeIter)(iter), ObjectG.getDObject!(TreePath)(path), wrapper.outer); 2556 } 2557 2558 extern(C) static void callBackTestCollapseRowDestroy(OnTestCollapseRowDelegateWrapper wrapper, GClosure* closure) 2559 { 2560 wrapper.outer.internalRemoveOnTestCollapseRow(wrapper); 2561 } 2562 2563 protected void internalRemoveOnTestCollapseRow(OnTestCollapseRowDelegateWrapper source) 2564 { 2565 foreach(index, wrapper; onTestCollapseRowListeners) 2566 { 2567 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2568 { 2569 onTestCollapseRowListeners[index] = null; 2570 onTestCollapseRowListeners = std.algorithm.remove(onTestCollapseRowListeners, index); 2571 break; 2572 } 2573 } 2574 } 2575 2576 2577 protected class OnTestExpandRowDelegateWrapper 2578 { 2579 bool delegate(TreeIter, TreePath, TreeView) dlg; 2580 gulong handlerId; 2581 ConnectFlags flags; 2582 this(bool delegate(TreeIter, TreePath, TreeView) dlg, gulong handlerId, ConnectFlags flags) 2583 { 2584 this.dlg = dlg; 2585 this.handlerId = handlerId; 2586 this.flags = flags; 2587 } 2588 } 2589 protected OnTestExpandRowDelegateWrapper[] onTestExpandRowListeners; 2590 2591 /** 2592 * The given row is about to be expanded (show its children nodes). Use this 2593 * signal if you need to control the expandability of individual rows. 2594 * 2595 * Params: 2596 * iter = the tree iter of the row to expand 2597 * path = a tree path that points to the row 2598 * 2599 * Return: %FALSE to allow expansion, %TRUE to reject 2600 */ 2601 gulong addOnTestExpandRow(bool delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2602 { 2603 onTestExpandRowListeners ~= new OnTestExpandRowDelegateWrapper(dlg, 0, connectFlags); 2604 onTestExpandRowListeners[onTestExpandRowListeners.length - 1].handlerId = Signals.connectData( 2605 this, 2606 "test-expand-row", 2607 cast(GCallback)&callBackTestExpandRow, 2608 cast(void*)onTestExpandRowListeners[onTestExpandRowListeners.length - 1], 2609 cast(GClosureNotify)&callBackTestExpandRowDestroy, 2610 connectFlags); 2611 return onTestExpandRowListeners[onTestExpandRowListeners.length - 1].handlerId; 2612 } 2613 2614 extern(C) static int callBackTestExpandRow(GtkTreeView* treeviewStruct, GtkTreeIter* iter, GtkTreePath* path,OnTestExpandRowDelegateWrapper wrapper) 2615 { 2616 return wrapper.dlg(ObjectG.getDObject!(TreeIter)(iter), ObjectG.getDObject!(TreePath)(path), wrapper.outer); 2617 } 2618 2619 extern(C) static void callBackTestExpandRowDestroy(OnTestExpandRowDelegateWrapper wrapper, GClosure* closure) 2620 { 2621 wrapper.outer.internalRemoveOnTestExpandRow(wrapper); 2622 } 2623 2624 protected void internalRemoveOnTestExpandRow(OnTestExpandRowDelegateWrapper source) 2625 { 2626 foreach(index, wrapper; onTestExpandRowListeners) 2627 { 2628 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2629 { 2630 onTestExpandRowListeners[index] = null; 2631 onTestExpandRowListeners = std.algorithm.remove(onTestExpandRowListeners, index); 2632 break; 2633 } 2634 } 2635 } 2636 2637 2638 protected class OnToggleCursorRowDelegateWrapper 2639 { 2640 bool delegate(TreeView) dlg; 2641 gulong handlerId; 2642 ConnectFlags flags; 2643 this(bool delegate(TreeView) dlg, gulong handlerId, ConnectFlags flags) 2644 { 2645 this.dlg = dlg; 2646 this.handlerId = handlerId; 2647 this.flags = flags; 2648 } 2649 } 2650 protected OnToggleCursorRowDelegateWrapper[] onToggleCursorRowListeners; 2651 2652 /** */ 2653 gulong addOnToggleCursorRow(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2654 { 2655 onToggleCursorRowListeners ~= new OnToggleCursorRowDelegateWrapper(dlg, 0, connectFlags); 2656 onToggleCursorRowListeners[onToggleCursorRowListeners.length - 1].handlerId = Signals.connectData( 2657 this, 2658 "toggle-cursor-row", 2659 cast(GCallback)&callBackToggleCursorRow, 2660 cast(void*)onToggleCursorRowListeners[onToggleCursorRowListeners.length - 1], 2661 cast(GClosureNotify)&callBackToggleCursorRowDestroy, 2662 connectFlags); 2663 return onToggleCursorRowListeners[onToggleCursorRowListeners.length - 1].handlerId; 2664 } 2665 2666 extern(C) static int callBackToggleCursorRow(GtkTreeView* treeviewStruct,OnToggleCursorRowDelegateWrapper wrapper) 2667 { 2668 return wrapper.dlg(wrapper.outer); 2669 } 2670 2671 extern(C) static void callBackToggleCursorRowDestroy(OnToggleCursorRowDelegateWrapper wrapper, GClosure* closure) 2672 { 2673 wrapper.outer.internalRemoveOnToggleCursorRow(wrapper); 2674 } 2675 2676 protected void internalRemoveOnToggleCursorRow(OnToggleCursorRowDelegateWrapper source) 2677 { 2678 foreach(index, wrapper; onToggleCursorRowListeners) 2679 { 2680 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2681 { 2682 onToggleCursorRowListeners[index] = null; 2683 onToggleCursorRowListeners = std.algorithm.remove(onToggleCursorRowListeners, index); 2684 break; 2685 } 2686 } 2687 } 2688 2689 2690 protected class OnUnselectAllDelegateWrapper 2691 { 2692 bool delegate(TreeView) dlg; 2693 gulong handlerId; 2694 ConnectFlags flags; 2695 this(bool delegate(TreeView) dlg, gulong handlerId, ConnectFlags flags) 2696 { 2697 this.dlg = dlg; 2698 this.handlerId = handlerId; 2699 this.flags = flags; 2700 } 2701 } 2702 protected OnUnselectAllDelegateWrapper[] onUnselectAllListeners; 2703 2704 /** */ 2705 gulong addOnUnselectAll(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2706 { 2707 onUnselectAllListeners ~= new OnUnselectAllDelegateWrapper(dlg, 0, connectFlags); 2708 onUnselectAllListeners[onUnselectAllListeners.length - 1].handlerId = Signals.connectData( 2709 this, 2710 "unselect-all", 2711 cast(GCallback)&callBackUnselectAll, 2712 cast(void*)onUnselectAllListeners[onUnselectAllListeners.length - 1], 2713 cast(GClosureNotify)&callBackUnselectAllDestroy, 2714 connectFlags); 2715 return onUnselectAllListeners[onUnselectAllListeners.length - 1].handlerId; 2716 } 2717 2718 extern(C) static int callBackUnselectAll(GtkTreeView* treeviewStruct,OnUnselectAllDelegateWrapper wrapper) 2719 { 2720 return wrapper.dlg(wrapper.outer); 2721 } 2722 2723 extern(C) static void callBackUnselectAllDestroy(OnUnselectAllDelegateWrapper wrapper, GClosure* closure) 2724 { 2725 wrapper.outer.internalRemoveOnUnselectAll(wrapper); 2726 } 2727 2728 protected void internalRemoveOnUnselectAll(OnUnselectAllDelegateWrapper source) 2729 { 2730 foreach(index, wrapper; onUnselectAllListeners) 2731 { 2732 if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId) 2733 { 2734 onUnselectAllListeners[index] = null; 2735 onUnselectAllListeners = std.algorithm.remove(onUnselectAllListeners, index); 2736 break; 2737 } 2738 } 2739 } 2740 2741 }