Graphics.UI.Gtk.ModelView.IconView

gtk3-0.14.2: Binding to the Gtk+ 3 graphical user interface library

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.UI.Gtk.ModelView.IconView

Contents

- Detail
- Class Hierarchy
- Types
- Constructors
- Methods
- Attributes
- Signals

Description

A widget which displays a list of icons in a grid

- Module available since Gtk+ version 2.6

Synopsis

- data IconView
- class ContainerClass o => IconViewClass o
- castToIconView :: GObjectClass obj => obj -> IconView
- gTypeIconView :: GType
- toIconView :: IconViewClass o => o -> IconView
- iconViewNew :: IO IconView
- iconViewNewWithModel :: TreeModelClass model => model -> IO IconView
- iconViewSetModel :: (IconViewClass self, TreeModelClass model) => self -> Maybe model -> IO ()
- iconViewGetModel :: IconViewClass self => self -> IO (Maybe TreeModel)
- iconViewSetTextColumn :: (IconViewClass self, GlibString string) => self -> ColumnId row string -> IO ()
- iconViewGetTextColumn :: (IconViewClass self, GlibString string) => self -> IO (ColumnId row string)
- iconViewSetMarkupColumn :: (IconViewClass self, GlibString markup) => self -> ColumnId row markup -> IO ()
- iconViewGetMarkupColumn :: (IconViewClass self, GlibString markup) => self -> IO (ColumnId row markup)
- iconViewSetPixbufColumn :: IconViewClass self => self -> ColumnId row Pixbuf -> IO ()
- iconViewGetPixbufColumn :: IconViewClass self => self -> IO (ColumnId row Pixbuf)
- iconViewGetPathAtPos :: IconViewClass self => self -> Int -> Int -> IO TreePath
- iconViewSelectedForeach :: IconViewClass self => self -> (TreePath -> IO ()) -> IO ()
- iconViewSetSelectionMode :: IconViewClass self => self -> SelectionMode -> IO ()
- iconViewGetSelectionMode :: IconViewClass self => self -> IO SelectionMode
- iconViewSetColumns :: IconViewClass self => self -> Int -> IO ()
- iconViewGetColumns :: IconViewClass self => self -> IO Int
- iconViewSetItemWidth :: IconViewClass self => self -> Int -> IO ()
- iconViewGetItemWidth :: IconViewClass self => self -> IO Int
- iconViewSetSpacing :: IconViewClass self => self -> Int -> IO ()
- iconViewGetSpacing :: IconViewClass self => self -> IO Int
- iconViewSetRowSpacing :: IconViewClass self => self -> Int -> IO ()
- iconViewGetRowSpacing :: IconViewClass self => self -> IO Int
- iconViewSetColumnSpacing :: IconViewClass self => self -> Int -> IO ()
- iconViewGetColumnSpacing :: IconViewClass self => self -> IO Int
- iconViewSetMargin :: IconViewClass self => self -> Int -> IO ()
- iconViewGetMargin :: IconViewClass self => self -> IO Int
- iconViewSelectPath :: IconViewClass self => self -> TreePath -> IO ()
- iconViewUnselectPath :: IconViewClass self => self -> TreePath -> IO ()
- iconViewPathIsSelected :: IconViewClass self => self -> TreePath -> IO Bool
- iconViewGetSelectedItems :: IconViewClass self => self -> IO [TreePath]
- iconViewSelectAll :: IconViewClass self => self -> IO ()
- iconViewUnselectAll :: IconViewClass self => self -> IO ()
- iconViewItemActivated :: IconViewClass self => self -> TreePath -> IO ()
- iconViewGetItemAtPos :: IconViewClass self => self -> Int -> Int -> IO (Maybe (TreePath, CellRenderer))
- iconViewSetCursor :: (IconViewClass self, CellRendererClass cell) => self -> Either TreePath cell -> Bool -> IO ()
- iconViewGetCursor :: IconViewClass self => self -> IO (TreePath, Maybe CellRenderer)
- iconViewScrollToPath :: IconViewClass self => self -> TreePath -> Bool -> Float -> Float -> IO ()
- iconViewGetVisibleRange :: IconViewClass self => self -> IO (Maybe (TreePath, TreePath))
- iconViewEnableModelDragSource :: IconViewClass self => self -> [Modifier] -> TargetList -> [DragAction] -> IO ()
- iconViewEnableModelDragDest :: IconViewClass self => self -> TargetList -> [DragAction] -> IO ()
- iconViewUnsetModelDragSource :: IconViewClass self => self -> IO ()
- iconViewUnsetModelDragDest :: IconViewClass self => self -> IO ()
- iconViewSetReorderable :: IconViewClass self => self -> Bool -> IO ()
- iconViewGetReorderable :: IconViewClass self => self -> IO Bool
- iconViewGetItemRow :: IconViewClass self => self -> TreePath -> IO Int
- iconViewGetItemColumn :: IconViewClass self => self -> TreePath -> IO Int
- iconViewSelectionMode :: IconViewClass self => Attr self SelectionMode
- iconViewTextColumn :: (IconViewClass self, GlibString string) => Attr self (ColumnId row string)
- iconViewMarkupColumn :: (IconViewClass self, GlibString markup) => Attr self (ColumnId row markup)
- iconViewPixbufColumn :: IconViewClass self => Attr self (ColumnId row Pixbuf)
- iconViewModel :: (IconViewClass self, TreeModelClass model) => ReadWriteAttr self (Maybe TreeModel) (Maybe model)
- iconViewColumns :: IconViewClass self => Attr self Int
- iconViewItemWidth :: IconViewClass self => Attr self Int
- iconViewSpacing :: IconViewClass self => Attr self Int
- iconViewRowSpacing :: IconViewClass self => Attr self Int
- iconViewColumnSpacing :: IconViewClass self => Attr self Int
- iconViewMargin :: IconViewClass self => Attr self Int
- iconViewOrientation :: IconViewClass self => Attr self Orientation
- iconViewReorderable :: IconViewClass self => Attr self Bool
- iconViewItemOrientation :: IconViewClass self => Attr self Orientation
- setIconViewScrollAdjustments :: IconViewClass self => Signal self (Adjustment -> Adjustment -> IO ())
- itemActivated :: IconViewClass self => Signal self (TreePath -> IO ())
- selectionChanged :: IconViewClass self => Signal self (IO ())

