gtk.icon_view

Module for [IconView] class

Types 3

[gtk.icon_view.IconView] is a widget which displays data in a grid of icons.

[gtk.icon_view.IconView] provides an alternative view on a [gtk.tree_model.TreeModel]. It displays the model as a grid of icons with labels. Like [gtk.tree_view.TreeView], it allows to select one or multiple items (depending on the selection mode, see [gtk.icon_view.IconView.setSelectionMode]). In addition to selection with the arrow keys, [gtk.icon_view.IconView] supports rubberband selection, which is controlled by dragging the pointer.

Note that if the tree model is backed by an actual tree store (as opposed to a flat list where the mapping to icons is obvious), [gtk.icon_view.IconView] will only display the first level of the tree and ignore the tree’s branches.

CSS nodes

iconview.view
╰── [rubberband]

[gtk.icon_view.IconView] has a single CSS node with name iconview and style class .view. For rubberband selection, a subnode with name rubberband is used.

Deprecated

Use [gtk.grid_view.GridView] instead
Methods
GType _gType() @property
IconView self()Returns `this`, for use in `with` statements.
IconViewGidBuilder builder()Get builder for [gtk.icon_view.IconView] Returns: New builder object
bool activateOnSingleClick() @propertyGet `activateOnSingleClick` property. Returns: The activate-on-single-click property specifies whether the "item-activated" signal will be emitted after a single click.
void activateOnSingleClick(bool propval) @propertySet `activateOnSingleClick` property. Params: propval = The activate-on-single-click property specifies whether the "item-activated" signal will be emitted after a single click.
gtk.cell_area.CellArea cellArea() @propertyGet `cellArea` property. Returns: The [gtk.cell_area.CellArea] used to layout cell renderers for this view.
int columnSpacing() @propertyGet `columnSpacing` property. Returns: The column-spacing property specifies the space which is inserted between the columns of the icon view.
void columnSpacing(int propval) @propertySet `columnSpacing` property. Params: propval = The column-spacing property specifies the space which is inserted between the columns of the icon view.
int columns() @propertyGet `columns` property. Returns: The columns property contains the number of the columns in which the items should be displayed. If it is -1, the number of columns will be chosen automatically to f...
void columns(int propval) @propertySet `columns` property. Params: propval = The columns property contains the number of the columns in which the items should be displayed. If it is -1, the number of columns will be chosen automatic...
gtk.types.Orientation itemOrientation() @propertyGet `itemOrientation` property. Returns: The item-orientation property specifies how the cells (i.e. the icon and the text) of the item are positioned relative to each other.
void itemOrientation(gtk.types.Orientation propval) @propertySet `itemOrientation` property. Params: propval = The item-orientation property specifies how the cells (i.e. the icon and the text) of the item are positioned relative to each other.
int itemPadding() @propertyGet `itemPadding` property. Returns: The item-padding property specifies the padding around each of the icon view's item.
void itemPadding(int propval) @propertySet `itemPadding` property. Params: propval = The item-padding property specifies the padding around each of the icon view's item.
int itemWidth() @propertyGet `itemWidth` property. Returns: The item-width property specifies the width to use for each item. If it is set to -1, the icon view will automatically determine a suitable item size.
void itemWidth(int propval) @propertySet `itemWidth` property. Params: propval = The item-width property specifies the width to use for each item. If it is set to -1, the icon view will automatically determine a suitable item size.
int markupColumn() @propertyGet `markupColumn` property. Returns: The ::markup-column property contains the number of the model column containing markup information to be displayed. The markup column must be of type `GTYPESTR...
void markupColumn(int propval) @propertySet `markupColumn` property. Params: propval = The ::markup-column property contains the number of the model column containing markup information to be displayed. The markup column must be of type ...
void model(gtk.tree_model.TreeModel propval) @property
int pixbufColumn() @propertyGet `pixbufColumn` property. Returns: The ::pixbuf-column property contains the number of the model column containing the pixbufs which are displayed. The pixbuf column must be of type `GDKTYPEPIXB...
void pixbufColumn(int propval) @propertySet `pixbufColumn` property. Params: propval = The ::pixbuf-column property contains the number of the model column containing the pixbufs which are displayed. The pixbuf column must be of type `GD...
bool reorderable() @propertyGet `reorderable` property. Returns: The reorderable property specifies if the items can be reordered by DND.
void reorderable(bool propval) @propertySet `reorderable` property. Params: propval = The reorderable property specifies if the items can be reordered by DND.
int rowSpacing() @propertyGet `rowSpacing` property. Returns: The row-spacing property specifies the space which is inserted between the rows of the icon view.
void rowSpacing(int propval) @propertySet `rowSpacing` property. Params: propval = The row-spacing property specifies the space which is inserted between the rows of the icon view.
gtk.types.SelectionMode selectionMode() @propertyGet `selectionMode` property. Returns: The ::selection-mode property specifies the selection mode of icon view. If the mode is [gtk.types.SelectionMode.Multiple], rubberband selection is enabled, f...
void selectionMode(gtk.types.SelectionMode propval) @propertySet `selectionMode` property. Params: propval = The ::selection-mode property specifies the selection mode of icon view. If the mode is [gtk.types.SelectionMode.Multiple], rubberband selection is e...
int spacing() @propertyGet `spacing` property. Returns: The spacing property specifies the space which is inserted between the cells (i.e. the icon and the text) of an item.
void spacing(int propval) @propertySet `spacing` property. Params: propval = The spacing property specifies the space which is inserted between the cells (i.e. the icon and the text) of an item.
int textColumn() @propertyGet `textColumn` property. Returns: The ::text-column property contains the number of the model column containing the texts which are displayed. The text column must be of type `GTYPESTRING`. If th...
void textColumn(int propval) @propertySet `textColumn` property. Params: propval = The ::text-column property contains the number of the model column containing the texts which are displayed. The text column must be of type `GTYPESTRIN...
int tooltipColumn() @property
void tooltipColumn(int propval) @property
gtk.icon_view.IconView newWithArea(gtk.cell_area.CellArea area)Creates a new [gtk.icon_view.IconView] widget using the specified area to layout cells inside the icons.
gtk.icon_view.IconView newWithModel(gtk.tree_model.TreeModel model)Creates a new [gtk.icon_view.IconView] widget with the model model.
gdk.paintable.Paintable createDragIcon(gtk.tree_path.TreePath path)Creates a [gdk.paintable.Paintable] representation of the item at path. This image is used for a drag icon.
void enableModelDragDest(gdk.content_formats.ContentFormats formats, gdk.types.DragAction actions)Turns iconview into a drop destination for automatic DND. Calling this method sets [gtk.iconview.IconView]:reorderable to false.
void enableModelDragSource(gdk.types.ModifierType startButtonMask, gdk.content_formats.ContentFormats formats, gdk.types.DragAction actions)Turns iconview into a drag source for automatic DND. Calling this method sets [gtk.iconview.IconView]:reorderable to false.
bool getActivateOnSingleClick()Gets the setting set by [gtk.icon_view.IconView.setActivateOnSingleClick]. Returns: true if item-activated will be emitted on a single click
bool getCellRect(gtk.tree_path.TreePath path, gtk.cell_renderer.CellRenderer cell, out gdk.rectangle.Rectangle rect)Fills the bounding rectangle in widget coordinates for the cell specified by path and cell. If cell is null the main cell area is used.
int getColumnSpacing()Returns the value of the ::column-spacing property. Returns: the space between columns
int getColumns()Returns the value of the ::columns property. Returns: the number of columns, or -1
bool getCursor(out gtk.tree_path.TreePath path, out gtk.cell_renderer.CellRenderer cell)Fills in path and cell with the current cursor path and cell. If the cursor isn’t currently set, then path will be null. If no cell currently has focus, then cell will be null.
bool getDestItemAtPos(int dragX, int dragY, out gtk.tree_path.TreePath path, out gtk.types.IconViewDropPosition pos)Determines the destination item for a given position.
void getDragDestItem(out gtk.tree_path.TreePath path, out gtk.types.IconViewDropPosition pos)Gets information about the item that is highlighted for feedback.
bool getItemAtPos(int x, int y, out gtk.tree_path.TreePath path, out gtk.cell_renderer.CellRenderer cell)Gets the path and cell for the icon at the given position.
int getItemColumn(gtk.tree_path.TreePath path)Gets the column in which the item path is currently displayed. Column numbers start at 0.
gtk.types.Orientation getItemOrientation()Returns the value of the ::item-orientation property which determines whether the labels are drawn beside the icons instead of below. Returns: the relative position of texts and icons
int getItemPadding()Returns the value of the ::item-padding property. Returns: the padding around items
int getItemRow(gtk.tree_path.TreePath path)Gets the row in which the item path is currently displayed. Row numbers start at 0.
int getItemWidth()Returns the value of the ::item-width property. Returns: the width of a single item, or -1
int getMargin()Returns the value of the ::margin property. Returns: the space at the borders
int getMarkupColumn()Returns the column with markup text for icon_view. Returns: the markup column, or -1 if it’s unset.
gtk.tree_model.TreeModel getModel()Returns the model the [gtk.iconview.IconView] is based on. Returns null if the model is unset. Returns: The currently used [gtk.treemodel.TreeModel]
gtk.tree_path.TreePath getPathAtPos(int x, int y)Gets the path for the icon at the given position.
int getPixbufColumn()Returns the column with pixbufs for icon_view. Returns: the pixbuf column, or -1 if it’s unset.
bool getReorderable()Retrieves whether the user can reorder the list via drag-and-drop. See [gtk.icon_view.IconView.setReorderable]. Returns: true if the list can be reordered.
int getRowSpacing()Returns the value of the ::row-spacing property. Returns: the space between rows
gtk.tree_path.TreePath[] getSelectedItems()Creates a list of paths of all selected items. Additionally, if you are planning on modifying the model after calling this function, you may want to convert the returned list into a list of `GtkTre...
gtk.types.SelectionMode getSelectionMode()Gets the selection mode of the icon_view. Returns: the current selection mode
int getSpacing()Returns the value of the ::spacing property. Returns: the space between cells
int getTextColumn()Returns the column with text for icon_view. Returns: the text column, or -1 if it’s unset.
int getTooltipColumn()Returns the column of iconview’s model which is being used for displaying tooltips on iconview’s rows. Returns: the index of the tooltip column that is currently being used, or -1 if this is di...
bool getTooltipContext(int x, int y, bool keyboardTip, out gtk.tree_model.TreeModel model, out gtk.tree_path.TreePath path, out gtk.tree_iter.TreeIter iter)This function is supposed to be used in a `GtkWidget::query-tooltip` signal handler for [gtk.iconview.IconView]. The `x`, `y` and keyboardtip values which are received in the signal handler, should...
bool getVisibleRange(out gtk.tree_path.TreePath startPath, out gtk.tree_path.TreePath endPath)Sets startpath and endpath to be the first and last visible path. Note that there may be invisible paths in between.
void itemActivated(gtk.tree_path.TreePath path)Activates the item determined by path.
bool pathIsSelected(gtk.tree_path.TreePath path)Returns true if the icon pointed to by path is currently selected. If path does not point to a valid location, false is returned.
void scrollToPath(gtk.tree_path.TreePath path, bool useAlign, float rowAlign, float colAlign)Moves the alignments of iconview to the position specified by path. rowalign determines where the row is placed, and col_align determines where column is placed. Both are expected to be between 0....
void selectAll()Selects all the icons. icon_view must has its selection mode set to [gtk.types.SelectionMode.Multiple].
void selectPath(gtk.tree_path.TreePath path)Selects the row at path.
void selectedForeach(gtk.types.IconViewForeachFunc func)Calls a function for each selected icon. Note that the model or selection cannot be modified from within this function.
void setActivateOnSingleClick(bool single)Causes the [gtk.icon_view.IconView]::item-activated signal to be emitted on a single click instead of a double click.
void setColumnSpacing(int columnSpacing)Sets the ::column-spacing property which specifies the space which is inserted between the columns of the icon view.
void setColumns(int columns)Sets the ::columns property which determines in how many columns the icons are arranged. If columns is -1, the number of columns will be chosen automatically to fill the available area.
void setCursor(gtk.tree_path.TreePath path, gtk.cell_renderer.CellRenderer cell, bool startEditing)Sets the current keyboard focus to be at path, and selects it. This is useful when you want to focus the user’s attention on a particular item. If cell is not null, then focus is given to the ce...
void setDragDestItem(gtk.tree_path.TreePath path, gtk.types.IconViewDropPosition pos)Sets the item that is highlighted for feedback.
void setItemOrientation(gtk.types.Orientation orientation)Sets the ::item-orientation property which determines whether the labels are drawn beside the icons instead of below.
void setItemPadding(int itemPadding)Sets the [gtk.icon_view.IconView]:item-padding property which specifies the padding around each of the icon view’s items.
void setItemWidth(int itemWidth)Sets the ::item-width property which specifies the width to use for each item. If it is set to -1, the icon view will automatically determine a suitable item size.
void setMargin(int margin)Sets the ::margin property which specifies the space which is inserted at the top, bottom, left and right of the icon view.
void setMarkupColumn(int column)Sets the column with markup information for iconview to be column. The markup column must be of type `GTYPESTRING`. If the markup column is set to something, it overrides the text column set by [gt...
void setModel(gtk.tree_model.TreeModel model = null)Sets the model for a [gtk.iconview.IconView]. If the iconview already has a model set, it will remove it before setting the new model. If model is null, then it will unset the old model.
void setPixbufColumn(int column)Sets the column with pixbufs for iconview to be column. The pixbuf column must be of type `GDKTYPE_PIXBUF`
void setReorderable(bool reorderable)This function is a convenience function to allow you to reorder models that support the [gtk.treedragsourceiface.TreeDragSourceIface] and the [gtk.treedragdestiface.TreeDragDestIface]. Both [gtk.tr...
void setRowSpacing(int rowSpacing)Sets the ::row-spacing property which specifies the space which is inserted between the rows of the icon view.
void setSelectionMode(gtk.types.SelectionMode mode)Sets the selection mode of the icon_view.
void setSpacing(int spacing)Sets the ::spacing property which specifies the space which is inserted between the cells (i.e. the icon and the text) of an item.
void setTextColumn(int column)Sets the column with text for iconview to be column. The text column must be of type `GTYPE_STRING`.
void setTooltipCell(gtk.tooltip.Tooltip tooltip, gtk.tree_path.TreePath path, gtk.cell_renderer.CellRenderer cell = null)Sets the tip area of tooltip to the area which cell occupies in the item pointed to by path. See also [gtk.tooltip.Tooltip.setTipArea].
void setTooltipColumn(int column)If you only plan to have simple (text-only) tooltips on full items, you can use this function to have [gtk.iconview.IconView] handle these automatically for you. column should be set to the column ...
void setTooltipItem(gtk.tooltip.Tooltip tooltip, gtk.tree_path.TreePath path)Sets the tip area of tooltip to be the area covered by the item at path. See also [gtk.icon_view.IconView.setTooltipColumn] for a simpler alternative. See also [gtk.tooltip.Tooltip.setTipArea].
void unselectAll()Unselects all the icons.
void unselectPath(gtk.tree_path.TreePath path)Unselects the row at path.
void unsetModelDragDest()Undoes the effect of [gtk.iconview.IconView.enableModelDragDest]. Calling this method sets [gtk.iconview.IconView]:reorderable to false.
void unsetModelDragSource()Undoes the effect of [gtk.iconview.IconView.enableModelDragSource]. Calling this method sets [gtk.iconview.IconView]:reorderable to false.
gulong connectActivateCursorItem(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == bool) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.icon_view.IconView))) && Parameters!T.length < 2)Connect to `ActivateCursorItem` signal.
gulong connectItemActivated(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.tree_path.TreePath))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.icon_view.IconView))) && Parameters!T.length < 3)Connect to `ItemActivated` signal.
gulong connectMoveCursor(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == bool) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.MovementStep))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == int))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] == bool))) && (Parameters!T.length < 4 || (ParameterStorageClassTuple!T[3] == ParameterStorageClass.none && is(Parameters!T[3] == bool))) && (Parameters!T.length < 5 || (ParameterStorageClassTuple!T[4] == ParameterStorageClass.none && is(Parameters!T[4] : gtk.icon_view.IconView))) && Parameters!T.length < 6)Connect to `MoveCursor` signal.
gulong connectSelectAll(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.icon_view.IconView))) && Parameters!T.length < 2)Connect to `SelectAll` signal.
gulong connectSelectCursorItem(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.icon_view.IconView))) && Parameters!T.length < 2)Connect to `SelectCursorItem` signal.
gulong connectSelectionChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.icon_view.IconView))) && Parameters!T.length < 2)Connect to `SelectionChanged` signal.
gulong connectToggleCursorItem(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.icon_view.IconView))) && Parameters!T.length < 2)Connect to `ToggleCursorItem` signal.
gulong connectUnselectAll(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.icon_view.IconView))) && Parameters!T.length < 2)Connect to `UnselectAll` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [gtk.iconview.IconView] widget Returns: A newly created [gtk.iconview.IconView] widget
Methods
T activateOnSingleClick(bool propval)Set `activateOnSingleClick` property. Params: propval = The activate-on-single-click property specifies whether the "item-activated" signal will be emitted after a single click. Returns: Builder in...
T cellArea(gtk.cell_area.CellArea propval)Set `cellArea` property. Params: propval = The [gtk.cell_area.CellArea] used to layout cell renderers for this view.
T columnSpacing(int propval)Set `columnSpacing` property. Params: propval = The column-spacing property specifies the space which is inserted between the columns of the icon view. Returns: Builder instance for fluent chaining
T columns(int propval)Set `columns` property. Params: propval = The columns property contains the number of the columns in which the items should be displayed. If it is -1, the number of columns will be chosen automatic...
T itemOrientation(gtk.types.Orientation propval)Set `itemOrientation` property. Params: propval = The item-orientation property specifies how the cells (i.e. the icon and the text) of the item are positioned relative to each other. Returns: Buil...
T itemPadding(int propval)Set `itemPadding` property. Params: propval = The item-padding property specifies the padding around each of the icon view's item. Returns: Builder instance for fluent chaining
T itemWidth(int propval)Set `itemWidth` property. Params: propval = The item-width property specifies the width to use for each item. If it is set to -1, the icon view will automatically determine a suitable item size. Re...
T markupColumn(int propval)Set `markupColumn` property. Params: propval = The ::markup-column property contains the number of the model column containing markup information to be displayed. The markup column must be of type ...
T pixbufColumn(int propval)Set `pixbufColumn` property. Params: propval = The ::pixbuf-column property contains the number of the model column containing the pixbufs which are displayed. The pixbuf column must be of type `GD...
T reorderable(bool propval)Set `reorderable` property. Params: propval = The reorderable property specifies if the items can be reordered by DND. Returns: Builder instance for fluent chaining
T rowSpacing(int propval)Set `rowSpacing` property. Params: propval = The row-spacing property specifies the space which is inserted between the rows of the icon view. Returns: Builder instance for fluent chaining
T selectionMode(gtk.types.SelectionMode propval)Set `selectionMode` property. Params: propval = The ::selection-mode property specifies the selection mode of icon view. If the mode is [gtk.types.SelectionMode.Multiple], rubberband selection is e...
T spacing(int propval)Set `spacing` property. Params: propval = The spacing property specifies the space which is inserted between the cells (i.e. the icon and the text) of an item. Returns: Builder instance for fluent ...
T textColumn(int propval)Set `textColumn` property. Params: propval = The ::text-column property contains the number of the model column containing the texts which are displayed. The text column must be of type `GTYPESTRIN...
T tooltipColumn(int propval)

Fluent builder for [gtk.icon_view.IconView]

Methods