Class: Gtk::IconView

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#activate_on_single_clickTrueClass

Gets the setting set by gtk_icon_view_set_activate_on_single_click().

Returns:

  • (TrueClass)

    true if item-activated will be emitted on a single click

#activate_on_single_click=(activate_on_single_click) ⇒ TrueClass

The activate-on-single-click property specifies whether the “item-activated” signal will be emitted after a single click.

Parameters:

  • activate_on_single_click (TrueClass)

Returns:

  • (TrueClass)

    activate-on-single-click

  • (TrueClass)

    activate-on-single-click

#activate_on_single_click?TrueClass

The activate-on-single-click property specifies whether the “item-activated” signal will be emitted after a single click.

Returns:

  • (TrueClass)

    activate-on-single-click

#cell_areaGtk::CellArea

The Gtk::CellArea used to layout cell renderers for this view.

If no area is specified when creating the icon view with gtk_icon_view_new_with_area() a Gtk::CellAreaBox will be used.

Returns:

#cell_area=(cell_area) ⇒ Gtk::CellArea

The Gtk::CellArea used to layout cell renderers for this view.

If no area is specified when creating the icon view with gtk_icon_view_new_with_area() a Gtk::CellAreaBox will be used.

Parameters:

Returns:

#column_spacingInteger

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

Returns:

  • (Integer)

    column-spacing

#column_spacing=(column_spacing) ⇒ Integer

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

Parameters:

  • column_spacing (Integer)

Returns:

  • (Integer)

    column-spacing

  • (Integer)

    column-spacing

#columnsInteger

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.

Returns:

  • (Integer)

    columns

#columns=(columns) ⇒ Integer

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.

Parameters:

  • columns (Integer)

Returns:

  • (Integer)

    columns

  • (Integer)

    columns

#convert_widget_to_bin_window_coords(wx, wy, bx, by) ⇒ nil

Converts widget coordinates to coordinates for the bin_window, as expected by e.g. gtk_icon_view_get_path_at_pos().

Parameters:

  • wx (Integer)

    X coordinate relative to the widget

  • wy (Integer)

    Y coordinate relative to the widget

  • bx (Integer)

    return location for bin_window X coordinate

  • by (Integer)

    return location for bin_window Y coordinate

Returns:

  • (nil)

#create_drag_icon(path) ⇒ cairo::Surface

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

Parameters:

  • path (Gtk::TreePath)

    a Gtk::TreePath in icon_view

Returns:

  • (cairo::Surface)

    a newly-allocated surface of the drag icon.

#enable_model_drag_dest(targets, n_targets, actions) ⇒ nil

Turns icon_view into a drop destination for automatic DND. Calling this method sets Gtk::IconView:reorderable to false.

Parameters:

  • targets (Array<Gtk::TargetEntry>)

    the table of targets that the drag will support

  • n_targets (Integer)

    the number of items in targets

  • actions (Gdk::DragAction)

    the bitmask of possible actions for a drag to this widget

Returns:

  • (nil)

#enable_model_drag_source(start_button_mask, targets, n_targets, actions) ⇒ nil

Turns icon_view into a drag source for automatic DND. Calling this method sets Gtk::IconView:reorderable to false.

Parameters:

  • start_button_mask (Gdk::ModifierType)

    Mask of allowed buttons to start drag

  • targets (Array<Gtk::TargetEntry>)

    the table of targets that the drag will support

  • n_targets (Integer)

    the number of items in targets

  • actions (Gdk::DragAction)

    the bitmask of possible actions for a drag from this widget

Returns:

  • (nil)

#get_cell_rect(path, cell, rect) ⇒ TrueClass

Fills the bounding rectangle in widget coordinates for the cell specified by path and cell. If cell is nil the main cell area is used.

This function is only valid if icon_view is realized.

Parameters:

  • path (Gtk::TreePath)

    a Gtk::TreePath

  • cell (Gtk::CellRenderer)

    a Gtk::CellRenderer or nil

  • rect (Gdk::Rectangle)

    rectangle to fill with cell rect

Returns:

  • (TrueClass)

    false if there is no such item, true otherwise

#get_cursor(path, cell) ⇒ TrueClass

Fills in path and cell with the current cursor path and cell. If the cursor isn’t currently set, then *path will be nil. If no cell currently has focus, then *cell will be nil.

