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 = GtkIconView.html 27 * outPack = gtk 28 * outFile = IconView 29 * strct = GtkIconView 30 * realStrct= 31 * ctorStrct= 32 * clss = IconView 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - CellLayoutIF 40 * - ScrollableIF 41 * prefixes: 42 * - gtk_icon_view_ 43 * omit structs: 44 * omit prefixes: 45 * omit code: 46 * omit signals: 47 * imports: 48 * - cairo.Surface 49 * - glib.ListG 50 * - gtk.CellArea 51 * - gtk.CellRenderer 52 * - gtk.Tooltip 53 * - gtk.TreeIter 54 * - gtk.TreeModel 55 * - gtk.TreeModelIF 56 * - gtk.TreePath 57 * - gtk.CellLayoutIF 58 * - gtk.CellLayoutT 59 * - gtk.ScrollableT 60 * - gtk.ScrollableIF 61 * structWrap: 62 * - GList* -> ListG 63 * - GtkCellArea* -> CellArea 64 * - GtkCellRenderer* -> CellRenderer 65 * - GtkTooltip* -> Tooltip 66 * - GtkTreeIter* -> TreeIter 67 * - GtkTreeModel* -> TreeModelIF 68 * - GtkTreePath* -> TreePath 69 * - cairo_surface_t* -> Surface 70 * module aliases: 71 * local aliases: 72 * overrides: 73 */ 74 75 module gtk.IconView; 76 77 public import gtkc.gtktypes; 78 79 private import gtkc.gtk; 80 private import glib.ConstructionException; 81 private import gobject.ObjectG; 82 83 private import gobject.Signals; 84 public import gtkc.gdktypes; 85 86 private import cairo.Surface; 87 private import glib.ListG; 88 private import gtk.CellArea; 89 private import gtk.CellRenderer; 90 private import gtk.Tooltip; 91 private import gtk.TreeIter; 92 private import gtk.TreeModel; 93 private import gtk.TreeModelIF; 94 private import gtk.TreePath; 95 private import gtk.CellLayoutIF; 96 private import gtk.CellLayoutT; 97 private import gtk.ScrollableT; 98 private import gtk.ScrollableIF; 99 100 101 102 private import gtk.Container; 103 104 /** 105 * GtkIconView provides an alternative view on a GtkTreeModel. 106 * It displays the model as a grid of icons with labels. Like 107 * GtkTreeView, it allows to select one or multiple items 108 * (depending on the selection mode, see gtk_icon_view_set_selection_mode()). 109 * In addition to selection with the arrow keys, GtkIconView supports 110 * rubberband selection, which is controlled by dragging the pointer. 111 * 112 * Note that if the tree model is backed by an actual tree store (as 113 * opposed to a flat list where the mapping to icons is obvious), 114 * GtkIconView will only display the first level of the tree and 115 * ignore the tree's branches. 116 */ 117 public class IconView : Container, CellLayoutIF, ScrollableIF 118 { 119 120 /** the main Gtk struct */ 121 protected GtkIconView* gtkIconView; 122 123 124 public GtkIconView* getIconViewStruct() 125 { 126 return gtkIconView; 127 } 128 129 130 /** the main Gtk struct as a void* */ 131 protected override void* getStruct() 132 { 133 return cast(void*)gtkIconView; 134 } 135 136 /** 137 * Sets our main struct and passes it to the parent class 138 */ 139 public this (GtkIconView* gtkIconView) 140 { 141 super(cast(GtkContainer*)gtkIconView); 142 this.gtkIconView = gtkIconView; 143 } 144 145 protected override void setStruct(GObject* obj) 146 { 147 super.setStruct(obj); 148 gtkIconView = cast(GtkIconView*)obj; 149 } 150 151 // add the CellLayout capabilities 152 mixin CellLayoutT!(GtkIconView); 153 154 // add the Scrollable capabilities 155 mixin ScrollableT!(GtkIconView); 156 157 /** 158 */ 159 int[string] connectedSignals; 160 161 bool delegate(IconView)[] onActivateCursorItemListeners; 162 /** 163 * A keybinding signal 164 * which gets emitted when the user activates the currently 165 * focused item. 166 * Applications should not connect to it, but may emit it with 167 * g_signal_emit_by_name() if they need to control activation 168 * programmatically. 169 * The default bindings for this signal are Space, Return and Enter. 170 */ 171 void addOnActivateCursorItem(bool delegate(IconView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 172 { 173 if ( !("activate-cursor-item" in connectedSignals) ) 174 { 175 Signals.connectData( 176 getStruct(), 177 "activate-cursor-item", 178 cast(GCallback)&callBackActivateCursorItem, 179 cast(void*)this, 180 null, 181 connectFlags); 182 connectedSignals["activate-cursor-item"] = 1; 183 } 184 onActivateCursorItemListeners ~= dlg; 185 } 186 extern(C) static gboolean callBackActivateCursorItem(GtkIconView* iconviewStruct, IconView _iconView) 187 { 188 foreach ( bool delegate(IconView) dlg ; _iconView.onActivateCursorItemListeners ) 189 { 190 if ( dlg(_iconView) ) 191 { 192 return 1; 193 } 194 } 195 196 return 0; 197 } 198 199 void delegate(TreePath, IconView)[] onItemActivatedListeners; 200 /** 201 * The ::item-activated signal is emitted when the method 202 * gtk_icon_view_item_activated() is called, when the user double 203 * clicks an item with the "activate-on-single-click" property set 204 * to FALSE, or when the user single clicks an item when the 205 * "activate-on-single-click" property set to TRUE. It is also 206 */ 207 void addOnItemActivated(void delegate(TreePath, IconView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 208 { 209 if ( !("item-activated" in connectedSignals) ) 210 { 211 Signals.connectData( 212 getStruct(), 213 "item-activated", 214 cast(GCallback)&callBackItemActivated, 215 cast(void*)this, 216 null, 217 connectFlags); 218 connectedSignals["item-activated"] = 1; 219 } 220 onItemActivatedListeners ~= dlg; 221 } 222 extern(C) static void callBackItemActivated(GtkIconView* iconviewStruct, GtkTreePath* path, IconView _iconView) 223 { 224 foreach ( void delegate(TreePath, IconView) dlg ; _iconView.onItemActivatedListeners ) 225 { 226 dlg(ObjectG.getDObject!(TreePath)(path), _iconView); 227 } 228 } 229 230 bool delegate(GtkMovementStep, gint, IconView)[] onMoveCursorListeners; 231 /** 232 * The ::move-cursor signal is a 233 * keybinding signal 234 * which gets emitted when the user initiates a cursor movement. 235 * Applications should not connect to it, but may emit it with 236 * g_signal_emit_by_name() if they need to control the cursor 237 * programmatically. 238 * The default bindings for this signal include 239 * Arrow keys which move by individual steps 240 * Home/End keys which move to the first/last item 241 * PageUp/PageDown which move by "pages" 242 * All of these will extend the selection when combined with 243 * the Shift modifier. 244 */ 245 void addOnMoveCursor(bool delegate(GtkMovementStep, gint, IconView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 246 { 247 if ( !("move-cursor" in connectedSignals) ) 248 { 249 Signals.connectData( 250 getStruct(), 251 "move-cursor", 252 cast(GCallback)&callBackMoveCursor, 253 cast(void*)this, 254 null, 255 connectFlags); 256 connectedSignals["move-cursor"] = 1; 257 } 258 onMoveCursorListeners ~= dlg; 259 } 260 extern(C) static gboolean callBackMoveCursor(GtkIconView* iconviewStruct, GtkMovementStep step, gint count, IconView _iconView) 261 { 262 foreach ( bool delegate(GtkMovementStep, gint, IconView) dlg ; _iconView.onMoveCursorListeners ) 263 { 264 if ( dlg(step, count, _iconView) ) 265 { 266 return 1; 267 } 268 } 269 270 return 0; 271 } 272 273 void delegate(IconView)[] onSelectAllListeners; 274 /** 275 * A keybinding signal 276 * which gets emitted when the user selects all items. 277 * Applications should not connect to it, but may emit it with 278 * g_signal_emit_by_name() if they need to control selection 279 * programmatically. 280 * The default binding for this signal is Ctrl-a. 281 */ 282 void addOnSelectAll(void delegate(IconView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 283 { 284 if ( !("select-all" in connectedSignals) ) 285 { 286 Signals.connectData( 287 getStruct(), 288 "select-all", 289 cast(GCallback)&callBackSelectAll, 290 cast(void*)this, 291 null, 292 connectFlags); 293 connectedSignals["select-all"] = 1; 294 } 295 onSelectAllListeners ~= dlg; 296 } 297 extern(C) static void callBackSelectAll(GtkIconView* iconviewStruct, IconView _iconView) 298 { 299 foreach ( void delegate(IconView) dlg ; _iconView.onSelectAllListeners ) 300 { 301 dlg(_iconView); 302 } 303 } 304 305 void delegate(IconView)[] onSelectCursorItemListeners; 306 /** 307 * A keybinding signal 308 * which gets emitted when the user selects the item that is currently 309 * focused. 310 * Applications should not connect to it, but may emit it with 311 * g_signal_emit_by_name() if they need to control selection 312 * programmatically. 313 * There is no default binding for this signal. 314 */ 315 void addOnSelectCursorItem(void delegate(IconView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 316 { 317 if ( !("select-cursor-item" in connectedSignals) ) 318 { 319 Signals.connectData( 320 getStruct(), 321 "select-cursor-item", 322 cast(GCallback)&callBackSelectCursorItem, 323 cast(void*)this, 324 null, 325 connectFlags); 326 connectedSignals["select-cursor-item"] = 1; 327 } 328 onSelectCursorItemListeners ~= dlg; 329 } 330 extern(C) static void callBackSelectCursorItem(GtkIconView* iconviewStruct, IconView _iconView) 331 { 332 foreach ( void delegate(IconView) dlg ; _iconView.onSelectCursorItemListeners ) 333 { 334 dlg(_iconView); 335 } 336 } 337 338 void delegate(IconView)[] onSelectionChangedListeners; 339 /** 340 * The ::selection-changed signal is emitted when the selection 341 * (i.e. the set of selected items) changes. 342 */ 343 void addOnSelectionChanged(void delegate(IconView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 344 { 345 if ( !("selection-changed" in connectedSignals) ) 346 { 347 Signals.connectData( 348 getStruct(), 349 "selection-changed", 350 cast(GCallback)&callBackSelectionChanged, 351 cast(void*)this, 352 null, 353 connectFlags); 354 connectedSignals["selection-changed"] = 1; 355 } 356 onSelectionChangedListeners ~= dlg; 357 } 358 extern(C) static void callBackSelectionChanged(GtkIconView* iconviewStruct, IconView _iconView) 359 { 360 foreach ( void delegate(IconView) dlg ; _iconView.onSelectionChangedListeners ) 361 { 362 dlg(_iconView); 363 } 364 } 365 366 void delegate(IconView)[] onToggleCursorItemListeners; 367 /** 368 * A keybinding signal 369 * which gets emitted when the user toggles whether the currently 370 * focused item is selected or not. The exact effect of this 371 * depend on the selection mode. 372 * Applications should not connect to it, but may emit it with 373 * g_signal_emit_by_name() if they need to control selection 374 * programmatically. 375 * There is no default binding for this signal is Ctrl-Space. 376 */ 377 void addOnToggleCursorItem(void delegate(IconView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 378 { 379 if ( !("toggle-cursor-item" in connectedSignals) ) 380 { 381 Signals.connectData( 382 getStruct(), 383 "toggle-cursor-item", 384 cast(GCallback)&callBackToggleCursorItem, 385 cast(void*)this, 386 null, 387 connectFlags); 388 connectedSignals["toggle-cursor-item"] = 1; 389 } 390 onToggleCursorItemListeners ~= dlg; 391 } 392 extern(C) static void callBackToggleCursorItem(GtkIconView* iconviewStruct, IconView _iconView) 393 { 394 foreach ( void delegate(IconView) dlg ; _iconView.onToggleCursorItemListeners ) 395 { 396 dlg(_iconView); 397 } 398 } 399 400 void delegate(IconView)[] onUnselectAllListeners; 401 /** 402 * A keybinding signal 403 * which gets emitted when the user unselects all items. 404 * Applications should not connect to it, but may emit it with 405 * g_signal_emit_by_name() if they need to control selection 406 * programmatically. 407 * The default binding for this signal is Ctrl-Shift-a. 408 */ 409 void addOnUnselectAll(void delegate(IconView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 410 { 411 if ( !("unselect-all" in connectedSignals) ) 412 { 413 Signals.connectData( 414 getStruct(), 415 "unselect-all", 416 cast(GCallback)&callBackUnselectAll, 417 cast(void*)this, 418 null, 419 connectFlags); 420 connectedSignals["unselect-all"] = 1; 421 } 422 onUnselectAllListeners ~= dlg; 423 } 424 extern(C) static void callBackUnselectAll(GtkIconView* iconviewStruct, IconView _iconView) 425 { 426 foreach ( void delegate(IconView) dlg ; _iconView.onUnselectAllListeners ) 427 { 428 dlg(_iconView); 429 } 430 } 431 432 433 /** 434 * Creates a new GtkIconView widget 435 * Since 2.6 436 * Throws: ConstructionException GTK+ fails to create the object. 437 */ 438 public this () 439 { 440 // GtkWidget * gtk_icon_view_new (void); 441 auto p = gtk_icon_view_new(); 442 if(p is null) 443 { 444 throw new ConstructionException("null returned by gtk_icon_view_new()"); 445 } 446 this(cast(GtkIconView*) p); 447 } 448 449 /** 450 * Creates a new GtkIconView widget using the 451 * specified area to layout cells inside the icons. 452 * Params: 453 * area = the GtkCellArea to use to layout cells 454 * Throws: ConstructionException GTK+ fails to create the object. 455 */ 456 public this (CellArea area) 457 { 458 // GtkWidget * gtk_icon_view_new_with_area (GtkCellArea *area); 459 auto p = gtk_icon_view_new_with_area((area is null) ? null : area.getCellAreaStruct()); 460 if(p is null) 461 { 462 throw new ConstructionException("null returned by gtk_icon_view_new_with_area((area is null) ? null : area.getCellAreaStruct())"); 463 } 464 this(cast(GtkIconView*) p); 465 } 466 467 /** 468 * Creates a new GtkIconView widget with the model model. 469 * Since 2.6 470 * Params: 471 * model = The model. 472 * Throws: ConstructionException GTK+ fails to create the object. 473 */ 474 public this (TreeModelIF model) 475 { 476 // GtkWidget * gtk_icon_view_new_with_model (GtkTreeModel *model); 477 auto p = gtk_icon_view_new_with_model((model is null) ? null : model.getTreeModelTStruct()); 478 if(p is null) 479 { 480 throw new ConstructionException("null returned by gtk_icon_view_new_with_model((model is null) ? null : model.getTreeModelTStruct())"); 481 } 482 this(cast(GtkIconView*) p); 483 } 484 485 /** 486 * Sets the model for a GtkIconView. 487 * If the icon_view already has a model set, it will remove 488 * it before setting the new model. If model is NULL, then 489 * it will unset the old model. 490 * Since 2.6 491 * Params: 492 * model = The model. [allow-none] 493 */ 494 public void setModel(TreeModelIF model) 495 { 496 // void gtk_icon_view_set_model (GtkIconView *icon_view, GtkTreeModel *model); 497 gtk_icon_view_set_model(gtkIconView, (model is null) ? null : model.getTreeModelTStruct()); 498 } 499 500 /** 501 * Returns the model the GtkIconView is based on. Returns NULL if the 502 * model is unset. 503 * Since 2.6 504 * Returns: A GtkTreeModel, or NULL if none is currently being used. [transfer none] 505 */ 506 public TreeModelIF getModel() 507 { 508 // GtkTreeModel * gtk_icon_view_get_model (GtkIconView *icon_view); 509 auto p = gtk_icon_view_get_model(gtkIconView); 510 511 if(p is null) 512 { 513 return null; 514 } 515 516 return ObjectG.getDObject!(TreeModel, TreeModelIF)(cast(GtkTreeModel*) p); 517 } 518 519 /** 520 * Sets the column with text for icon_view to be column. The text 521 * column must be of type G_TYPE_STRING. 522 * Since 2.6 523 * Params: 524 * column = A column in the currently used model, or -1 to display no text 525 */ 526 public void setTextColumn(int column) 527 { 528 // void gtk_icon_view_set_text_column (GtkIconView *icon_view, gint column); 529 gtk_icon_view_set_text_column(gtkIconView, column); 530 } 531 532 /** 533 * Returns the column with text for icon_view. 534 * Since 2.6 535 * Returns: the text column, or -1 if it's unset. 536 */ 537 public int getTextColumn() 538 { 539 // gint gtk_icon_view_get_text_column (GtkIconView *icon_view); 540 return gtk_icon_view_get_text_column(gtkIconView); 541 } 542 543 /** 544 * Sets the column with markup information for icon_view to be 545 * column. The markup column must be of type G_TYPE_STRING. 546 * If the markup column is set to something, it overrides 547 * the text column set by gtk_icon_view_set_text_column(). 548 * Since 2.6 549 * Params: 550 * column = A column in the currently used model, or -1 to display no text 551 */ 552 public void setMarkupColumn(int column) 553 { 554 // void gtk_icon_view_set_markup_column (GtkIconView *icon_view, gint column); 555 gtk_icon_view_set_markup_column(gtkIconView, column); 556 } 557 558 /** 559 * Returns the column with markup text for icon_view. 560 * Since 2.6 561 * Returns: the markup column, or -1 if it's unset. 562 */ 563 public int getMarkupColumn() 564 { 565 // gint gtk_icon_view_get_markup_column (GtkIconView *icon_view); 566 return gtk_icon_view_get_markup_column(gtkIconView); 567 } 568 569 /** 570 * Sets the column with pixbufs for icon_view to be column. The pixbuf 571 * column must be of type GDK_TYPE_PIXBUF 572 * Since 2.6 573 * Params: 574 * column = A column in the currently used model, or -1 to disable 575 */ 576 public void setPixbufColumn(int column) 577 { 578 // void gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view, gint column); 579 gtk_icon_view_set_pixbuf_column(gtkIconView, column); 580 } 581 582 /** 583 * Returns the column with pixbufs for icon_view. 584 * Since 2.6 585 * Returns: the pixbuf column, or -1 if it's unset. 586 */ 587 public int getPixbufColumn() 588 { 589 // gint gtk_icon_view_get_pixbuf_column (GtkIconView *icon_view); 590 return gtk_icon_view_get_pixbuf_column(gtkIconView); 591 } 592 593 /** 594 * Finds the path at the point (x, y), relative to bin_window coordinates. 595 * See gtk_icon_view_get_item_at_pos(), if you are also interested in 596 * the cell at the specified position. 597 * See gtk_icon_view_convert_widget_to_bin_window_coords() for converting 598 * widget coordinates to bin_window coordinates. 599 * Since 2.6 600 * Params: 601 * x = The x position to be identified 602 * y = The y position to be identified 603 * Returns: The GtkTreePath corresponding to the icon or NULL if no icon exists at that position. 604 */ 605 public TreePath getPathAtPos(int x, int y) 606 { 607 // GtkTreePath * gtk_icon_view_get_path_at_pos (GtkIconView *icon_view, gint x, gint y); 608 auto p = gtk_icon_view_get_path_at_pos(gtkIconView, x, y); 609 610 if(p is null) 611 { 612 return null; 613 } 614 615 return ObjectG.getDObject!(TreePath)(cast(GtkTreePath*) p); 616 } 617 618 /** 619 * Finds the path at the point (x, y), relative to bin_window coordinates. 620 * In contrast to gtk_icon_view_get_path_at_pos(), this function also 621 * obtains the cell at the specified position. The returned path should 622 * be freed with gtk_tree_path_free(). 623 * See gtk_icon_view_convert_widget_to_bin_window_coords() for converting 624 * widget coordinates to bin_window coordinates. 625 * Since 2.8 626 * Params: 627 * x = The x position to be identified 628 * y = The y position to be identified 629 * path = Return location for the path, or NULL. [out][allow-none] 630 * cell = Return location for the renderer 631 * responsible for the cell at (x, y), or NULL. [out][allow-none] 632 * Returns: TRUE if an item exists at the specified position 633 */ 634 public int getItemAtPos(int x, int y, out TreePath path, out CellRenderer cell) 635 { 636 // gboolean gtk_icon_view_get_item_at_pos (GtkIconView *icon_view, gint x, gint y, GtkTreePath **path, GtkCellRenderer **cell); 637 GtkTreePath* outpath = null; 638 GtkCellRenderer* outcell = null; 639 640 auto p = gtk_icon_view_get_item_at_pos(gtkIconView, x, y, &outpath, &outcell); 641 642 path = ObjectG.getDObject!(TreePath)(outpath); 643 cell = ObjectG.getDObject!(CellRenderer)(outcell); 644 return p; 645 } 646 647 /** 648 * Converts widget coordinates to coordinates for the bin_window, 649 * as expected by e.g. gtk_icon_view_get_path_at_pos(). 650 * Since 2.12 651 * Params: 652 * wx = X coordinate relative to the widget 653 * wy = Y coordinate relative to the widget 654 * bx = return location for bin_window X coordinate. [out] 655 * by = return location for bin_window Y coordinate. [out] 656 */ 657 public void convertWidgetToBinWindowCoords(int wx, int wy, out int bx, out int by) 658 { 659 // void gtk_icon_view_convert_widget_to_bin_window_coords (GtkIconView *icon_view, gint wx, gint wy, gint *bx, gint *by); 660 gtk_icon_view_convert_widget_to_bin_window_coords(gtkIconView, wx, wy, &bx, &by); 661 } 662 663 /** 664 * Sets the current keyboard focus to be at path, and selects it. This is 665 * useful when you want to focus the user's attention on a particular item. 666 * If cell is not NULL, then focus is given to the cell specified by 667 * it. Additionally, if start_editing is TRUE, then editing should be 668 * started in the specified cell. 669 * This function is often followed by gtk_widget_grab_focus 670 * (icon_view) in order to give keyboard focus to the widget. 671 * Please note that editing can only happen when the widget is realized. 672 * Since 2.8 673 * Params: 674 * path = A GtkTreePath 675 * cell = One of the cell renderers of icon_view, or NULL. [allow-none] 676 * startEditing = TRUE if the specified cell should start being edited. 677 */ 678 public void setCursor(TreePath path, CellRenderer cell, int startEditing) 679 { 680 // void gtk_icon_view_set_cursor (GtkIconView *icon_view, GtkTreePath *path, GtkCellRenderer *cell, gboolean start_editing); 681 gtk_icon_view_set_cursor(gtkIconView, (path is null) ? null : path.getTreePathStruct(), (cell is null) ? null : cell.getCellRendererStruct(), startEditing); 682 } 683 684 /** 685 * Fills in path and cell with the current cursor path and cell. 686 * If the cursor isn't currently set, then *path will be NULL. 687 * If no cell currently has focus, then *cell will be NULL. 688 * The returned GtkTreePath must be freed with gtk_tree_path_free(). 689 * Since 2.8 690 * Params: 691 * path = Return location for the current 692 * cursor path, or NULL. [out][allow-none][transfer full] 693 * cell = Return location the current 694 * focus cell, or NULL. [out][allow-none][transfer none] 695 * Returns: TRUE if the cursor is set. 696 */ 697 public int getCursor(out TreePath path, out CellRenderer cell) 698 { 699 // gboolean gtk_icon_view_get_cursor (GtkIconView *icon_view, GtkTreePath **path, GtkCellRenderer **cell); 700 GtkTreePath* outpath = null; 701 GtkCellRenderer* outcell = null; 702 703 auto p = gtk_icon_view_get_cursor(gtkIconView, &outpath, &outcell); 704 705 path = ObjectG.getDObject!(TreePath)(outpath); 706 cell = ObjectG.getDObject!(CellRenderer)(outcell); 707 return p; 708 } 709 710 /** 711 * Calls a function for each selected icon. Note that the model or 712 * selection cannot be modified from within this function. 713 * Since 2.6 714 * Params: 715 * func = The function to call for each selected icon. [scope call] 716 * data = User data to pass to the function. 717 */ 718 public void selectedForeach(GtkIconViewForeachFunc func, void* data) 719 { 720 // void gtk_icon_view_selected_foreach (GtkIconView *icon_view, GtkIconViewForeachFunc func, gpointer data); 721 gtk_icon_view_selected_foreach(gtkIconView, func, data); 722 } 723 724 /** 725 * Sets the selection mode of the icon_view. 726 * Since 2.6 727 * Params: 728 * mode = The selection mode 729 */ 730 public void setSelectionMode(GtkSelectionMode mode) 731 { 732 // void gtk_icon_view_set_selection_mode (GtkIconView *icon_view, GtkSelectionMode mode); 733 gtk_icon_view_set_selection_mode(gtkIconView, mode); 734 } 735 736 /** 737 * Gets the selection mode of the icon_view. 738 * Since 2.6 739 * Returns: the current selection mode 740 */ 741 public GtkSelectionMode getSelectionMode() 742 { 743 // GtkSelectionMode gtk_icon_view_get_selection_mode (GtkIconView *icon_view); 744 return gtk_icon_view_get_selection_mode(gtkIconView); 745 } 746 747 /** 748 * Sets the ::item-orientation property which determines whether the labels 749 * are drawn beside the icons instead of below. 750 * Since 2.6 751 * Params: 752 * orientation = the relative position of texts and icons 753 */ 754 public void setItemOrientation(GtkOrientation orientation) 755 { 756 // void gtk_icon_view_set_item_orientation (GtkIconView *icon_view, GtkOrientation orientation); 757 gtk_icon_view_set_item_orientation(gtkIconView, orientation); 758 } 759 760 /** 761 * Returns the value of the ::item-orientation property which determines 762 * whether the labels are drawn beside the icons instead of below. 763 * Since 2.6 764 * Returns: the relative position of texts and icons 765 */ 766 public GtkOrientation getItemOrientation() 767 { 768 // GtkOrientation gtk_icon_view_get_item_orientation (GtkIconView *icon_view); 769 return gtk_icon_view_get_item_orientation(gtkIconView); 770 } 771 772 /** 773 * Sets the ::columns property which determines in how 774 * many columns the icons are arranged. If columns is 775 * -1, the number of columns will be chosen automatically 776 * to fill the available area. 777 * Since 2.6 778 * Params: 779 * columns = the number of columns 780 */ 781 public void setColumns(int columns) 782 { 783 // void gtk_icon_view_set_columns (GtkIconView *icon_view, gint columns); 784 gtk_icon_view_set_columns(gtkIconView, columns); 785 } 786 787 /** 788 * Returns the value of the ::columns property. 789 * Since 2.6 790 * Returns: the number of columns, or -1 791 */ 792 public int getColumns() 793 { 794 // gint gtk_icon_view_get_columns (GtkIconView *icon_view); 795 return gtk_icon_view_get_columns(gtkIconView); 796 } 797 798 /** 799 * Sets the ::item-width property which specifies the width 800 * to use for each item. If it is set to -1, the icon view will 801 * automatically determine a suitable item size. 802 * Since 2.6 803 * Params: 804 * itemWidth = the width for each item 805 */ 806 public void setItemWidth(int itemWidth) 807 { 808 // void gtk_icon_view_set_item_width (GtkIconView *icon_view, gint item_width); 809 gtk_icon_view_set_item_width(gtkIconView, itemWidth); 810 } 811 812 /** 813 * Returns the value of the ::item-width property. 814 * Since 2.6 815 * Returns: the width of a single item, or -1 816 */ 817 public int getItemWidth() 818 { 819 // gint gtk_icon_view_get_item_width (GtkIconView *icon_view); 820 return gtk_icon_view_get_item_width(gtkIconView); 821 } 822 823 /** 824 * Sets the ::spacing property which specifies the space 825 * which is inserted between the cells (i.e. the icon and 826 * the text) of an item. 827 * Since 2.6 828 * Params: 829 * spacing = the spacing 830 */ 831 public void setSpacing(int spacing) 832 { 833 // void gtk_icon_view_set_spacing (GtkIconView *icon_view, gint spacing); 834 gtk_icon_view_set_spacing(gtkIconView, spacing); 835 } 836 837 /** 838 * Returns the value of the ::spacing property. 839 * Since 2.6 840 * Returns: the space between cells 841 */ 842 public int getSpacing() 843 { 844 // gint gtk_icon_view_get_spacing (GtkIconView *icon_view); 845 return gtk_icon_view_get_spacing(gtkIconView); 846 } 847 848 /** 849 * Sets the ::row-spacing property which specifies the space 850 * which is inserted between the rows of the icon view. 851 * Since 2.6 852 * Params: 853 * rowSpacing = the row spacing 854 */ 855 public void setRowSpacing(int rowSpacing) 856 { 857 // void gtk_icon_view_set_row_spacing (GtkIconView *icon_view, gint row_spacing); 858 gtk_icon_view_set_row_spacing(gtkIconView, rowSpacing); 859 } 860 861 /** 862 * Returns the value of the ::row-spacing property. 863 * Since 2.6 864 * Returns: the space between rows 865 */ 866 public int getRowSpacing() 867 { 868 // gint gtk_icon_view_get_row_spacing (GtkIconView *icon_view); 869 return gtk_icon_view_get_row_spacing(gtkIconView); 870 } 871 872 /** 873 * Sets the ::column-spacing property which specifies the space 874 * which is inserted between the columns of the icon view. 875 * Since 2.6 876 * Params: 877 * columnSpacing = the column spacing 878 */ 879 public void setColumnSpacing(int columnSpacing) 880 { 881 // void gtk_icon_view_set_column_spacing (GtkIconView *icon_view, gint column_spacing); 882 gtk_icon_view_set_column_spacing(gtkIconView, columnSpacing); 883 } 884 885 /** 886 * Returns the value of the ::column-spacing property. 887 * Since 2.6 888 * Returns: the space between columns 889 */ 890 public int getColumnSpacing() 891 { 892 // gint gtk_icon_view_get_column_spacing (GtkIconView *icon_view); 893 return gtk_icon_view_get_column_spacing(gtkIconView); 894 } 895 896 /** 897 * Sets the ::margin property which specifies the space 898 * which is inserted at the top, bottom, left and right 899 * of the icon view. 900 * Since 2.6 901 * Params: 902 * margin = the margin 903 */ 904 public void setMargin(int margin) 905 { 906 // void gtk_icon_view_set_margin (GtkIconView *icon_view, gint margin); 907 gtk_icon_view_set_margin(gtkIconView, margin); 908 } 909 910 /** 911 * Returns the value of the ::margin property. 912 * Since 2.6 913 * Returns: the space at the borders 914 */ 915 public int getMargin() 916 { 917 // gint gtk_icon_view_get_margin (GtkIconView *icon_view); 918 return gtk_icon_view_get_margin(gtkIconView); 919 } 920 921 /** 922 * Sets the "item-padding" property which specifies the padding 923 * around each of the icon view's items. 924 * Since 2.18 925 * Params: 926 * itemPadding = the item padding 927 */ 928 public void setItemPadding(int itemPadding) 929 { 930 // void gtk_icon_view_set_item_padding (GtkIconView *icon_view, gint item_padding); 931 gtk_icon_view_set_item_padding(gtkIconView, itemPadding); 932 } 933 934 /** 935 * Returns the value of the ::item-padding property. 936 * Since 2.18 937 * Returns: the padding around items 938 */ 939 public int getItemPadding() 940 { 941 // gint gtk_icon_view_get_item_padding (GtkIconView *icon_view); 942 return gtk_icon_view_get_item_padding(gtkIconView); 943 } 944 945 /** 946 * Causes the "item-activated" signal to be emitted on 947 * a single click instead of a double click. 948 * Params: 949 * single = TRUE to emit item-activated on a single click 950 * Since 3.8 951 */ 952 public void setActivateOnSingleClick(int single) 953 { 954 // void gtk_icon_view_set_activate_on_single_click (GtkIconView *icon_view, gboolean single); 955 gtk_icon_view_set_activate_on_single_click(gtkIconView, single); 956 } 957 958 /** 959 * Gets the setting set by gtk_icon_view_set_activate_on_single_click(). 960 * Returns: TRUE if item-activated will be emitted on a single click Since 3.8 961 */ 962 public int getActivateOnSingleClick() 963 { 964 // gboolean gtk_icon_view_get_activate_on_single_click (GtkIconView *icon_view); 965 return gtk_icon_view_get_activate_on_single_click(gtkIconView); 966 } 967 968 /** 969 * Fills the bounding rectangle in widget coordinates for the cell specified by 970 * path and cell. If cell is NULL the main cell area is used. 971 * This function is only valid if icon_view is realized. 972 * Params: 973 * path = a GtkTreePath 974 * cell = a GtkCellRenderer or NULL. [allow-none] 975 * rect = rectangle to fill with cell rect. [out] 976 * Returns: FALSE if there is no such item, TRUE otherwise Since 3.6 977 */ 978 public int getCellRect(TreePath path, CellRenderer cell, out Rectangle rect) 979 { 980 // gboolean gtk_icon_view_get_cell_rect (GtkIconView *icon_view, GtkTreePath *path, GtkCellRenderer *cell, GdkRectangle *rect); 981 return gtk_icon_view_get_cell_rect(gtkIconView, (path is null) ? null : path.getTreePathStruct(), (cell is null) ? null : cell.getCellRendererStruct(), &rect); 982 } 983 984 /** 985 * Selects the row at path. 986 * Since 2.6 987 * Params: 988 * path = The GtkTreePath to be selected. 989 */ 990 public void selectPath(TreePath path) 991 { 992 // void gtk_icon_view_select_path (GtkIconView *icon_view, GtkTreePath *path); 993 gtk_icon_view_select_path(gtkIconView, (path is null) ? null : path.getTreePathStruct()); 994 } 995 996 /** 997 * Unselects the row at path. 998 * Since 2.6 999 * Params: 1000 * path = The GtkTreePath to be unselected. 1001 */ 1002 public void unselectPath(TreePath path) 1003 { 1004 // void gtk_icon_view_unselect_path (GtkIconView *icon_view, GtkTreePath *path); 1005 gtk_icon_view_unselect_path(gtkIconView, (path is null) ? null : path.getTreePathStruct()); 1006 } 1007 1008 /** 1009 * Returns TRUE if the icon pointed to by path is currently 1010 * selected. If path does not point to a valid location, FALSE is returned. 1011 * Since 2.6 1012 * Params: 1013 * path = A GtkTreePath to check selection on. 1014 * Returns: TRUE if path is selected. 1015 */ 1016 public int pathIsSelected(TreePath path) 1017 { 1018 // gboolean gtk_icon_view_path_is_selected (GtkIconView *icon_view, GtkTreePath *path); 1019 return gtk_icon_view_path_is_selected(gtkIconView, (path is null) ? null : path.getTreePathStruct()); 1020 } 1021 1022 /** 1023 * Creates a list of paths of all selected items. Additionally, if you are 1024 * planning on modifying the model after calling this function, you may 1025 * want to convert the returned list into a list of GtkTreeRowReferences. 1026 * To do this, you can use gtk_tree_row_reference_new(). 1027 * Since 2.6 1028 * Returns: A GList containing a GtkTreePath for each selected row. [element-type GtkTreePath][transfer full] 1029 */ 1030 public ListG getSelectedItems() 1031 { 1032 // GList * gtk_icon_view_get_selected_items (GtkIconView *icon_view); 1033 auto p = gtk_icon_view_get_selected_items(gtkIconView); 1034 1035 if(p is null) 1036 { 1037 return null; 1038 } 1039 1040 return ObjectG.getDObject!(ListG)(cast(GList*) p); 1041 } 1042 1043 /** 1044 * Selects all the icons. icon_view must has its selection mode set 1045 * to GTK_SELECTION_MULTIPLE. 1046 * Since 2.6 1047 */ 1048 public void selectAll() 1049 { 1050 // void gtk_icon_view_select_all (GtkIconView *icon_view); 1051 gtk_icon_view_select_all(gtkIconView); 1052 } 1053 1054 /** 1055 * Unselects all the icons. 1056 * Since 2.6 1057 */ 1058 public void unselectAll() 1059 { 1060 // void gtk_icon_view_unselect_all (GtkIconView *icon_view); 1061 gtk_icon_view_unselect_all(gtkIconView); 1062 } 1063 1064 /** 1065 * Activates the item determined by path. 1066 * Since 2.6 1067 * Params: 1068 * path = The GtkTreePath to be activated 1069 */ 1070 public void itemActivated(TreePath path) 1071 { 1072 // void gtk_icon_view_item_activated (GtkIconView *icon_view, GtkTreePath *path); 1073 gtk_icon_view_item_activated(gtkIconView, (path is null) ? null : path.getTreePathStruct()); 1074 } 1075 1076 /** 1077 * Moves the alignments of icon_view to the position specified by path. 1078 * row_align determines where the row is placed, and col_align determines 1079 * where column is placed. Both are expected to be between 0.0 and 1.0. 1080 * 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means 1081 * center. 1082 * If use_align is FALSE, then the alignment arguments are ignored, and the 1083 * tree does the minimum amount of work to scroll the item onto the screen. 1084 * This means that the item will be scrolled to the edge closest to its current 1085 * position. If the item is currently visible on the screen, nothing is done. 1086 * This function only works if the model is set, and path is a valid row on 1087 * the model. If the model changes before the icon_view is realized, the 1088 * centered path will be modified to reflect this change. 1089 * Since 2.8 1090 * Params: 1091 * path = The path of the item to move to. 1092 * useAlign = whether to use alignment arguments, or FALSE. 1093 * rowAlign = The vertical alignment of the item specified by path. 1094 * colAlign = The horizontal alignment of the item specified by path. 1095 */ 1096 public void scrollToPath(TreePath path, int useAlign, float rowAlign, float colAlign) 1097 { 1098 // void gtk_icon_view_scroll_to_path (GtkIconView *icon_view, GtkTreePath *path, gboolean use_align, gfloat row_align, gfloat col_align); 1099 gtk_icon_view_scroll_to_path(gtkIconView, (path is null) ? null : path.getTreePathStruct(), useAlign, rowAlign, colAlign); 1100 } 1101 1102 /** 1103 * Sets start_path and end_path to be the first and last visible path. 1104 * Note that there may be invisible paths in between. 1105 * Both paths should be freed with gtk_tree_path_free() after use. 1106 * Since 2.8 1107 * Params: 1108 * startPath = Return location for start of region, 1109 * or NULL. [out][allow-none] 1110 * endPath = Return location for end of region, or NULL. [out][allow-none] 1111 * Returns: TRUE, if valid paths were placed in start_path and end_path 1112 */ 1113 public int getVisibleRange(out TreePath startPath, out TreePath endPath) 1114 { 1115 // gboolean gtk_icon_view_get_visible_range (GtkIconView *icon_view, GtkTreePath **start_path, GtkTreePath **end_path); 1116 GtkTreePath* outstartPath = null; 1117 GtkTreePath* outendPath = null; 1118 1119 auto p = gtk_icon_view_get_visible_range(gtkIconView, &outstartPath, &outendPath); 1120 1121 startPath = ObjectG.getDObject!(TreePath)(outstartPath); 1122 endPath = ObjectG.getDObject!(TreePath)(outendPath); 1123 return p; 1124 } 1125 1126 /** 1127 * Sets the tip area of tooltip to be the area covered by the item at path. 1128 * See also gtk_icon_view_set_tooltip_column() for a simpler alternative. 1129 * See also gtk_tooltip_set_tip_area(). 1130 * Since 2.12 1131 * Params: 1132 * tooltip = a GtkTooltip 1133 * path = a GtkTreePath 1134 */ 1135 public void setTooltipItem(Tooltip tooltip, TreePath path) 1136 { 1137 // void gtk_icon_view_set_tooltip_item (GtkIconView *icon_view, GtkTooltip *tooltip, GtkTreePath *path); 1138 gtk_icon_view_set_tooltip_item(gtkIconView, (tooltip is null) ? null : tooltip.getTooltipStruct(), (path is null) ? null : path.getTreePathStruct()); 1139 } 1140 1141 /** 1142 * Sets the tip area of tooltip to the area which cell occupies in 1143 * the item pointed to by path. See also gtk_tooltip_set_tip_area(). 1144 * See also gtk_icon_view_set_tooltip_column() for a simpler alternative. 1145 * Since 2.12 1146 * Params: 1147 * tooltip = a GtkTooltip 1148 * path = a GtkTreePath 1149 * cell = a GtkCellRenderer or NULL. [allow-none] 1150 */ 1151 public void setTooltipCell(Tooltip tooltip, TreePath path, CellRenderer cell) 1152 { 1153 // void gtk_icon_view_set_tooltip_cell (GtkIconView *icon_view, GtkTooltip *tooltip, GtkTreePath *path, GtkCellRenderer *cell); 1154 gtk_icon_view_set_tooltip_cell(gtkIconView, (tooltip is null) ? null : tooltip.getTooltipStruct(), (path is null) ? null : path.getTreePathStruct(), (cell is null) ? null : cell.getCellRendererStruct()); 1155 } 1156 1157 /** 1158 * This function is supposed to be used in a "query-tooltip" 1159 * signal handler for GtkIconView. The x, y and keyboard_tip values 1160 * which are received in the signal handler, should be passed to this 1161 * function without modification. 1162 * The return value indicates whether there is an icon view item at the given 1163 * coordinates (TRUE) or not (FALSE) for mouse tooltips. For keyboard 1164 * tooltips the item returned will be the cursor item. When TRUE, then any of 1165 * model, path and iter which have been provided will be set to point to 1166 * that row and the corresponding model. x and y will always be converted 1167 * to be relative to icon_view's bin_window if keyboard_tooltip is FALSE. 1168 * Since 2.12 1169 * Params: 1170 * x = the x coordinate (relative to widget coordinates). [inout] 1171 * y = the y coordinate (relative to widget coordinates). [inout] 1172 * keyboardTip = whether this is a keyboard tooltip or not 1173 * model = a pointer to receive a 1174 * GtkTreeModel or NULL. [out][allow-none][transfer none] 1175 * path = a pointer to receive a GtkTreePath or NULL. [out][allow-none] 1176 * iter = a pointer to receive a GtkTreeIter or NULL. [out][allow-none] 1177 * Returns: whether or not the given tooltip context points to a item 1178 */ 1179 public int getTooltipContext(ref int x, ref int y, int keyboardTip, out TreeModelIF model, out TreePath path, TreeIter iter) 1180 { 1181 // gboolean gtk_icon_view_get_tooltip_context (GtkIconView *icon_view, gint *x, gint *y, gboolean keyboard_tip, GtkTreeModel **model, GtkTreePath **path, GtkTreeIter *iter); 1182 GtkTreeModel* outmodel = null; 1183 GtkTreePath* outpath = null; 1184 1185 auto p = gtk_icon_view_get_tooltip_context(gtkIconView, &x, &y, keyboardTip, &outmodel, &outpath, (iter is null) ? null : iter.getTreeIterStruct()); 1186 1187 model = ObjectG.getDObject!(TreeModel, TreeModelIF)(outmodel); 1188 path = ObjectG.getDObject!(TreePath)(outpath); 1189 return p; 1190 } 1191 1192 /** 1193 * If you only plan to have simple (text-only) tooltips on full items, you 1194 * can use this function to have GtkIconView handle these automatically 1195 * for you. column should be set to the column in icon_view's model 1196 * containing the tooltip texts, or -1 to disable this feature. 1197 * When enabled, "has-tooltip" will be set to TRUE and 1198 * icon_view will connect a "query-tooltip" signal handler. 1199 * Note that the signal handler sets the text with gtk_tooltip_set_markup(), 1200 * so , <, etc have to be escaped in the text. 1201 * Since 2.12 1202 * Params: 1203 * column = an integer, which is a valid column number for icon_view's model 1204 */ 1205 public void setTooltipColumn(int column) 1206 { 1207 // void gtk_icon_view_set_tooltip_column (GtkIconView *icon_view, gint column); 1208 gtk_icon_view_set_tooltip_column(gtkIconView, column); 1209 } 1210 1211 /** 1212 * Returns the column of icon_view's model which is being used for 1213 * displaying tooltips on icon_view's rows. 1214 * Since 2.12 1215 * Returns: the index of the tooltip column that is currently being used, or -1 if this is disabled. 1216 */ 1217 public int getTooltipColumn() 1218 { 1219 // gint gtk_icon_view_get_tooltip_column (GtkIconView *icon_view); 1220 return gtk_icon_view_get_tooltip_column(gtkIconView); 1221 } 1222 1223 /** 1224 * Gets the row in which the item path is currently 1225 * displayed. Row numbers start at 0. 1226 * Since 2.22 1227 * Params: 1228 * path = the GtkTreePath of the item 1229 * Returns: The row in which the item is displayed 1230 */ 1231 public int getItemRow(TreePath path) 1232 { 1233 // gint gtk_icon_view_get_item_row (GtkIconView *icon_view, GtkTreePath *path); 1234 return gtk_icon_view_get_item_row(gtkIconView, (path is null) ? null : path.getTreePathStruct()); 1235 } 1236 1237 /** 1238 * Gets the column in which the item path is currently 1239 * displayed. Column numbers start at 0. 1240 * Since 2.22 1241 * Params: 1242 * path = the GtkTreePath of the item 1243 * Returns: The column in which the item is displayed 1244 */ 1245 public int getItemColumn(TreePath path) 1246 { 1247 // gint gtk_icon_view_get_item_column (GtkIconView *icon_view, GtkTreePath *path); 1248 return gtk_icon_view_get_item_column(gtkIconView, (path is null) ? null : path.getTreePathStruct()); 1249 } 1250 1251 /** 1252 * Turns icon_view into a drag source for automatic DND. Calling this 1253 * method sets "reorderable" to FALSE. 1254 * Since 2.8 1255 * Params: 1256 * startButtonMask = Mask of allowed buttons to start drag 1257 * targets = the table of targets that the drag will 1258 * support. [array length=n_targets] 1259 * actions = the bitmask of possible actions for a drag from this 1260 * widget 1261 */ 1262 public void enableModelDragSource(GdkModifierType startButtonMask, GtkTargetEntry[] targets, GdkDragAction actions) 1263 { 1264 // void gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view, GdkModifierType start_button_mask, const GtkTargetEntry *targets, gint n_targets, GdkDragAction actions); 1265 gtk_icon_view_enable_model_drag_source(gtkIconView, startButtonMask, targets.ptr, cast(int) targets.length, actions); 1266 } 1267 1268 /** 1269 * Turns icon_view into a drop destination for automatic DND. Calling this 1270 * method sets "reorderable" to FALSE. 1271 * Since 2.8 1272 * Params: 1273 * targets = the table of targets that the drag will 1274 * support. [array length=n_targets] 1275 * actions = the bitmask of possible actions for a drag to this 1276 * widget 1277 */ 1278 public void enableModelDragDest(GtkTargetEntry[] targets, GdkDragAction actions) 1279 { 1280 // void gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view, const GtkTargetEntry *targets, gint n_targets, GdkDragAction actions); 1281 gtk_icon_view_enable_model_drag_dest(gtkIconView, targets.ptr, cast(int) targets.length, actions); 1282 } 1283 1284 /** 1285 * Undoes the effect of gtk_icon_view_enable_model_drag_source(). Calling this 1286 * method sets "reorderable" to FALSE. 1287 * Since 2.8 1288 */ 1289 public void unsetModelDragSource() 1290 { 1291 // void gtk_icon_view_unset_model_drag_source (GtkIconView *icon_view); 1292 gtk_icon_view_unset_model_drag_source(gtkIconView); 1293 } 1294 1295 /** 1296 * Undoes the effect of gtk_icon_view_enable_model_drag_dest(). Calling this 1297 * method sets "reorderable" to FALSE. 1298 * Since 2.8 1299 */ 1300 public void unsetModelDragDest() 1301 { 1302 // void gtk_icon_view_unset_model_drag_dest (GtkIconView *icon_view); 1303 gtk_icon_view_unset_model_drag_dest(gtkIconView); 1304 } 1305 1306 /** 1307 * This function is a convenience function to allow you to reorder models that 1308 * support the GtkTreeDragSourceIface and the GtkTreeDragDestIface. Both 1309 * GtkTreeStore and GtkListStore support these. If reorderable is TRUE, then 1310 * the user can reorder the model by dragging and dropping rows. The 1311 * developer can listen to these changes by connecting to the model's 1312 * row_inserted and row_deleted signals. The reordering is implemented by setting up 1313 * the icon view as a drag source and destination. Therefore, drag and 1314 * drop can not be used in a reorderable view for any other purpose. 1315 * This function does not give you any degree of control over the order -- any 1316 * reordering is allowed. If more control is needed, you should probably 1317 * handle drag and drop manually. 1318 * Since 2.8 1319 * Params: 1320 * reorderable = TRUE, if the list of items can be reordered. 1321 */ 1322 public void setReorderable(int reorderable) 1323 { 1324 // void gtk_icon_view_set_reorderable (GtkIconView *icon_view, gboolean reorderable); 1325 gtk_icon_view_set_reorderable(gtkIconView, reorderable); 1326 } 1327 1328 /** 1329 * Retrieves whether the user can reorder the list via drag-and-drop. 1330 * See gtk_icon_view_set_reorderable(). 1331 * Since 2.8 1332 * Returns: TRUE if the list can be reordered. 1333 */ 1334 public int getReorderable() 1335 { 1336 // gboolean gtk_icon_view_get_reorderable (GtkIconView *icon_view); 1337 return gtk_icon_view_get_reorderable(gtkIconView); 1338 } 1339 1340 /** 1341 * Sets the item that is highlighted for feedback. 1342 * Since 2.8 1343 * Params: 1344 * path = The path of the item to highlight, or NULL. [allow-none] 1345 * pos = Specifies where to drop, relative to the item 1346 */ 1347 public void setDragDestItem(TreePath path, GtkIconViewDropPosition pos) 1348 { 1349 // void gtk_icon_view_set_drag_dest_item (GtkIconView *icon_view, GtkTreePath *path, GtkIconViewDropPosition pos); 1350 gtk_icon_view_set_drag_dest_item(gtkIconView, (path is null) ? null : path.getTreePathStruct(), pos); 1351 } 1352 1353 /** 1354 * Gets information about the item that is highlighted for feedback. 1355 * Since 2.8 1356 * Params: 1357 * path = Return location for the path of 1358 * the highlighted item, or NULL. [out][allow-none] 1359 * pos = Return location for the drop position, or NULL. [out][allow-none] 1360 */ 1361 public void getDragDestItem(out TreePath path, out GtkIconViewDropPosition pos) 1362 { 1363 // void gtk_icon_view_get_drag_dest_item (GtkIconView *icon_view, GtkTreePath **path, GtkIconViewDropPosition *pos); 1364 GtkTreePath* outpath = null; 1365 1366 gtk_icon_view_get_drag_dest_item(gtkIconView, &outpath, &pos); 1367 1368 path = ObjectG.getDObject!(TreePath)(outpath); 1369 } 1370 1371 /** 1372 * Determines the destination item for a given position. 1373 * Since 2.8 1374 * Params: 1375 * dragX = the position to determine the destination item for 1376 * dragY = the position to determine the destination item for 1377 * path = Return location for the path of the item, 1378 * or NULL. [out][allow-none] 1379 * pos = Return location for the drop position, or NULL. [out][allow-none] 1380 * Returns: whether there is an item at the given position. 1381 */ 1382 public int getDestItemAtPos(int dragX, int dragY, out TreePath path, out GtkIconViewDropPosition pos) 1383 { 1384 // gboolean gtk_icon_view_get_dest_item_at_pos (GtkIconView *icon_view, gint drag_x, gint drag_y, GtkTreePath **path, GtkIconViewDropPosition *pos); 1385 GtkTreePath* outpath = null; 1386 1387 auto p = gtk_icon_view_get_dest_item_at_pos(gtkIconView, dragX, dragY, &outpath, &pos); 1388 1389 path = ObjectG.getDObject!(TreePath)(outpath); 1390 return p; 1391 } 1392 1393 /** 1394 * Creates a cairo_surface_t representation of the item at path. 1395 * This image is used for a drag icon. 1396 * Since 2.8 1397 * Params: 1398 * path = a GtkTreePath in icon_view 1399 * Returns: a newly-allocated surface of the drag icon. [transfer full] 1400 */ 1401 public Surface createDragIcon(TreePath path) 1402 { 1403 // cairo_surface_t * gtk_icon_view_create_drag_icon (GtkIconView *icon_view, GtkTreePath *path); 1404 auto p = gtk_icon_view_create_drag_icon(gtkIconView, (path is null) ? null : path.getTreePathStruct()); 1405 1406 if(p is null) 1407 { 1408 return null; 1409 } 1410 1411 return ObjectG.getDObject!(Surface)(cast(cairo_surface_t*) p); 1412 } 1413 }