# Detail

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

# Class Hierarchy

    | GObject
    | +----Object
    | +----Widget
    | +----Container
    | +----IconView

# Types

data IconView

Instances

Eq IconView |
Ord IconView |
GObjectClass IconView |
IconViewClass IconView |
ContainerClass IconView |
WidgetClass IconView |

class ContainerClass o => IconViewClass o

Instances

IconViewClass IconView |

castToIconView :: GObjectClass obj => obj -> IconView

gTypeIconView :: GType

toIconView :: IconViewClass o => o -> IconView

# Constructors

iconViewNew :: IO IconView

Creates a new `IconView` widget

iconViewNewWithModel

Arguments

:: TreeModelClass model |
=> model | `model` - The model.
-> IO IconView |

Creates a new `IconView` widget with the model `model` and defines how to extract a string and a pixbuf from the model.

# Methods

iconViewSetModel

Arguments

:: (IconViewClass self, TreeModelClass model) |
=> self |
-> Maybe model | `model` - The model.
-> IO () |

Sets the model for a `IconView`. If the `iconView` already has a model set, it will remove it before setting the new model. If `model` is `Nothing`, then it will unset the old model.

iconViewGetModel

Arguments

:: IconViewClass self |
=> self |
-> IO (Maybe TreeModel) | returns a `TreeModel`, or `Nothing` if none is currently being used.

Returns the model the `IconView` is based on. Returns `Nothing` if the model is unset.

iconViewSetTextColumn

Arguments

:: (IconViewClass self, GlibString string) |
=> self |
-> ColumnId row string | `column` - A column in the currently used model.
-> IO () |

Sets the column of the text for entries in the `IconView`. If a markup source is set using `iconViewSetMarkupSource`, then the text source is ignored.

iconViewGetTextColumn

Arguments

:: (IconViewClass self, GlibString string) |
=> self |
-> IO (ColumnId row string) | returns the text column, or `invalidColumnId` if it's unset.

Returns the column with text for `iconView`.

iconViewSetMarkupColumn

Arguments

:: (IconViewClass self, GlibString markup) |
=> self |
-> ColumnId row markup | `column` - A column in the currently used model.
-> IO () |

Sets the column of the text for entries in the `IconView` as a markup string (see `Markup`). A text source that is set using `iconViewSetTextSource` is ignored once a markup source is set.

iconViewGetMarkupColumn

Arguments

:: (IconViewClass self, GlibString markup) |
=> self |
-> IO (ColumnId row markup) | returns the markup column, or `invalidColumnId` if it's unset.

