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