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