The returned Gtk::TreePath must be freed with gtk_tree_path_free().

Parameters:

  • path (Gtk::TreePath)

    Return location for the current cursor path, or nil

  • cell (Gtk::CellRenderer)

    Return location the current focus cell, or nil

Returns:

  • (TrueClass)

    true if the cursor is set.

#get_dest_item_at_pos(drag_x, drag_y, path, pos) ⇒ TrueClass

Determines the destination item for a given position.

Parameters:

  • drag_x (Integer)

    the position to determine the destination item for

  • drag_y (Integer)

    the position to determine the destination item for

  • path (Gtk::TreePath)

    Return location for the path of the item, or nil.

  • pos (Gtk::IconViewDropPosition)

    Return location for the drop position, or nil

Returns:

  • (TrueClass)

    whether there is an item at the given position.

#get_drag_dest_item(path, pos) ⇒ nil

Gets information about the item that is highlighted for feedback.

Parameters:

  • path (Gtk::TreePath)

    Return location for the path of the highlighted item, or nil.

  • pos (Gtk::IconViewDropPosition)

    Return location for the drop position, or nil

Returns:

  • (nil)

#get_item_at_pos(x, y, path, cell) ⇒ TrueClass

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

Parameters:

  • x (Integer)

    The x position to be identified

  • y (Integer)

    The y position to be identified

  • path (Gtk::TreePath)

    Return location for the path, or nil

  • cell (Gtk::CellRenderer)

    Return location for the renderer responsible for the cell at (x, y), or nil

Returns:

  • (TrueClass)

    true if an item exists at the specified position

#get_item_column(path) ⇒ Integer

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

Parameters:

  • path (Gtk::TreePath)

    the Gtk::TreePath of the item

Returns:

  • (Integer)

    The column in which the item is displayed

#get_item_row(path) ⇒ Integer

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

Parameters:

  • path (Gtk::TreePath)

    the Gtk::TreePath of the item

Returns:

  • (Integer)

    The row in which the item is displayed

#get_path_at_pos(x, y) ⇒ Gtk::TreePath

Finds the path at the point (x, y), relative to bin_window coordinates. See gtk_icon_view_get_item_at_pos(), if you are also interested in the cell at the specified position. See gtk_icon_view_convert_widget_to_bin_window_coords() for converting widget coordinates to bin_window coordinates. to the icon or nil if no icon exists at that position.

Parameters:

  • x (Integer)

    The x position to be identified

  • y (Integer)

    The y position to be identified

Returns:

  • (Gtk::TreePath)

    The Gtk::TreePath corresponding

#get_tooltip_context(x, y, keyboard_tip, model, path, iter) ⇒ TrueClass

This function is supposed to be used in a Gtk::Widget::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.

The return value indicates whether there is an icon view item at the given coordinates (true) or not (false) for mouse tooltips. For keyboard tooltips the item returned will be the cursor item. When true, then any of model, path and iter which have been provided will be set to point to that row and the corresponding model. x and y will always be converted to be relative to icon_view’s bin_window if keyboard_tooltip is false.

Parameters:

  • x (Integer)

    the x coordinate (relative to widget coordinates)

  • y (Integer)

    the y coordinate (relative to widget coordinates)

  • keyboard_tip (TrueClass)

    whether this is a keyboard tooltip or not

  • model (Gtk::TreeModel)

    a pointer to receive a Gtk::TreeModel or nil

  • path (Gtk::TreePath)

    a pointer to receive a Gtk::TreePath or nil

  • iter (Gtk::TreeIter)

    a pointer to receive a Gtk::TreeIter or nil

Returns:

  • (TrueClass)

    whether or not the given tooltip context points to a item

#get_visible_range(start_path, end_path) ⇒ TrueClass

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

Both paths should be freed with gtk_tree_path_free() after use.

Parameters:

  • start_path (Gtk::TreePath)

    Return location for start of region, or nil

  • end_path (Gtk::TreePath)

    Return location for end of region, or nil

Returns:

  • (TrueClass)

    true, if valid paths were placed in start_path and end_path

#item_activated(path) ⇒ nil

Activates the item determined by path.

Parameters:

  • path (Gtk::TreePath)

    The Gtk::TreePath to be activated

Returns:

  • (nil)

#item_orientationGtk::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.

Returns:

#item_orientation=(item_orientation) ⇒ Gtk::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.

Parameters:

