Crear  Editar  FrontPage  Indexes  Buscar  Cambios  History  RSS  Login

Gtk::IconView

class Gtk::IconView

Gtk::IconView provides an alternative view on a list model. 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 Gtk::IconView#selection_mode=). In addition to selection with the arrow keys, Gtk::IconView supports rubberband selection, which is controlled by dragging the pointer.

Class Methods

Gtk::IconView.new(model = nil)
Creates a new GtkIconView widget. Since2.6

Instance Methods

model
Gets the model for the icon view or nil if model is unset. Since2.6
  • Returns: The model for the icon view
model=(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 nil, then it will unset the old model. Since2.6
set_model(model)
Same as Gtk::IconView#model=. Since2.6
text_column
Gets the column with text for icon view. Since2.6
  • Returns: the column with text for icon view
text_column=(text_column)
Sets the column with text for icon view. Since2.6
  • text_column: the column with text for icon view.
  • Returns: text_column
set_text_column(text_column)
Same as Gtk::IconView#text_column=. Since2.6
  • text_column: the column with text for icon view.
  • Returns: self
markup_column
Gets the column with markup text for icon view. Since2.6
  • Returns: the markup column, or -1 if it's unset.
markup_column=(column)
Sets the column with markup information for icon view to be column. If the markup column is set to something, it overrides the text column set by Gtk::IconView#text_column=. Since2.6
  • column: A column in the currently used model(Integer)
  • Returns: column
set_markup_column(column)
Same as Gtk::IconView#markup_column=. Since2.6
  • column: A column in the currently used model(Integer)
  • Returns: self
pixbuf_column
Gets the column with pixbufs for icon view. Since2.6
  • Returns: the column with pixbufs for icon view
pixbuf_column=(column)
Sets the column with pixbufs for icon view. Since2.6
  • column: the column with pixbufs for icon view
  • Returns: column
set_pixbuf_column(column)
Same as Gtk::IconView#pixbuf_column=. Since2.6
  • column: the column with pixbufs for icon view
  • Returns: self
get_path(x, y)
Finds the path at the point (x, y), relative to widget coordinates. See Gtk::IconView#item_at_pos, if you are also interested in the cell at the specified position. Since2.6
  • x: The x position to be identified (Fixnum)
  • y: The y position to be identified (Fixnum)
  • Returns: The Gtk::TreePath corresponding to the icon or nil if no icon exists at that position.
get_path_at_pos(x, y)
Same as Gtk::IconView#get_path. Deprecated
  • x: The x position to be identified (Fixnum)
  • y: The y position to be identified (Fixnum)
  • Returns: The Gtk::TreePath corresponding to the icon or nil if no icon exists at that position.
selected_each{|iconview, path| ... }
Calls a block for each selected icon. Note that the model or selection cannot be modified from within this method. Since2.6
  • {|iconview, path| ... }: The block to call for each selected icon.
  • Returns: self
selection_mode
Gets the selection mode of the icon view. Since2.6
  • Returns: The selection mode
selection_mode=(selection_mode)
Sets the selection mode of the icon view. Since2.6
set_selection_mode(selection_mode)
Same as Gtk::IconView#selection_mode=. Since2.6
orientation
Gets the value of the ::orientation property which determines whether the labels are drawn beside the icons instead of below. Since2.6
  • Returns: the relative position of texts and icons
orientation=(orientation)
Sets the ::orientation property which determines whether the labels are drawn beside the icons instead of below. Since2.6
  • orientation: the relative position of texts and icons (Gtk::Orientation)
  • Returns: orientation
set_orientation(orientation)
Same as Gtk::IconView#orientation=. Since2.6
  • orientation: the relative position of texts and icons (Gtk::Orientation)
  • Returns: self
columns
Gets the number of columns to display. Since2.6
  • Returns: Number of columns to display
columns=(columns)
Sets the number of columns to display. Since2.6
  • columns: Number of columns to display (Integer)
  • Returns: columns
set_columns(columns)
Same as Gtk::IconView#columns=. Since2.6
  • columns: Number of columns to display (Integer)
  • Returns: self
item_width
Gets the width used for each item. Since2.6
  • Returns: The width used for each item
item_width=(item_width)
Sets the width used for each item. Since2.6
  • item_width: The width used for each item (Integer)
  • Returns: item_width
set_item_width(item_width)
Same as Gtk::IconView#item_width=. Since2.6
  • item_width: The width used for each item (Integer)
  • Returns: self
spacing
Gets the space which is inserted between cells of an item. Since2.6
  • Returns: Space which is inserted between cells of an item
spacing=(spacing)
Sets the space which is inserted between cells of an item. Since2.6
  • spacing: Space which is inserted between cells of an item (Integer)
  • Returns: spacing
set_spacing(spacing)
Same as Gtk::IconView#spacing=. Since2.6
  • spacing: Space which is inserted between cells of an item (Integer)
  • Returns: self
row_spacing
Gets the space which is inserted between grid rows. Since2.6
  • Returns: Space which is inserted between grid rows
row_spacing=(row_spacing)
Sets the space which is inserted between grid rows. Since2.6
  • row_spacing: Space which is inserted between grid rows (Integer)
  • Returns: row_spacing
set_row_spacing(row_spacing)
Same as Gtk::IconView#row_spacing=. Since2.6
  • row_spacing: Space which is inserted between grid rows (Integer)
  • Returns: self
column_spacing
Gets the space which is inserted between grid column. Since2.6
  • Returns: Space which is inserted between grid column
column_spacing=(column_spacing)
Sets the space which is inserted between grid column. Since2.6
  • column_spacing: Space which is inserted between grid column (Integer)
  • Returns: column_spacing
set_column_spacing(column_spacing)
Same as Gtk::IconView#column_spacing=. Since2.6
  • column_spacing: Space which is inserted between grid column (Integer)
  • Returns: self
margin
Gets the space which is inserted at the edges of the icon view. Since2.6
  • Returns: Space which is inserted at the edges of the icon view
margin=(margin)
Sets the space which is inserted at the edges of the icon view. Since2.6
  • margin: Space which is inserted at the edges of the icon view (Integer)
  • Returns: margin
set_margin(margin)
Same as Gtk::IconView#margin=. Since2.6
  • margin: Space which is inserted at the edges of the icon view (Integer)
  • Returns: self
select_path(path)
Selects the row at path. Since2.6
unselect_path(path)
Unselects the row at path. Since2.6
path_is_selected?(path)
Returns true if the icon pointed to by path is currently selected. If icon does not point to a valid location, false is returned. Since2.6
  • path: A Gtk::TreePath to check selection on.
  • Returns: true if path is selected, otherwise false.
selected_items
Creates an Array of paths of all selected items. Additionally, if you are planning on modifying the model after calling this method, you may want to convert the returned Array into an Array of Gtk::TreeRowReferences?. To do this, you can use Gtk::TreeRowReference.new. Since2.6
  • Returns: An Array containing a Gtk::TreePath for each selected row.
select_all
Selects all the icons. The icon view must has its selection mode set to Gtk::SELECTION_MULTIPLE. Since2.6
  • Returns: self
unselect_all
Unselects all the icons. Since2.6
  • Returns: self
item_activated(path)
Activates the item determined by path. Since2.6
activate_cursor_item
Emits "activate-cursor-item" signal. Since2.6
  • Returns: self
move_cursor(step, arg)
Emits "move-cursor" signal. Since2.6
select_cursor_item
Emits "select-cursor-item" signal. Since2.6
  • Returns: self
toggle_cursor_item
Emits "toggle-cursor-item" signal. Since2.6
  • Returns: self
create_drag_icon(path)
Creates a Gdk::Pixmap representation of the item at path. This image is used for a drag icon. Since 2.8
  • path: a Gtk::TreePath in self
  • Returns: a newly-allocated pixmap of the drag icon
enable_model_drag_source(start_button_mask, targets, actions)
Turns self into a drag source for automatic DND. Since 2.8
  • start_button_mask: Mask of allowed buttons to start drag (Gdk::ModifierType?)
  • targets: [[target1, flags1, info1], [target2, flags2, info2], ...]: an array of targets supported by the drag
  • actions: the bitmask of possible actions for a drag from this widget (Gdk::DragContext#GdkDragAction)
  • Returns: self
enable_model_drag_dest(targets, actions)
Turns icon_view into a drop destination for automatic DND. Since 2.8
  • targets: [[target1, flags1, info1], [target2, flags2, info2], ...]: an array of targets supported by the drag
  • actions: the bitmask of possible actions for a drag from this widget (Gdk::DragContext#GdkDragAction)
  • Returns: self
cursor
Gets the current 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. Since 2.8
  • Returns: [path, cell] or nil(if no cursor is set)
get_dest_item(drag_x, drag_y)
Determines the destination item for a given position. Since 2.8
  • drag_x: the position to determine the destination item for (Fixnum)
  • drag_y: the position to determine the destination item for (Fixnum)
  • Returns: [path, pos] or nil(if there is no item at the give position)
drag_dest_item
Gets information about the item that is highlighted for feedback. Since 2.8
get_item(x, y)
Finds the path at the point (x, y), relative to widget coordinates. In contrast to Gtk::IconView#path_at_pos, this function also obtains the cell at the specified position. Since 2.8
  • x: The x position to be identified (Fixnum)
  • y: The y position to be identified (Fixnum)
  • Returns: [ path, cell ]
visible_range
Returns start_path and end_path to be the first and last visible path. Note that there may be invisible paths in between. Since 2.8
  • Returns: [start_path, end_path] or nil(if invalid paths)
    • start_path: start of region, or nil
    • end_path: end of region, or nil
reorderable=(reorderable)
Convenience function to allow you to reorder models that support the Gtk::TreeDragSourceIface? and the Gtk::TreeDragDestIface?. 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. This function does not give you any degree of control over the order -- any reordering is allowed. If more control is needed, you should probably handle drag and drop manually. Since 2.8
  • reorderable: true, if the list of items can be reordered.
  • Returns: reorderable
set_reorderable=(reorderable)
Same as Gtk::IconView#reorderable=. Since 2.8
  • reorderable: true, if the list of items can be reordered.
  • Returns: self
reorderable?
Retrieves whether the user can reorder the list via drag-and-drop. See Gtk::IconView#reorderable=. Since 2.8
  • Returns: true if the list can be reordered.
scroll_to_path(path, use_align, row_align, col_align)
Moves the alignments of the 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. Since 2.8
  • path: the path of the item to move to (Gtk::TreePath)
  • use_align: whether to use alignment arguments (true or false)
  • row_align: the vertical alignment of the item specified by path (Float)
  • col_align: the horizontal alignment of the item specified by column (Float)
  • Returns: self
set_cursor(path, cell, start_editing)
Sets the current keyboard focus to be at the specified 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 in order to give keyboard focus to the widget. Please note that editing can only happen when the widget is realized. Since 2.8
  • path: the path where to set the cursor (Gtk::TreePath)
  • cell: the cell where to put the focus (Gtk::CellRenderer - or nil)
  • start_editing: whether the specified cell should start being edited (true or false)
  • Returns: self
set_drag_dest_item(path, pos)
Sets the item that is highlighted for feedback. Since 2.8
unset_model_drag_dest
Undoes the effect of Gtk::IconView#enable_model_drag_dest. Since 2.8
  • Returns: self
unset_model_drag_source
Undoes the effect of Gtk::IconView#enable_model_drag_source. Since 2.8
  • Returns: self

Properties

column-spacing: Integer (Read/Write)
Space which is inserted between grid column Since2.6
columns: Integer (Read/Write)
Number of columns to display Since2.6
item-width: Integer (Read/Write)
The width used for each item Since2.6
margin: Integer (Read/Write)
Space which is inserted at the edges of the icon view Since2.6
markup-column: Integer (Read/Write)
Model column used to retrieve the text if using Pango markup Since2.6
model: Gtk::TreeModel (Read/Write)
The model for the icon view Since2.6
orientation: Gtk::Orientation (Read/Write)
How the text and icon of each item are positioned relative to each other Since2.6
pixbuf-column: Integer (Read/Write)
Model column used to retrieve the icon pixbuf from Since2.6
row-spacing: Integer (Read/Write)
Space which is inserted between grid rows Since2.6
selection-mode: Gtk::SelectionMode (Read/Write)
The selection mode Since2.6
spacing: Integer (Read/Write)
Space which is inserted between cells of an item Since2.6
text-column: Integer (Read/Write)
Model column used to retrieve the text from Since2.6
orientation: Gtk::Orientation (Read/Write)
Defines the orientation of the icons in the view. Default: Gtk::ORIENTATION_VERTICAL. Since 2.8
reorderable: true or false (Read/Write)
View is reorderable. Default: false. Since 2.8

Style Properties

selection-box-alpha: Integer (Read)
Opacity of the selection box
selection-box-color: Gdk::Color (Read)
Color of the selection box

ChangeLog

Ultimas actualizaciones:2011/06/24 03:45:39
Clave:
Referencias:[Gtk::CellLayout] [Gtk::IconView]