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