Returns:

#item_paddingInteger

The item-padding property specifies the padding around each of the icon view’s item.

Returns:

  • (Integer)

    item-padding

#item_padding=(item_padding) ⇒ Integer

The item-padding property specifies the padding around each of the icon view’s item.

Parameters:

  • item_padding (Integer)

Returns:

  • (Integer)

    item-padding

  • (Integer)

    item-padding

#item_widthInteger

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.

Returns:

  • (Integer)

    item-width

#item_width=(item_width) ⇒ Integer

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.

Parameters:

  • item_width (Integer)

Returns:

  • (Integer)

    item-width

  • (Integer)

    item-width

#marginInteger

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

Returns:

  • (Integer)

    margin

#margin=(margin) ⇒ Integer

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

Parameters:

  • margin (Integer)

Returns:

  • (Integer)

    margin

  • (Integer)

    margin

#markup_columnInteger

The ::markup-column property contains the number of the model column containing markup information to be displayed. The markup column must be of type #G_TYPE_STRING. If this property and the :text-column property are both set to column numbers, it overrides the text column. If both are set to -1, no texts are displayed.

Returns:

  • (Integer)

    markup-column

#markup_column=(markup_column) ⇒ Integer

The ::markup-column property contains the number of the model column containing markup information to be displayed. The markup column must be of type #G_TYPE_STRING. If this property and the :text-column property are both set to column numbers, it overrides the text column. If both are set to -1, no texts are displayed.

Parameters:

  • markup_column (Integer)

Returns:

  • (Integer)

    markup-column

  • (Integer)

    markup-column

#modelGtk::TreeModel

Returns model.

Returns:

#model=(model) ⇒ Gtk::TreeModel

Parameters:

Returns:

#newGtk::Widget

Creates a new Gtk::IconView widget

Returns:

  • (Gtk::Widget)

    A newly created Gtk::IconView widget

#new_with_area(area) ⇒ Gtk::Widget

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

Parameters:

  • area (Gtk::CellArea)

    the Gtk::CellArea to use to layout cells

Returns:

  • (Gtk::Widget)

    A newly created Gtk::IconView widget

#new_with_model(model) ⇒ Gtk::Widget

Creates a new Gtk::IconView widget with the model model.

Parameters:

Returns:

  • (Gtk::Widget)

    A newly created Gtk::IconView widget.

#path_is_selected(path) ⇒ TrueClass

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

Parameters:

  • path (Gtk::TreePath)

    A Gtk::TreePath to check selection on.

Returns:

  • (TrueClass)

    true if path is selected.

#pixbuf_columnInteger

The ::pixbuf-column property contains the number of the model column containing the pixbufs which are displayed. The pixbuf column must be of type #GDK_TYPE_PIXBUF. Setting this property to -1 turns off the display of pixbufs.

Returns:

  • (Integer)

    pixbuf-column

#pixbuf_column=(pixbuf_column) ⇒ Integer

The ::pixbuf-column property contains the number of the model column containing the pixbufs which are displayed. The pixbuf column must be of type #GDK_TYPE_PIXBUF. Setting this property to -1 turns off the display of pixbufs.

Parameters:

  • pixbuf_column (Integer)

Returns:

  • (Integer)

    pixbuf-column

  • (Integer)

    pixbuf-column

#reorderableTrueClass

Retrieves whether the user can reorder the list via drag-and-drop. See gtk_icon_view_set_reorderable().

Returns:

  • (TrueClass)

    true if the list can be reordered.

#reorderable=(reorderable) ⇒ TrueClass

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

Parameters:

  • reorderable (TrueClass)

Returns:

  • (TrueClass)

    reorderable

  • (TrueClass)

    reorderable

#reorderable?TrueClass

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

Returns:

  • (TrueClass)

    reorderable

#row_spacingInteger

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

Returns:

  • (Integer)

    row-spacing

#row_spacing=(row_spacing) ⇒ Integer

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

Parameters:

  • row_spacing (Integer)

Returns:

  • (Integer)

    row-spacing

  • (Integer)

    row-spacing

#scroll_to_path(path, use_align, row_align, col_align) ⇒ nil

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.

If use_align 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 icon_view is realized, the centered path will be modified to reflect this change.

