IconView

gtk.IconView provides an alternative view on a gtk.TreeModel It displays the model as a grid of icons with labels. Like gtk.TreeView, it allows to select one or multiple items (depending on the selection mode, see IconView.setSelectionMode). In addition to selection with the arrow keys, gtk.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.IconView will only display the first level of the tree and ignore the tree’s branches.

CSS nodes

|[<!-- language="plain" --> iconview.view ╰── rubberband

GtkIconView has a single CSS node with name iconview and style class .view.
For rubberband selection, a subnode with name rubberband is used.
class IconView : Container , CellLayoutIF , ScrollableIF {}

Constructors

this
this(GtkIconView* gtkIconView, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new gtk.IconView widget

this
this(CellArea area)

Creates a new gtk.IconView widget using the specified area to layout cells inside the icons.

this
this(TreeModelIF model)

Creates a new gtk.IconView widget with the model model.

Members

Functions

addOnActivateCursorItem
gulong addOnActivateCursorItem(bool delegate(IconView) dlg, ConnectFlags connectFlags)

A [keybinding signal]GtkBindingSignal which gets emitted when the user activates the currently focused item.

addOnItemActivated
gulong addOnItemActivated(void delegate(TreePath, IconView) dlg, ConnectFlags connectFlags)

The ::item-activated signal is emitted when the method IconView.itemActivated is called, when the user double clicks an item with the "activate-on-single-click" property set to FALSE, or when the user single clicks an item when the "activate-on-single-click" property set to TRUE. It is also emitted when a non-editable item is selected and one of the keys: Space, Return or Enter is pressed.

addOnMoveCursor
gulong addOnMoveCursor(bool delegate(GtkMovementStep, int, IconView) dlg, ConnectFlags connectFlags)

The ::move-cursor signal is a [keybinding signal]GtkBindingSignal which gets emitted when the user initiates a cursor movement.

addOnSelectAll
gulong addOnSelectAll(void delegate(IconView) dlg, ConnectFlags connectFlags)

A [keybinding signal]GtkBindingSignal which gets emitted when the user selects all items.

addOnSelectCursorItem
gulong addOnSelectCursorItem(void delegate(IconView) dlg, ConnectFlags connectFlags)

A [keybinding signal]GtkBindingSignal which gets emitted when the user selects the item that is currently focused.

addOnSelectionChanged
gulong addOnSelectionChanged(void delegate(IconView) dlg, ConnectFlags connectFlags)

The ::selection-changed signal is emitted when the selection (i.e. the set of selected items) changes.

addOnToggleCursorItem
gulong addOnToggleCursorItem(void delegate(IconView) dlg, ConnectFlags connectFlags)

A [keybinding signal]GtkBindingSignal which gets emitted when the user toggles whether the currently focused item is selected or not. The exact effect of this depend on the selection mode.

addOnUnselectAll
gulong addOnUnselectAll(void delegate(IconView) dlg, ConnectFlags connectFlags)

A [keybinding signal]GtkBindingSignal which gets emitted when the user unselects all items.

convertWidgetToBinWindowCoords
void convertWidgetToBinWindowCoords(int wx, int wy, int bx, int by)

Converts widget coordinates to coordinates for the bin_window, as expected by e.g. IconView.getPathAtPos.

createDragIcon
Surface createDragIcon(TreePath path)

Creates a cairo_surface_t representation of the item at path. This image is used for a drag icon.

enableModelDragDest
void enableModelDragDest(TargetEntry[] targets, GdkDragAction actions)

Turns icon_view into a drop destination for automatic DND. Calling this method sets reorderable to FALSE.

enableModelDragSource
void enableModelDragSource(GdkModifierType startButtonMask, TargetEntry[] targets, GdkDragAction actions)

Turns icon_view into a drag source for automatic DND. Calling this method sets reorderable to FALSE.

getActivateOnSingleClick
bool getActivateOnSingleClick()

Gets the setting set by IconView.setActivateOnSingleClick.

getCellRect
bool getCellRect(TreePath path, CellRenderer cell, GdkRectangle 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.

getColumnSpacing
int getColumnSpacing()

Returns the value of the ::column-spacing property.

getColumns
int getColumns()

Returns the value of the ::columns property.

getCursor
bool getCursor(TreePath path, 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.

getDestItemAtPos
bool getDestItemAtPos(int dragX, int dragY, TreePath path, GtkIconViewDropPosition pos)

Determines the destination item for a given position.

getDragDestItem
void getDragDestItem(TreePath path, GtkIconViewDropPosition pos)

Gets information about the item that is highlighted for feedback.

getIconViewStruct
GtkIconView* getIconViewStruct(bool transferOwnership)

Get the main Gtk struct

getItemAtPos
bool getItemAtPos(int x, int y, TreePath path, CellRenderer cell)

Finds the path at the point (x, y), relative to bin_window coordinates. In contrast to IconView.getPathAtPos, this function also obtains the cell at the specified position. The returned path should be freed with TreePath.free. See IconView.convertWidgetToBinWindowCoords for converting widget coordinates to bin_window coordinates.

getItemColumn
int getItemColumn(TreePath path)

Gets the column in which the item path is currently displayed. Column numbers start at 0.

getItemOrientation
GtkOrientation getItemOrientation()

Returns the value of the ::item-orientation property which determines whether the labels are drawn beside the icons instead of below.

getItemPadding
int getItemPadding()

Returns the value of the ::item-padding property.

getItemRow
int getItemRow(TreePath path)

Gets the row in which the item path is currently displayed. Row numbers start at 0.

getItemWidth
int getItemWidth()

Returns the value of the ::item-width property.

getMargin
int getMargin()

Returns the value of the ::margin property.

getMarkupColumn
int getMarkupColumn()

Returns the column with markup text for icon_view.

getModel
TreeModelIF getModel()

Returns the model the gtk.IconView is based on. Returns NULL if the model is unset.

getPathAtPos
TreePath getPathAtPos(int x, int y)

Finds the path at the point (x, y), relative to bin_window coordinates. See IconView.getItemAtPos, if you are also interested in the cell at the specified position. See IconView.convertWidgetToBinWindowCoords for converting widget coordinates to bin_window coordinates.

getPixbufColumn
int getPixbufColumn()

Returns the column with pixbufs for icon_view.

getReorderable
bool getReorderable()

Retrieves whether the user can reorder the list via drag-and-drop. See IconView.setReorderable.

getRowSpacing
int getRowSpacing()

Returns the value of the ::row-spacing property.

getSelectedItems
ListG 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 gtk.TreeRowReferences To do this, you can use TreeRowReference.new.

getSelectionMode
GtkSelectionMode getSelectionMode()

Gets the selection mode of the icon_view.

getSpacing
int getSpacing()

Returns the value of the ::spacing property.

getStruct
void* getStruct()

the main Gtk struct as a void*

getTextColumn
int getTextColumn()

Returns the column with text for icon_view.

getTooltipColumn
int getTooltipColumn()

Returns the column of icon_view’s model which is being used for displaying tooltips on icon_view’s rows.

getTooltipContext
bool getTooltipContext(int x, int y, bool keyboardTip, TreeModelIF model, TreePath path, TreeIter iter)

This function is supposed to be used in a query-tooltip signal handler for gtk.IconView The x, y and keyboard_tip values which are received in the signal handler, should be passed to this function without modification.

getVisibleRange
bool getVisibleRange(TreePath startPath, TreePath endPath)

Sets start_path and end_path to be the first and last visible path. Note that there may be invisible paths in between.

itemActivated
void itemActivated(TreePath path)

Activates the item determined by path.

pathIsSelected
bool pathIsSelected(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.

scrollToPath
void scrollToPath(TreePath path, bool useAlign, float rowAlign, float colAlign)

Moves the alignments of icon_view to the position specified by path. row_align determines where the row is placed, and col_align determines where column is placed. Both are expected to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means center.

selectAll
void selectAll()

Selects all the icons. icon_view must has its selection mode set to GTK_SELECTION_MULTIPLE

selectPath
void selectPath(TreePath path)

Selects the row at path.

selectedForeach
void selectedForeach(GtkIconViewForeachFunc func, void* data)

Calls a function for each selected icon. Note that the model or selection cannot be modified from within this function.

setActivateOnSingleClick
void setActivateOnSingleClick(bool single)

Causes the item-activated signal to be emitted on a single click instead of a double click.

setColumnSpacing
void setColumnSpacing(int columnSpacing)

Sets the ::column-spacing property which specifies the space which is inserted between the columns of the icon view.

setColumns
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.

setCursor
void setCursor(TreePath path, 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 cell specified by it. Additionally, if start_editing is TRUE, then editing should be started in the specified cell.

setDragDestItem
void setDragDestItem(TreePath path, GtkIconViewDropPosition pos)

Sets the item that is highlighted for feedback.

setItemOrientation
void setItemOrientation(GtkOrientation orientation)

Sets the ::item-orientation property which determines whether the labels are drawn beside the icons instead of below.

setItemPadding
void setItemPadding(int itemPadding)

Sets the item-padding property which specifies the padding around each of the icon view’s items.

setItemWidth
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.

setMargin
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.

setMarkupColumn
void setMarkupColumn(int column)

Sets the column with markup information for icon_view to be column. The markup column must be of type G_TYPE_STRING If the markup column is set to something, it overrides the text column set by IconView.setTextColumn.

setModel
void setModel(TreeModelIF model)

Sets the model for a gtk.IconView If the icon_view 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.

setPixbufColumn
void setPixbufColumn(int column)

Sets the column with pixbufs for icon_view to be column. The pixbuf column must be of type GDK_TYPE_PIXBUF

setReorderable
void setReorderable(bool reorderable)

This function is a convenience function to allow you to reorder models that support the GtkTreeDragSourceIface and the GtkTreeDragDestIface Both gtk.TreeStore and gtk.ListStore support these. If reorderable is TRUE, then the user can reorder the model by dragging and dropping rows. The developer can listen to these changes by connecting to the model's row_inserted and row_deleted signals. The reordering is implemented by setting up the icon view as a drag source and destination. Therefore, drag and drop can not be used in a reorderable view for any other purpose.

setRowSpacing
void setRowSpacing(int rowSpacing)

Sets the ::row-spacing property which specifies the space which is inserted between the rows of the icon view.

setSelectionMode
void setSelectionMode(GtkSelectionMode mode)

Sets the selection mode of the icon_view.

setSpacing
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.

setTextColumn
void setTextColumn(int column)

Sets the column with text for icon_view to be column. The text column must be of type G_TYPE_STRING

setTooltipCell
void setTooltipCell(Tooltip tooltip, TreePath path, CellRenderer cell)

Sets the tip area of tooltip to the area which cell occupies in the item pointed to by path. See also Tooltip.setTipArea.

setTooltipColumn
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 handle these automatically for you. column should be set to the column in icon_view’s model containing the tooltip texts, or -1 to disable this feature.

setTooltipItem
void setTooltipItem(Tooltip tooltip, TreePath path)

Sets the tip area of tooltip to be the area covered by the item at path. See also IconView.setTooltipColumn for a simpler alternative. See also Tooltip.setTipArea.

unselectAll
void unselectAll()

Unselects all the icons.

unselectPath
void unselectPath(TreePath path)

Unselects the row at path.

unsetModelDragDest
void unsetModelDragDest()

Undoes the effect of IconView.enableModelDragDest. Calling this method sets reorderable to FALSE.

unsetModelDragSource
void unsetModelDragSource()

Undoes the effect of IconView.enableModelDragSource. Calling this method sets reorderable to FALSE.

Static functions

getType
GType getType()

Variables

gtkIconView
GtkIconView* gtkIconView;

the main Gtk struct

Inherited Members

From Container

gtkContainer
GtkContainer* gtkContainer;

the main Gtk struct

getContainerStruct
GtkContainer* getContainerStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

removeAll
void removeAll()

Removes all widgets from the container

getType
GType getType()
add
void add(Widget widget)

Adds widget to container. Typically used for simple containers such as gtk.Window, gtk.Frame, or gtk.Button; for more complicated layout containers such as gtk.Box or gtk.Grid, this function will pick default packing parameters that may not be correct. So consider functions such as Box.packStart and Grid.attach as an alternative to Container.add in those cases. A widget may be added to only one container at a time; you can’t place the same widget inside two different containers.

checkResize
void checkResize()
childGetProperty
void childGetProperty(Widget child, string propertyName, Value value)

Gets the value of a child property for child and container.

childGetValist
void childGetValist(Widget child, string firstPropertyName, void* varArgs)

Gets the values of one or more child properties for child and container.

childNotify
void childNotify(Widget child, string childProperty)

Emits a child-notify signal for the [child property][child-properties] child_property on the child.

childNotifyByPspec
void childNotifyByPspec(Widget child, ParamSpec pspec)

Emits a child-notify signal for the [child property][child-properties] specified by pspec on the child.

childSetProperty
void childSetProperty(Widget child, string propertyName, Value value)

Sets a child property for child and container.

childSetValist
void childSetValist(Widget child, string firstPropertyName, void* varArgs)

Sets one or more child properties for child and container.

childType
GType childType()

Returns the type of the children supported by the container.

forall
void forall(GtkCallback callback, void* callbackData)

Invokes callback on each direct child of container, including children that are considered “internal” (implementation details of the container). “Internal” children generally weren’t added by the user of the container, but were added by the container implementation itself.

foreach_
void foreach_(GtkCallback callback, void* callbackData)

Invokes callback on each non-internal child of container. See Container.forall for details on what constitutes an “internal” child. For all practical purposes, this function should iterate over precisely those child widgets that were added to the container by the application with explicit add() calls.

getBorderWidth
uint getBorderWidth()

Retrieves the border width of the container. See Container.setBorderWidth.

getChildren
ListG getChildren()

Returns the container’s non-internal children. See Container.forall for details on what constitutes an "internal" child.

getFocusChain
bool getFocusChain(ListG focusableWidgets)

Retrieves the focus chain of the container, if one has been set explicitly. If no focus chain has been explicitly set, GTK+ computes the focus chain based on the positions of the children. In that case, GTK+ stores NULL in focusable_widgets and returns FALSE.

getFocusChild
Widget getFocusChild()

Returns the current focus child widget inside container. This is not the currently focused widget. That can be obtained by calling Window.getFocus.

getFocusHadjustment
Adjustment getFocusHadjustment()

Retrieves the horizontal focus adjustment for the container. See gtk_container_set_focus_hadjustment ().

getFocusVadjustment
Adjustment getFocusVadjustment()

Retrieves the vertical focus adjustment for the container. See Container.setFocusVadjustment.

getPathForChild
WidgetPath getPathForChild(Widget child)

Returns a newly created widget path representing all the widget hierarchy from the toplevel down to and including child.

getResizeMode
GtkResizeMode getResizeMode()

Returns the resize mode for the container. See gtk_container_set_resize_mode ().

propagateDraw
void propagateDraw(Widget child, Context cr)

When a container receives a call to the draw function, it must send synthetic draw calls to all children that don’t have their own gdk.Windows This function provides a convenient way of doing this. A container, when it receives a call to its draw function, calls Container.propagateDraw once for each child, passing in the cr the container received.

remove
void remove(Widget widget)

Removes widget from container. widget must be inside container. Note that container will own a reference to widget, and that this may be the last reference held; so removing a widget from its container can destroy that widget. If you want to use widget again, you need to add a reference to it before removing it from a container, using g_object_ref(). If you don’t want to use widget again it’s usually more efficient to simply destroy it directly using Widget.destroy since this will remove it from the container and help break any circular reference count cycles.

resizeChildren
void resizeChildren()
setBorderWidth
void setBorderWidth(uint borderWidth)

Sets the border width of the container.

setFocusChain
void setFocusChain(ListG focusableWidgets)

Sets a focus chain, overriding the one computed automatically by GTK+.

setFocusChild
void setFocusChild(Widget child)

Sets, or unsets if child is NULL, the focused child of container.

setFocusHadjustment
void setFocusHadjustment(Adjustment adjustment)

Hooks up an adjustment to focus handling in a container, so when a child of the container is focused, the adjustment is scrolled to show that widget. This function sets the horizontal alignment. See ScrolledWindow.getHadjustment for a typical way of obtaining the adjustment and Container.setFocusVadjustment for setting the vertical adjustment.

setFocusVadjustment
void setFocusVadjustment(Adjustment adjustment)

Hooks up an adjustment to focus handling in a container, so when a child of the container is focused, the adjustment is scrolled to show that widget. This function sets the vertical alignment. See ScrolledWindow.getVadjustment for a typical way of obtaining the adjustment and Container.setFocusHadjustment for setting the horizontal adjustment.

setReallocateRedraws
void setReallocateRedraws(bool needsRedraws)

Sets the reallocate_redraws flag of the container to the given value.

setResizeMode
void setResizeMode(GtkResizeMode resizeMode)

Sets the resize mode for the container.

unsetFocusChain
void unsetFocusChain()

Removes a focus chain explicitly set with Container.setFocusChain.

addOnAdd
gulong addOnAdd(void delegate(Widget, Container) dlg, ConnectFlags connectFlags)
addOnCheckResize
gulong addOnCheckResize(void delegate(Container) dlg, ConnectFlags connectFlags)
addOnRemove
gulong addOnRemove(void delegate(Widget, Container) dlg, ConnectFlags connectFlags)
addOnSetFocusChild
gulong addOnSetFocusChild(void delegate(Widget, Container) dlg, ConnectFlags connectFlags)

From CellLayoutIF

getCellLayoutStruct
GtkCellLayout* getCellLayoutStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
addAttribute
void addAttribute(CellRenderer cell, string attribute, int column)

Adds an attribute mapping to the list in cell_layout.

clear
void clear()

Unsets all the mappings on all renderers on cell_layout and removes all renderers from cell_layout.

clearAttributes
void clearAttributes(CellRenderer cell)

Clears all existing attributes previously set with gtk_cell_layout_set_attributes().

getArea
CellArea getArea()

Returns the underlying gtk.CellArea which might be cell_layout if called on a gtk.CellArea or might be NULL if no gtk.CellArea is used by cell_layout.

getCells
ListG getCells()

Returns the cell renderers which have been added to cell_layout.

packEnd
void packEnd(CellRenderer cell, bool expand)

Adds the cell to the end of cell_layout. If expand is FALSE, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is TRUE.

packStart
void packStart(CellRenderer cell, bool expand)

Packs the cell into the beginning of cell_layout. If expand is FALSE, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is TRUE.

reorder
void reorder(CellRenderer cell, int position)

Re-inserts cell at position.

setCellDataFunc
void setCellDataFunc(CellRenderer cell, GtkCellLayoutDataFunc func, void* funcData, GDestroyNotify destroy)

Sets the GtkCellLayoutDataFunc to use for cell_layout.

From ScrollableIF

getScrollableStruct
GtkScrollable* getScrollableStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getBorder
bool getBorder(Border border)

Returns the size of a non-scrolling border around the outside of the scrollable. An example for this would be treeview headers. GTK+ can use this information to display overlayed graphics, like the overshoot indication, at the right position.

getHadjustment
Adjustment getHadjustment()

Retrieves the gtk.Adjustment used for horizontal scrolling.

getHscrollPolicy
GtkScrollablePolicy getHscrollPolicy()

Gets the horizontal GtkScrollablePolicy

getVadjustment
Adjustment getVadjustment()

Retrieves the gtk.Adjustment used for vertical scrolling.

getVscrollPolicy
GtkScrollablePolicy getVscrollPolicy()

Gets the vertical GtkScrollablePolicy

setHadjustment
void setHadjustment(Adjustment hadjustment)

Sets the horizontal adjustment of the GtkScrollable

setHscrollPolicy
void setHscrollPolicy(GtkScrollablePolicy policy)

Sets the GtkScrollablePolicy to determine whether horizontal scrolling should start below the minimum width or below the natural width.

setVadjustment
void setVadjustment(Adjustment vadjustment)

Sets the vertical adjustment of the GtkScrollable

setVscrollPolicy
void setVscrollPolicy(GtkScrollablePolicy policy)

Sets the GtkScrollablePolicy to determine whether vertical scrolling should start below the minimum height or below the natural height.