Returns the column with markup text for `iconView`.

iconViewSetPixbufColumn

Arguments

:: IconViewClass self |
=> self |
-> ColumnId row Pixbuf | `column` - A column in the currently used model.
-> IO () |

Sets the column of the `Pixbuf` for entries in the `IconView`.

iconViewGetPixbufColumn

Arguments

:: IconViewClass self |
=> self |
-> IO (ColumnId row Pixbuf) | returns the pixbuf column, or `invalidColumnId` if it's unset.

Returns the column with pixbufs for `iconView`.

iconViewGetPathAtPos

Arguments

:: IconViewClass self |
=> self |
-> Int | `x` - The x position to be identified
-> Int | `y` - The y position to be identified
-> IO TreePath | returns The `TreePath` corresponding to the icon or `[]` if no icon exists at that position.

Finds the path at the point (`x`, `y`), relative to widget coordinates. See `iconViewGetItemAtPos`, if you are also interested in the cell at the specified position.

iconViewSelectedForeach

Arguments

:: IconViewClass self |
=> self |
-> (TreePath -> IO ()) | `(path -> ...)` - The funcion to call for each selected icon.
-> IO () |

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

iconViewSetSelectionMode

Arguments

:: IconViewClass self |
=> self |
-> SelectionMode | `mode` - The selection mode
-> IO () |

Sets the selection mode of the `iconView`.

iconViewGetSelectionMode

Arguments

:: IconViewClass self |
=> self |
-> IO SelectionMode | returns the current selection mode

Gets the selection mode of the `iconView`.

iconViewSetColumns

Arguments

:: IconViewClass self |
=> self |
-> Int | `columns` - the number of columns
-> IO () |

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.

iconViewGetColumns

Arguments

:: IconViewClass self |
=> self |
-> IO Int | returns the number of columns, or -1

Returns the value of the ::columns property.

iconViewSetItemWidth

Arguments

:: IconViewClass self |
=> self |
-> Int | `itemWidth` - the width for each item
-> IO () |

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.

iconViewGetItemWidth

Arguments

:: IconViewClass self |
=> self |
-> IO Int | returns the width of a single item, or -1

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

iconViewSetSpacing

Arguments

:: IconViewClass self |
=> self |
-> Int | `spacing` - the spacing
-> IO () |

Sets the ::spacing property which specifies the space which is inserted between the cells (i.e. the icon and the text) of an item.

iconViewGetSpacing

Arguments

:: IconViewClass self |
=> self |
-> IO Int | returns the space between cells

Returns the value of the ::spacing property.

iconViewSetRowSpacing

Arguments

:: IconViewClass self |
=> self |
-> Int | `rowSpacing` - the row spacing
-> IO () |

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

iconViewGetRowSpacing

Arguments

:: IconViewClass self |
=> self |
-> IO Int | returns the space between rows

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

iconViewSetColumnSpacing

Arguments

:: IconViewClass self |
=> self |
-> Int | `columnSpacing` - the column spacing
-> IO () |

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

iconViewGetColumnSpacing

Arguments

:: IconViewClass self |
=> self |
-> IO Int | returns the space between columns

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

iconViewSetMargin

Arguments

:: IconViewClass self |
=> self |
-> Int | `margin` - the margin
-> IO () |

Sets the ::margin property which specifies the space which is inserted at the top, bottom, left and right of the icon view.

iconViewGetMargin

Arguments

:: IconViewClass self |
=> self |
-> IO Int | returns the space at the borders

Returns the value of the ::margin property.

iconViewSelectPath

Arguments

:: IconViewClass self |
=> self |
-> TreePath | `path` - The `TreePath` to be selected.
-> IO () |

Selects the row at `path`.

iconViewUnselectPath

Arguments

:: IconViewClass self |
=> self |
-> TreePath | `path` - The `TreePath` to be unselected.
-> IO () |

Unselects the row at `path`.

iconViewPathIsSelected

Arguments

:: IconViewClass self |
=> self |
-> TreePath | `path` - A `TreePath` to check selection on.
-> IO Bool | returns `True` if `path` is selected.

Returns `True` if the icon pointed to by `path` is currently selected. If `icon` does not point to a valid location, `False` is returned.

iconViewGetSelectedItems

Arguments

:: IconViewClass self |
=> self |
-> IO [TreePath] | returns a list of `TreePath`s, one for each selected row.

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 `TreeRowReference`s. To do this, you can use `treeRowReferenceNew`.