Parameters:

  • path (Gtk::TreePath)

    The path of the item to move to.

  • use_align (TrueClass)

    whether to use alignment arguments, or false.

  • row_align (Gtk::gfloat)

    The vertical alignment of the item specified by path.

  • col_align (Gtk::gfloat)

    The horizontal alignment of the item specified by path.

Returns:

  • (nil)

#select_allnil

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

Returns:

  • (nil)

#select_path(path) ⇒ nil

Selects the row at path.

Parameters:

  • path (Gtk::TreePath)

    The Gtk::TreePath to be selected.

Returns:

  • (nil)

#selected_foreach(func, data) ⇒ nil

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

Parameters:

  • func (Gtk::IconViewForeachFunc)

    The function to call for each selected icon.

  • data (GObject)

    User data to pass to the function.

Returns:

  • (nil)

#selected_itemsGLib::List

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 gtk_tree_row_reference_new().

To free the return value, use:

g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);

Returns:

  • (GLib::List)

    A #GList containing a Gtk::TreePath for each selected row.

#selection_modeGtk::SelectionMode

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

Returns:

#selection_mode=(selection_mode) ⇒ Gtk::SelectionMode

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

Parameters:

Returns:

#set_cursor(path, cell, start_editing) ⇒ nil

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 nil, 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.

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

Parameters:

  • path (Gtk::TreePath)

    A Gtk::TreePath

  • cell (Gtk::CellRenderer)

    One of the cell renderers of icon_view, or nil

  • start_editing (TrueClass)

    true if the specified cell should start being edited.

Returns:

  • (nil)

#set_drag_dest_item(path, pos) ⇒ nil

Sets the item that is highlighted for feedback.

Parameters:

  • path (Gtk::TreePath)

    The path of the item to highlight, or nil.

  • pos (Gtk::IconViewDropPosition)

    Specifies where to drop, relative to the item

Returns:

  • (nil)

#set_tooltip_cell(tooltip, path, cell) ⇒ nil

Sets the tip area of tooltip to the area which cell occupies in the item pointed to by path. See also gtk_tooltip_set_tip_area().

See also gtk_icon_view_set_tooltip_column() for a simpler alternative.

Parameters:

Returns:

  • (nil)

#set_tooltip_item(tooltip, path) ⇒ nil

Sets the tip area of tooltip to be the area covered by the item at path. See also gtk_icon_view_set_tooltip_column() for a simpler alternative. See also gtk_tooltip_set_tip_area().

Parameters:

  • tooltip (Gtk::Tooltip)

    a Gtk::Tooltip

  • path (Gtk::TreePath)

    a Gtk::TreePath

Returns:

  • (nil)

#spacingInteger

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

Returns:

  • (Integer)

    spacing

#spacing=(spacing) ⇒ Integer

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

Parameters:

  • spacing (Integer)

Returns:

  • (Integer)

    spacing

  • (Integer)

    spacing

#text_columnInteger

The ::text-column property contains the number of the model column containing the texts which are displayed. The text column must be of type #G_TYPE_STRING. If this property and the :markup-column property are both set to -1, no texts are displayed.

Returns:

  • (Integer)

    text-column

#text_column=(text_column) ⇒ Integer

The ::text-column property contains the number of the model column containing the texts which are displayed. The text column must be of type #G_TYPE_STRING. If this property and the :markup-column property are both set to -1, no texts are displayed.

Parameters:

  • text_column (Integer)

Returns:

  • (Integer)

    text-column

  • (Integer)

    text-column

#tooltip_columnInteger

Returns tooltip-column.

Returns:

  • (Integer)

    tooltip-column

#tooltip_column=(tooltip_column) ⇒ Integer

Parameters:

  • tooltip_column (Integer)

Returns:

  • (Integer)

    tooltip-column

  • (Integer)

    tooltip-column

#unselect_allnil

Unselects all the icons.

Returns:

  • (nil)

#unselect_path(path) ⇒ nil

Unselects the row at path.

Parameters:

  • path (Gtk::TreePath)

    The Gtk::TreePath to be unselected.

Returns:

  • (nil)

#unset_model_drag_destnil

Undoes the effect of gtk_icon_view_enable_model_drag_dest(). Calling this method sets Gtk::IconView:reorderable to false.

Returns:

  • (nil)

#unset_model_drag_sourcenil

Undoes the effect of gtk_icon_view_enable_model_drag_source(). Calling this method sets Gtk::IconView:reorderable to false.

Returns:

  • (nil)