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