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