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