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