iconViewSelectAll :: IconViewClass self => self -> IO ()

Selects all the icons. `iconView` must has its selection mode set to `SelectionMultiple`.

iconViewUnselectAll :: IconViewClass self => self -> IO ()

Unselects all the icons.

iconViewItemActivated

Arguments

:: IconViewClass self |
=> self |
-> TreePath | `path` - The `TreePath` to be activated
-> IO () |

Activates the item determined by `path`.

iconViewGetItemAtPos

Arguments

:: IconViewClass self |
=> self |
-> Int | `x` - The x position to be identified
-> Int | `y` - The y position to be identified
-> IO (Maybe (TreePath, CellRenderer)) |

Finds the path at the point (`x`, `y`), relative to widget coordinates. In contrast to `iconViewGetPathAtPos`, this function also obtains the cell at the specified position.

- Available since Gtk+ version 2.8

iconViewSetCursor

Arguments

:: (IconViewClass self, CellRendererClass cell) |
=> self |
-> Either TreePath cell | the path or the cell
-> Bool | `startEditing` - `True` if the specified cell should start being edited.
-> IO () |

Given `Left path` as argument , 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 `Right cell` is given, then focus is given to the cell specified by it. Additionally, if `startEditing` is `True`, then editing should be started in the specified cell.

This function is often followed by `widgetGrabFocus` in order to give keyboard focus to the widget. Please note that editing can only happen when the widget is realized.

- Available since Gtk+ version 2.8

iconViewGetCursor

Arguments

:: IconViewClass self |
=> self |
-> IO (TreePath, Maybe CellRenderer) | returns a `path` to the cursor and a `cell` if the widget has the input focus

Return a `path` and a `cell` with the current cursor path and cell. If the cursor isn't currently set, then `[]` will be returned for the `path`. If no cell currently has focus, then `cell` will be `Nothing`.

- Available since Gtk+ version 2.8

iconViewScrollToPath

Arguments

:: IconViewClass self |
=> self |
-> TreePath | `path` - The path of the item to move to.
-> Bool | `useAlign` - whether to use alignment arguments, or `False`.
-> Float | `rowAlign` - The vertical alignment of the item specified by `path`.
-> Float | `colAlign` - The horizontal alignment of the item specified by `path`.
-> IO () |

Moves the alignments of `iconView` to the position specified by `path`. `rowAlign` determines where the row is placed, and `colAlign` 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.

If `useAlign` is `False`, then the alignment arguments are ignored, and the tree does the minimum amount of work to scroll the item onto the screen. This means that the item will be scrolled to the edge closest to its current position. If the item is currently visible on the screen, nothing is done.

This function only works if the model is set, and `path` is a valid row on the model. If the model changes before the `iconView` is realized, the centered path will be modified to reflect this change.

- Available since Gtk+ version 2.8

iconViewGetVisibleRange

Arguments

:: IconViewClass self |
=> self |
-> IO (Maybe (TreePath, TreePath)) | returns the first and last visible path, the return value `Nothing` if every element is visible

Retrieve the first and last visible path. Note that there may be invisible paths inbetween.

- Available since Gtk+ version 2.8

iconViewEnableModelDragSource

Arguments

:: IconViewClass self |
=> self |
-> [Modifier] | `startButtonMask` - Mask of allowed buttons to start drag
-> TargetList | `targets` - the list of targets that the the view will support
-> [DragAction] | `actions` - flags denoting the possible actions for a drag from this widget
-> IO () |

Turns `iconView` into a drag source for automatic DND.

- Available since Gtk+ version 2.10

iconViewEnableModelDragDest

Arguments

:: IconViewClass self |
=> self |
-> TargetList | `targets` - the list of targets that the the view will support
-> [DragAction] | `actions` - flags denoting the possible actions for a drop into this widget
-> IO () |

Turns `iconView` into a drop destination for automatic DND.

- Available since Gtk+ version 2.10

iconViewUnsetModelDragSource :: IconViewClass self => self -> IO ()

Undoes the effect of `iconViewEnableModelDragSource`.

- Available since Gtk+ version 2.10

iconViewUnsetModelDragDest :: IconViewClass self => self -> IO ()

Undoes the effect of `iconViewEnableModelDragDest`.

- Available since Gtk+ version 2.10

iconViewSetReorderable

Arguments

:: IconViewClass self |
=> self |
-> Bool | `reorderable` - `True`, if the list of items can be reordered.
-> IO () |

Check if icons can be moved around.

- Set whether the user can use drag and drop (DND) to reorder the rows in the store. This works on both `TreeStore` and `ListStore` models. If `ro` 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 signals. If you need to control which rows may be dragged or where rows may be dropped, you can override the `treeDragSourceRowDraggable` function in the default DND implementation of the model.
- Available since Gtk+ version 2.8

iconViewGetReorderable

Arguments

:: IconViewClass self |
=> self |
-> IO Bool | returns `True` if the list can be reordered.

Retrieves whether the user can reorder the list via drag-and-drop. See `iconViewSetReorderable`.

- Available since Gtk+ version 2.8

iconViewGetItemRow

Arguments

:: IconViewClass self |
=> self |
-> TreePath | `path` the `TreePath` of the item
-> IO Int | returns The row in which the item is displayed

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

- Available since Gtk+ version 2.22

iconViewGetItemColumn

Arguments

:: IconViewClass self |
=> self |
-> TreePath | `path` the `TreePath` of the item
-> IO Int | returns The column in which the item is displayed

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

- Available since Gtk+ version 2.22

# Attributes

iconViewSelectionMode :: IconViewClass self => Attr self SelectionMode

The ::selection-mode property specifies the selection mode of icon view. If the mode is `SelectionMultiple`, rubberband selection is enabled, for the other modes, only keyboard selection is possible.

Default value: `SelectionSingle`

iconViewTextColumn :: (IconViewClass self, GlibString string) => Attr self (ColumnId row string)

The `iconViewTextColumn` property contains the number of the model column containing the texts which are displayed. If this property and the `iconViewMarkupColumn` property are both set to `invalidColumnId`, no texts are displayed.

Default value: `invalidColumnId`

iconViewMarkupColumn :: (IconViewClass self, GlibString markup) => Attr self (ColumnId row markup)

The `iconViewMarkupColumn` property contains the number of the model column containing markup information to be displayed. If this property and the `iconViewTextColumn` property are both set to column numbers, it overrides the text column. If both are set to `invalidColumnId`, no texts are displayed.

Default value: `invalidColumnId`

iconViewPixbufColumn :: IconViewClass self => Attr self (ColumnId row Pixbuf)

The `iconViewPixbufColumn` property contains the number of the model column containing the pixbufs which are displayed. Setting this property to `invalidColumnId` turns off the display of pixbufs.

Default value: `invalidColumnId`

iconViewModel :: (IconViewClass self, TreeModelClass model) => ReadWriteAttr self (Maybe TreeModel) (Maybe model)

The model for the icon view.

iconViewColumns :: IconViewClass self => Attr self Int

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 fill the available area.

Allowed values: >= -1

Default value: -1

iconViewItemWidth :: IconViewClass self => Attr self Int

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.

Allowed values: >= -1

Default value: -1

iconViewSpacing :: IconViewClass self => Attr self Int

The spacing property specifies the space which is inserted between the cells (i.e. the icon and the text) of an item.

Allowed values: >= 0

Default value: 0

iconViewRowSpacing :: IconViewClass self => Attr self Int

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

Allowed values: >= 0

Default value: 6

iconViewColumnSpacing :: IconViewClass self => Attr self Int

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

Allowed values: >= 0

Default value: 6

iconViewMargin :: IconViewClass self => Attr self Int

The margin property specifies the space which is inserted at the edges of the icon view.

Allowed values: >= 0

Default value: 6

iconViewOrientation :: IconViewClass self => Attr self Orientation

The orientation property specifies how the cells (i.e. the icon and the text) of the item are positioned relative to each other.

Default value: `OrientationVertical`

iconViewReorderable :: IconViewClass self => Attr self Bool

The reorderable property specifies if the items can be reordered by DND.

Default value: `False`

- Available since Gtk+ version 2.8

iconViewItemOrientation :: IconViewClass self => Attr self Orientation

The item-orientation property specifies how the cells (i.e. the icon and the text) of the item are positioned relative to each other.

Default value: `OrientationVertical`

- Available since Gtk+ version 2.22

# Signals

setIconViewScrollAdjustments :: IconViewClass self => Signal self (Adjustment -> Adjustment -> IO ())

New scroll adjustment have been set for this widget.

itemActivated :: IconViewClass self => Signal self (TreePath -> IO ())

A specific element has been activated (by pressing enter or double clicking).

selectionChanged :: IconViewClass self => Signal self (IO ())

The selected item changed.