switch (prop_id)
{ case PROP_SELECTION_MODE:
gtk_icon_view_set_selection_mode (icon_view, g_value_get_enum (value)); break; case PROP_PIXBUF_COLUMN:
gtk_icon_view_set_pixbuf_column (icon_view, g_value_get_int (value)); break; case PROP_TEXT_COLUMN:
gtk_icon_view_set_text_column (icon_view, g_value_get_int (value)); break; case PROP_MARKUP_COLUMN:
gtk_icon_view_set_markup_column (icon_view, g_value_get_int (value)); break; case PROP_MODEL:
gtk_icon_view_set_model (icon_view, g_value_get_object (value)); break; case PROP_ITEM_ORIENTATION:
gtk_icon_view_set_item_orientation (icon_view, g_value_get_enum (value)); break; case PROP_COLUMNS:
gtk_icon_view_set_columns (icon_view, g_value_get_int (value)); break; case PROP_ITEM_WIDTH:
gtk_icon_view_set_item_width (icon_view, g_value_get_int (value)); break; case PROP_SPACING:
gtk_icon_view_set_spacing (icon_view, g_value_get_int (value)); break; case PROP_ROW_SPACING:
gtk_icon_view_set_row_spacing (icon_view, g_value_get_int (value)); break; case PROP_COLUMN_SPACING:
gtk_icon_view_set_column_spacing (icon_view, g_value_get_int (value)); break; case PROP_MARGIN:
gtk_icon_view_set_margin (icon_view, g_value_get_int (value)); break; case PROP_REORDERABLE:
gtk_icon_view_set_reorderable (icon_view, g_value_get_boolean (value)); break;
case PROP_TOOLTIP_COLUMN:
gtk_icon_view_set_tooltip_column (icon_view, g_value_get_int (value)); break;
case PROP_ITEM_PADDING:
gtk_icon_view_set_item_padding (icon_view, g_value_get_int (value)); break;
case PROP_ACTIVATE_ON_SINGLE_CLICK:
gtk_icon_view_set_activate_on_single_click (icon_view, g_value_get_boolean (value)); break;
case PROP_CELL_AREA: /* Construct-only, can only be assigned once */
area = g_value_get_object (value); if (area)
{ if (icon_view->priv->cell_area != NULL)
{
g_warning ("cell-area has already been set, ignoring construct property");
g_object_ref_sink (area);
g_object_unref (area);
} else
gtk_icon_view_ensure_cell_area (icon_view, area);
} break;
case PROP_HADJUSTMENT:
gtk_icon_view_set_hadjustment (icon_view, g_value_get_object (value)); break; case PROP_VADJUSTMENT:
gtk_icon_view_set_vadjustment (icon_view, g_value_get_object (value)); break; case PROP_HSCROLL_POLICY: if (icon_view->priv->hscroll_policy != g_value_get_enum (value))
{
icon_view->priv->hscroll_policy = g_value_get_enum (value);
gtk_widget_queue_resize (GTK_WIDGET (icon_view));
g_object_notify_by_pspec (object, pspec);
} break; case PROP_VSCROLL_POLICY: if (icon_view->priv->vscroll_policy != g_value_get_enum (value))
{
icon_view->priv->vscroll_policy = g_value_get_enum (value);
gtk_widget_queue_resize (GTK_WIDGET (icon_view));
g_object_notify_by_pspec (object, pspec);
} break;
if (icon_view->priv->items && icon_view->priv->pixbuf_cell)
{ /* Here we go with the same old guess, try the icon size and set double *thesizeofthefirsticonfoundinthelist,naivebutworksmuch
* of the time */
if (for_size > 0)
{ /* This is necessary for the context to work properly */ for (items = priv->items; items; items = items->next)
{
GtkIconViewItem *item = items->data;
if (orientation == GTK_ORIENTATION_HORIZONTAL && priv->item_width >= 0)
{ if (minimum)
*minimum = MAX (*minimum, priv->item_width); if (natural)
*natural = *minimum;
}
if (minimum)
*minimum = MAX (1, *minimum + 2 * priv->item_padding); if (natural)
*natural = MAX (1, *natural + 2 * priv->item_padding);
g_object_unref (context);
}
staticvoid
gtk_icon_view_compute_n_items_for_size (GtkIconView *icon_view,
GtkOrientation orientation, int size, int *min_items, int *min_item_size, int *max_items, int *max_item_size)
{
GtkIconViewPrivate *priv = icon_view->priv; int minimum, natural, spacing;
static GtkIconViewItem *
_gtk_icon_view_get_item_at_widget_coords (GtkIconView *icon_view, int x, int y,
gboolean only_in_cell,
GtkCellRenderer **cell_at_pos)
{
x += gtk_adjustment_get_value (icon_view->priv->hadjustment);
y += gtk_adjustment_get_value (icon_view->priv->vadjustment);
return _gtk_icon_view_get_item_at_coords (icon_view, x, y,
only_in_cell, cell_at_pos);
}
staticvoid
gtk_icon_view_motion (GtkEventController *controller, double x, double y,
gpointer user_data)
{
GtkIconView *icon_view; int abs_y;
GdkDevice *device;
/* Save press to possibly begin a drag */ if (icon_view->priv->pressed_button < 0)
{
icon_view->priv->pressed_button = button;
icon_view->priv->press_start_x = x;
icon_view->priv->press_start_y = y;
}
icon_view->priv->last_single_clicked = item;
/* cancel the current editing, if it exists */
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (cell != NULL && gtk_cell_renderer_is_activatable (cell))
{
GtkCellAreaContext *context;
static gboolean
gtk_icon_view_item_hit_test (GtkIconView *icon_view,
GtkIconViewItem *item, int x, int y, int width, int height)
{
HitTestData data = { { x, y, width, height }, FALSE };
GtkCellAreaContext *context;
GdkRectangle *item_area = &item->cell_area;
if (MIN (x + width, item_area->x + item_area->width) - MAX (x, item_area->x) <= 0 ||
MIN (y + height, item_area->y + item_area->height) - MAX (y, item_area->y) <= 0) returnFALSE;
/* Clear the per row contexts */
g_ptr_array_set_size (icon_view->priv->row_contexts, 0);
gtk_cell_area_context_reset (priv->cell_area_context); /* because layouting is complicated. We designed an API *thatisO(N²)andnonsensical.
* And we're proud of it. */ for (items = priv->items; items; items = items->next)
{
_gtk_icon_view_set_cell_data (icon_view, items->data);
gtk_cell_area_get_preferred_width (priv->cell_area,
priv->cell_area_context,
widget,
NULL, NULL);
}
if (icon_view->priv->cursor_item != NULL)
gtk_icon_view_queue_draw_item (icon_view, icon_view->priv->cursor_item);
icon_view->priv->cursor_item = item;
if (cursor_cell)
gtk_cell_area_set_focus_cell (icon_view->priv->cell_area, cursor_cell); else
{ /* Make sure there is a cell in focus initially */ if (!gtk_cell_area_get_focus_cell (icon_view->priv->cell_area))
gtk_cell_area_focus (icon_view->priv->cell_area, GTK_DIR_TAB_FORWARD);
}
}
/* ignore changes in branches */ if (gtk_tree_path_get_depth (path) > 1)
return;
/* An icon view subclass might add it's own model and populate
* things at init() time instead of waiting for the constructor()
* to be called
*/ if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/* Here we can use a "grow-only" strategy for optimization
* and only invalidate a single item and queue a relayout
* instead of invalidating the whole thing.
*
* For now GtkIconView still can't deal with huge models
* so just invalidate the whole thing when the model
* changes.
*/
gtk_icon_view_invalidate_sizes (icon_view);
/* ignore changes in branches */ if (gtk_tree_path_get_depth (path) > 1)
return;
gtk_tree_model_ref_node (model, iter);
index = gtk_tree_path_get_indices(path)[0];
item = gtk_icon_view_item_new ();
item->index = index;
/* FIXME: We can be more efficient here,
we can store a tail pointer and use that when
appending (which is a rather common operation)
*/
icon_view->priv->items = g_list_insert (icon_view->priv->items,
item, index);
list = g_list_nth (icon_view->priv->items, index + 1); for (; list; list = list->next)
{
item = list->data;
order = g_new (int, length); for (i = 0; i < length; i++)
order [new_order[i]] = i;
item_array = g_new (GtkIconViewItem *, length); for (i = 0, list = icon_view->priv->items; list != NULL; list = list->next, i++)
item_array[order[i]] = list->data;
g_free (order);
for (i = length - 1; i >= 0; i--)
{
item_array[i]->index = i;
items = g_list_prepend (items, item_array[i]);
}
switch (step)
{
case GTK_MOVEMENT_LOGICAL_POSITIONS:
case GTK_MOVEMENT_VISUAL_POSITIONS:
gtk_icon_view_move_cursor_left_right (icon_view, count);
break;
case GTK_MOVEMENT_DISPLAY_LINES:
gtk_icon_view_move_cursor_up_down (icon_view, count);
break;
case GTK_MOVEMENT_PAGES:
gtk_icon_view_move_cursor_page_up_down (icon_view, count);
break;
case GTK_MOVEMENT_BUFFER_ENDS:
gtk_icon_view_move_cursor_start_end (icon_view, count);
break;
case GTK_MOVEMENT_WORDS:
case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
case GTK_MOVEMENT_PARAGRAPHS:
case GTK_MOVEMENT_PARAGRAPH_ENDS:
case GTK_MOVEMENT_HORIZONTAL_PAGES:
default:
g_assert_not_reached ();
break;
}
if (dirty)
g_signal_emit (icon_view, icon_view_signals[SELECTION_CHANGED], 0);
}
/**
* gtk_icon_view_scroll_to_path:
* @icon_view: A `GtkIconView`
* @path: The path of the item to move to.
* @use_align: whether to use alignment arguments, or %FALSE.
* @row_align: The vertical alignment of the item specified by @path.
* @col_align: The horizontal alignment of the item specified by @path.
*
* 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.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
GtkTreePath *path,
gboolean use_align,
float row_align,
float col_align)
{
GtkIconViewItem *item = NULL;
GtkWidget *widget;
/**
* gtk_icon_view_new:
*
* Creates a new `GtkIconView` widget
*
* Returns: A newly created `GtkIconView` widget
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
GtkWidget *
gtk_icon_view_new (void)
{
return g_object_new (GTK_TYPE_ICON_VIEW, NULL);
}
/**
* gtk_icon_view_new_with_area:
* @area: the `GtkCellArea` to use to layout cells
*
* Creates a new `GtkIconView` widget using the
* specified @area to layout cells inside the icons.
*
* Returns: A newly created `GtkIconView` widget
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
GtkWidget *
gtk_icon_view_new_with_area (GtkCellArea *area)
{
return g_object_new (GTK_TYPE_ICON_VIEW, "cell-area", area, NULL);
}
/**
* gtk_icon_view_new_with_model:
* @model: The model.
*
* Creates a new `GtkIconView` widget with the model @model.
*
* Returns: A newly created `GtkIconView` widget.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
GtkWidget *
gtk_icon_view_new_with_model (GtkTreeModel *model)
{
return g_object_new (GTK_TYPE_ICON_VIEW, "model", model, NULL);
}
/**
* gtk_icon_view_get_path_at_pos:
* @icon_view: A `GtkIconView`.
* @x: The x position to be identified
* @y: The y position to be identified
*
* Gets the path for the icon at the given position.
*
* Returns: (nullable) (transfer full): The `GtkTreePath` corresponding
* to the icon or %NULL if no icon exists at that position.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
GtkTreePath *
gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
int x,
int y)
{
GtkIconViewItem *item;
GtkTreePath *path;
/**
* gtk_icon_view_get_item_at_pos:
* @icon_view: A `GtkIconView`.
* @x: The x position to be identified
* @y: The y position to be identified
* @path: (out) (optional): Return location for the path
* @cell: (out) (optional) (transfer none): Return location for the renderer
* responsible for the cell at (@x, @y)
*
* Gets the path and cell for the icon at the given position.
*
* Returns: %TRUE if an item exists at the specified position
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
gboolean
gtk_icon_view_get_item_at_pos (GtkIconView *icon_view,
int x,
int y,
GtkTreePath **path,
GtkCellRenderer **cell)
{
GtkIconViewItem *item;
GtkCellRenderer *renderer = NULL;
item = _gtk_icon_view_get_item_at_coords (icon_view, x, y, TRUE, &renderer);
if (path != NULL)
{ if (item != NULL)
*path = gtk_tree_path_new_from_indices (item->index, -1); else
*path = NULL;
}
if (cell != NULL)
*cell = renderer;
return (item != NULL);
}
/**
* gtk_icon_view_get_cell_rect:
* @icon_view: a `GtkIconView`
* @path: a `GtkTreePath`
* @cell: (nullable): a `GtkCellRenderer`
* @rect: (out): rectangle to fill with cell 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.
*
* This function is only valid if @icon_view is realized.
*
* Returns: %FALSE if there is no such item, %TRUE otherwise
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
gboolean
gtk_icon_view_get_cell_rect (GtkIconView *icon_view,
GtkTreePath *path,
GtkCellRenderer *cell,
GdkRectangle *rect)
{
GtkIconViewItem *item = NULL;
/**
* gtk_icon_view_set_tooltip_item:
* @icon_view: a `GtkIconView`
* @tooltip: a `GtkTooltip`
* @path: a `GtkTreePath`
*
* 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().
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_tooltip_item (GtkIconView *icon_view,
GtkTooltip *tooltip,
GtkTreePath *path)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
g_return_if_fail (GTK_IS_TOOLTIP (tooltip));
/**
* gtk_icon_view_set_tooltip_cell:
* @icon_view: a `GtkIconView`
* @tooltip: a `GtkTooltip`
* @path: a `GtkTreePath`
* @cell: (nullable): a `GtkCellRenderer`
*
* 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.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_tooltip_cell (GtkIconView *icon_view,
GtkTooltip *tooltip,
GtkTreePath *path,
GtkCellRenderer *cell)
{
GdkRectangle rect;
if (!gtk_icon_view_get_cell_rect (icon_view, path, cell, &rect))
return;
gtk_tooltip_set_tip_area (tooltip, &rect);
}
/**
* gtk_icon_view_get_tooltip_context:
* @icon_view: an `GtkIconView`
* @x: the x coordinate (relative to widget coordinates)
* @y: the y coordinate (relative to widget coordinates)
* @keyboard_tip: whether this is a keyboard tooltip or not
* @model: (out) (optional) (transfer none): a pointer to receive a `GtkTreeModel`
* @path: (out) (optional): a pointer to receive a `GtkTreePath`
* @iter: (out) (optional): a pointer to receive a `GtkTreeIter`
*
* This function is supposed to be used in a `GtkWidget::query-tooltip`
* signal handler for `GtkIconView`. 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.
*
* Returns: whether or not the given tooltip context points to an item
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
gboolean
gtk_icon_view_get_tooltip_context (GtkIconView *icon_view,
int x,
int y,
gboolean keyboard_tip,
GtkTreeModel **model,
GtkTreePath **path,
GtkTreeIter *iter)
{
GtkTreePath *tmppath = NULL;
/**
* gtk_icon_view_set_tooltip_column:
* @icon_view: a `GtkIconView`
* @column: an integer, which is a valid column number for @icon_view’s model
*
* If you only plan to have simple (text-only) tooltips on full items, you
* can use this function to have `GtkIconView` 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.
*
* When enabled, `GtkWidget:has-tooltip` will be set to %TRUE and
* @icon_view will connect a `GtkWidget::query-tooltip` signal handler.
*
* Note that the signal handler sets the text with gtk_tooltip_set_markup(),
* so &, <, etc have to be escaped in the text.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_tooltip_column (GtkIconView *icon_view,
int column)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (column == icon_view->priv->tooltip_column)
return;
/**
* gtk_icon_view_get_tooltip_column:
* @icon_view: a `GtkIconView`
*
* Returns the column of @icon_view’s model which is being used for
* displaying tooltips on @icon_view’s rows.
*
* Returns: the index of the tooltip column that is currently being
* used, or -1if this is disabled.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_tooltip_column (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), 0);
return icon_view->priv->tooltip_column;
}
/**
* gtk_icon_view_get_visible_range:
* @icon_view: A `GtkIconView`
* @start_path: (out) (optional): Return location for start of region
* @end_path: (out) (optional): Return location forend of region
*
* 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.
*
* Returns: %TRUE, if valid paths were placed in @start_path and @end_path
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
gboolean
gtk_icon_view_get_visible_range (GtkIconView *icon_view,
GtkTreePath **start_path,
GtkTreePath **end_path)
{
int start_index = -1;
int end_index = -1;
GList *icons;
/**
* gtk_icon_view_selected_foreach:
* @icon_view: A `GtkIconView`.
* @func: (scope call): The function to callfor each selected icon.
* @data: User data to pass to the function.
*
* Calls a functionfor each selected icon. Note that the model or
* selection cannot be modified from within this function.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_selected_foreach (GtkIconView *icon_view,
GtkIconViewForeachFunc func,
gpointer data)
{
GList *list;
for (list = icon_view->priv->items; list; list = list->next)
{
GtkIconViewItem *item = list->data;
GtkTreePath *path = gtk_tree_path_new_from_indices (item->index, -1);
if (item->selected)
(* func) (icon_view, path, data);
gtk_tree_path_free (path);
}
}
/**
* gtk_icon_view_set_selection_mode:
* @icon_view: A `GtkIconView`.
* @mode: The selection mode
*
* Sets the selection mode of the @icon_view.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_set_selection_mode (GtkIconView *icon_view,
GtkSelectionMode mode)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (mode == icon_view->priv->selection_mode)
return;
if (mode == GTK_SELECTION_NONE ||
icon_view->priv->selection_mode == GTK_SELECTION_MULTIPLE)
gtk_icon_view_unselect_all (icon_view);
/**
* gtk_icon_view_get_selection_mode:
* @icon_view: A `GtkIconView`.
*
* Gets the selection mode of the @icon_view.
*
* Returns: the current selection mode
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
GtkSelectionMode
gtk_icon_view_get_selection_mode (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), GTK_SELECTION_SINGLE);
return icon_view->priv->selection_mode;
}
/**
* gtk_icon_view_set_model:
* @icon_view: A `GtkIconView`.
* @model: (nullable): The model.
*
* Sets the model for a `GtkIconView`.
* 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.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_set_model (GtkIconView *icon_view,
GtkTreeModel *model)
{
gboolean dirty;
/**
* gtk_icon_view_get_model:
* @icon_view: a `GtkIconView`
*
* Returns the model the `GtkIconView` is based on. Returns %NULL if the
* model is unset.
*
* Returns: (nullable) (transfer none): The currently used `GtkTreeModel`
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
GtkTreeModel *
gtk_icon_view_get_model (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), NULL);
return icon_view->priv->model;
}
static void
update_text_cell (GtkIconView *icon_view)
{ if (!icon_view->priv->cell_area)
return;
/**
* gtk_icon_view_set_text_column:
* @icon_view: A `GtkIconView`.
* @column: A column in the currently used model, or -1 to display no text
*
* Sets the column with text for @icon_view to be @column. The text
* column must be of type `G_TYPE_STRING`.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_set_text_column (GtkIconView *icon_view,
int column)
{ if (column == icon_view->priv->text_column)
return;
/**
* gtk_icon_view_get_text_column:
* @icon_view: A `GtkIconView`.
*
* Returns the column with text for @icon_view.
*
* Returns: the text column, or -1if it’s unset.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_text_column (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->text_column;
}
/**
* gtk_icon_view_set_markup_column:
* @icon_view: A `GtkIconView`.
* @column: A column in the currently used model, or -1 to display no text
*
* 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 gtk_icon_view_set_text_column().
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_set_markup_column (GtkIconView *icon_view,
int column)
{
if (column == icon_view->priv->markup_column)
return;
/**
* gtk_icon_view_get_markup_column:
* @icon_view: A `GtkIconView`.
*
* Returns the column with markup text for @icon_view.
*
* Returns: the markup column, or -1 if it’s unset.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_markup_column (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->markup_column;
}
/**
* gtk_icon_view_set_pixbuf_column:
* @icon_view: A `GtkIconView`.
* @column: A column in the currently used model, or -1 to disable
*
* Sets the column with pixbufs for @icon_view to be @column. The pixbuf
* column must be of type `GDK_TYPE_PIXBUF`
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view,
int column)
{
if (column == icon_view->priv->pixbuf_column)
return;
/**
* gtk_icon_view_get_pixbuf_column:
* @icon_view: A `GtkIconView`.
*
* Returns the column with pixbufs for @icon_view.
*
* Returns: the pixbuf column, or -1 if it’s unset.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_pixbuf_column (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->pixbuf_column;
}
/**
* gtk_icon_view_select_path:
* @icon_view: A `GtkIconView`.
* @path: The `GtkTreePath` to be selected.
*
* Selects the row at @path.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_select_path (GtkIconView *icon_view,
GtkTreePath *path)
{
GtkIconViewItem *item = NULL;
/**
* gtk_icon_view_get_selected_items:
* @icon_view: A `GtkIconView`.
*
* 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 `GtkTreeRowReferences`.
* To do this, you can use gtk_tree_row_reference_new().
*
* To free the return value, use `g_list_free_full`:
*
* ```c
* GtkWidget *icon_view = gtk_icon_view_new ();
* // Use icon_view
*
* GList *list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (icon_view));
*
* // use list
*
* g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
* ```
*
* Returns: (element-type GtkTreePath) (transfer full): A `GList` containing a `GtkTreePath` for each selected row.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
GList *
gtk_icon_view_get_selected_items (GtkIconView *icon_view)
{
GList *list;
GList *selected = NULL;
for (list = icon_view->priv->items; list != NULL; list = list->next)
{
GtkIconViewItem *item = list->data;
if (item->selected)
{
GtkTreePath *path = gtk_tree_path_new_from_indices (item->index, -1);
selected = g_list_prepend (selected, path);
}
}
return selected;
}
/**
* gtk_icon_view_select_all:
* @icon_view: A `GtkIconView`.
*
* Selects all the icons. @icon_view must has its selection mode set
* to %GTK_SELECTION_MULTIPLE.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_select_all (GtkIconView *icon_view)
{
GList *items;
gboolean dirty = FALSE;
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (icon_view->priv->selection_mode != GTK_SELECTION_MULTIPLE)
return;
if (dirty)
g_signal_emit (icon_view, icon_view_signals[SELECTION_CHANGED], 0);
}
/**
* gtk_icon_view_path_is_selected:
* @icon_view: A `GtkIconView`.
* @path: A `GtkTreePath` to check selection on.
*
* Returns %TRUE if the icon pointed to by @path is currently
* selected. If @path does not point to a valid location, %FALSE is returned.
*
* Returns: %TRUE if @path is selected.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
gboolean
gtk_icon_view_path_is_selected (GtkIconView *icon_view,
GtkTreePath *path)
{
GtkIconViewItem *item;
/**
* gtk_icon_view_get_item_row:
* @icon_view: a `GtkIconView`
* @path: the `GtkTreePath` of the item
*
* Gets the row in which the item @path is currently
* displayed. Row numbers start at 0.
*
* Returns: The row in which the item is displayed
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_item_row (GtkIconView *icon_view,
GtkTreePath *path)
{
GtkIconViewItem *item;
/**
* gtk_icon_view_get_item_column:
* @icon_view: a `GtkIconView`
* @path: the `GtkTreePath` of the item
*
* Gets the column in which the item @path is currently
* displayed. Column numbers start at 0.
*
* Returns: The column in which the item is displayed
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_item_column (GtkIconView *icon_view,
GtkTreePath *path)
{
GtkIconViewItem *item;
/**
* gtk_icon_view_set_item_orientation:
* @icon_view: a `GtkIconView`
* @orientation: the relative position of texts and icons
*
* Sets the ::item-orientation property which determines whether the labels
* are drawn beside the icons instead of below.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_set_item_orientation (GtkIconView *icon_view,
GtkOrientation orientation)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (icon_view->priv->item_orientation != orientation)
{
icon_view->priv->item_orientation = orientation;
if (icon_view->priv->cell_area)
{
if (GTK_IS_ORIENTABLE (icon_view->priv->cell_area))
gtk_orientable_set_orientation (GTK_ORIENTABLE (icon_view->priv->cell_area),
icon_view->priv->item_orientation);
/**
* gtk_icon_view_get_item_orientation:
* @icon_view: a `GtkIconView`
*
* 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
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
GtkOrientation
gtk_icon_view_get_item_orientation (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view),
GTK_ORIENTATION_VERTICAL);
return icon_view->priv->item_orientation;
}
/**
* gtk_icon_view_set_columns:
* @icon_view: a `GtkIconView`
* @columns: the number of 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.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_columns (GtkIconView *icon_view,
int columns)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (icon_view->priv->columns != columns)
{
icon_view->priv->columns = columns;
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/**
* gtk_icon_view_get_columns:
* @icon_view: a `GtkIconView`
*
* Returns the value of the ::columns property.
*
* Returns: the number of columns, or -1
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_columns (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->columns;
}
/**
* gtk_icon_view_set_item_width:
* @icon_view: a `GtkIconView`
* @item_width: the width for each item
*
* 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.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_item_width (GtkIconView *icon_view,
int item_width)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (icon_view->priv->item_width != item_width)
{
icon_view->priv->item_width = item_width;
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/**
* gtk_icon_view_get_item_width:
* @icon_view: a `GtkIconView`
*
* Returns the value of the ::item-width property.
*
* Returns: the width of a single item, or -1
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_item_width (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->item_width;
}
/**
* gtk_icon_view_set_spacing:
* @icon_view: a `GtkIconView`
* @spacing: the 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.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_spacing (GtkIconView *icon_view,
int spacing)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (icon_view->priv->spacing != spacing)
{
icon_view->priv->spacing = spacing;
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/**
* gtk_icon_view_get_spacing:
* @icon_view: a `GtkIconView`
*
* Returns the value of the ::spacing property.
*
* Returns: the space between cells
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_spacing (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->spacing;
}
/**
* gtk_icon_view_set_row_spacing:
* @icon_view: a `GtkIconView`
* @row_spacing: the row spacing
*
* Sets the ::row-spacing property which specifies the space
* which is inserted between the rows of the icon view.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
int row_spacing)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (icon_view->priv->row_spacing != row_spacing)
{
icon_view->priv->row_spacing = row_spacing;
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/**
* gtk_icon_view_get_row_spacing:
* @icon_view: a `GtkIconView`
*
* Returns the value of the ::row-spacing property.
*
* Returns: the space between rows
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_row_spacing (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->row_spacing;
}
/**
* gtk_icon_view_set_column_spacing:
* @icon_view: a `GtkIconView`
* @column_spacing: the column spacing
*
* Sets the ::column-spacing property which specifies the space
* which is inserted between the columns of the icon view.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
int column_spacing)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (icon_view->priv->column_spacing != column_spacing)
{
icon_view->priv->column_spacing = column_spacing;
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/**
* gtk_icon_view_get_column_spacing:
* @icon_view: a `GtkIconView`
*
* Returns the value of the ::column-spacing property.
*
* Returns: the space between columns
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_column_spacing (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->column_spacing;
}
/**
* gtk_icon_view_set_margin:
* @icon_view: a `GtkIconView`
* @margin: the margin
*
* Sets the ::margin property which specifies the space
* which is inserted at the top, bottom, left and right
* of the icon view.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_margin (GtkIconView *icon_view,
int margin)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (icon_view->priv->margin != margin)
{
icon_view->priv->margin = margin;
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/**
* gtk_icon_view_get_margin:
* @icon_view: `GtkIconView`
*
* Returns the value of the ::margin property.
*
* Returns: the space at the borders
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_margin (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->margin;
}
/**
* gtk_icon_view_set_item_padding:
* @icon_view: a `GtkIconView`
* @item_padding: the item padding
*
* Sets the `GtkIconView`:item-padding property which specifies the padding
* around each of the icon view’s items.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_item_padding (GtkIconView *icon_view,
int item_padding)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (icon_view->priv->item_padding != item_padding)
{
icon_view->priv->item_padding = item_padding;
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/**
* gtk_icon_view_get_item_padding:
* @icon_view: a `GtkIconView`
*
* Returns the value of the ::item-padding property.
*
* Returns: the padding around items
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
int
gtk_icon_view_get_item_padding (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
return icon_view->priv->item_padding;
}
/* Get/set whether drag_motion requested the drag data and
* drag_data_received should thus not actually insert the data,
* since the data doesn’t result from a drop.
*/
static void
set_status_pending (GdkDrop *drop,
GdkDragAction suggested_action)
{
g_object_set_data (G_OBJECT (drop),
I_("gtk-icon-view-status-pending"),
GINT_TO_POINTER (suggested_action));
}
dr = g_object_get_data (G_OBJECT (drop), "gtk-icon-view-dest-row");
if (dr)
{
GtkTreePath *path = NULL;
if (dr->dest_row)
path = gtk_tree_row_reference_get_path (dr->dest_row);
else if (dr->empty_view_drop)
path = gtk_tree_path_new_from_indices (0, -1);
else
path = NULL;
if (path && dr->drop_append_mode)
gtk_tree_path_next (path);
return path;
}
else
return NULL;
}
static gboolean
check_model_dnd (GtkTreeModel *model,
GType required_iface,
const char *signal)
{
if (model == NULL || !G_TYPE_CHECK_INSTANCE_TYPE ((model), required_iface))
{
g_warning ("You must override the default '%s' handler "
"on GtkIconView when using models that don't support "
"the %s interface and enabling drag-and-drop. The simplest way to do this "
"is to connect to '%s' and call "
"g_signal_stop_emission_by_name() in your signal handler to prevent "
"the default handler from running. Look at the source code "
"for the default handler in gtkiconview.c to get an idea what "
"your handler should do. (gtkiconview.c is in the GTK source "
"code.) If you're using GTK from a language other than C, "
"there may be a more natural way to override default handlers, e.g. via derivation.",
signal, g_type_name (required_iface), signal);
return FALSE;
}
else
return TRUE;
}
if (old_dest_path)
gtk_tree_path_free (old_dest_path);
if (TRUE /* FIXME if the location droppable predicate */)
{
can_drop = TRUE;
}
out:
if (can_drop)
{
*suggested_action = gtk_icon_view_get_action (widget, drop);
gtk_icon_view_set_drag_dest_item (GTK_ICON_VIEW (widget),
path, pos);
}
else
{
/* can't drop here */
gtk_icon_view_set_drag_dest_item (GTK_ICON_VIEW (widget),
NULL,
GTK_ICON_VIEW_DROP_LEFT);
}
if (path)
gtk_tree_path_free (path);
return TRUE;
}
static GtkTreePath*
get_logical_destination (GtkIconView *icon_view,
gboolean *drop_append_mode)
{
/* adjust path to point to the row the drop goes in front of */
GtkTreePath *path = NULL;
GtkIconViewDropPosition pos;
/* We can implement the GTK_TREE_MODEL_ROW target generically for
* any model; for DragSource models there are some other formats
* we also support.
*/
/* we only know this *after* set_desination_row */
empty = icon_view->priv->empty_view_drop;
if (path == NULL && !empty)
{
/* Can't drop here. */
result = 0;
}
else
{
if (icon_view->priv->scroll_timeout_id == 0)
{
icon_view->priv->scroll_timeout_id = g_timeout_add (50, drag_scroll_timeout, icon_view);
gdk_source_set_static_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] drag_scroll_timeout");
}
if (target == GTK_TYPE_TREE_ROW_DATA)
{
/* Request data so we can use the source row when
* determining whether to accept the drop
*/
set_status_pending (drop, suggested_action);
gdk_drop_read_value_async (drop, target, G_PRIORITY_DEFAULT, NULL, gtk_icon_view_drag_data_received, icon_view);
}
else
{
set_status_pending (drop, 0);
}
result = suggested_action;
}
if (target != G_TYPE_INVALID && path != NULL)
{
/* in case a motion had requested drag data, change things so we
* treat drag data receives as a drop.
*/
set_status_pending (drop, 0);
set_dest_row (drop, model, path,
icon_view->priv->empty_view_drop, drop_append_mode);
}
if (path)
gtk_tree_path_free (path);
/* Unset this thing */
gtk_icon_view_set_drag_dest_item (icon_view, NULL, GTK_ICON_VIEW_DROP_LEFT);
value = gdk_drop_read_value_finish (drop, result, NULL);
if (!value)
return;
model = gtk_icon_view_get_model (icon_view);
if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drag-data-received"))
return;
if (!icon_view->priv->dest_set)
return;
suggested_action = get_status_pending (drop);
if (suggested_action)
{
/* We are getting this data due to a request in drag_motion,
* rather than due to a request in drag_drop, so we are just
* supposed to call drag_status, not actually paste in the
* data.
*/
path = get_logical_destination (icon_view, &drop_append_mode);
if (path == NULL)
suggested_action = 0;
if (suggested_action)
{
if (!gtk_tree_drag_dest_row_drop_possible (GTK_TREE_DRAG_DEST (model),
path,
value))
suggested_action = 0;
}
if (path)
gtk_tree_path_free (path);
/* If you can't drop, remove user drop indicator until the next motion */
if (suggested_action == 0)
gtk_icon_view_set_drag_dest_item (icon_view,
NULL,
GTK_ICON_VIEW_DROP_LEFT);
return;
}
/**
* gtk_icon_view_enable_model_drag_source:
* @icon_view: a `GtkIconView`
* @start_button_mask: Mask of allowed buttons to start drag
* @formats: the formats that the drag will support
* @actions: the bitmask of possible actions for a drag from this
* widget
*
* Turns @icon_view into a drag source for automatic DND. Calling this
* method sets `GtkIconView`:reorderable to %FALSE.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view,
GdkModifierType start_button_mask,
GdkContentFormats *formats,
GdkDragAction actions)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
/**
* gtk_icon_view_enable_model_drag_dest:
* @icon_view: a `GtkIconView`
* @formats: the formats that the drag will support
* @actions: the bitmask of possible actions for a drag to this
* widget
*
* Turns @icon_view into a drop destination for automatic DND. Calling this
* method sets `GtkIconView`:reorderable to %FALSE.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view,
GdkContentFormats *formats,
GdkDragAction actions)
{
GtkCssNode *widget_node;
/* These are useful to implement your own custom stuff. */
/**
* gtk_icon_view_set_drag_dest_item:
* @icon_view: a `GtkIconView`
* @path: (nullable): The path of the item to highlight
* @pos: Specifies where to drop, relative to the item
*
* Sets the item that is highlighted for feedback.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_set_drag_dest_item (GtkIconView *icon_view,
GtkTreePath *path,
GtkIconViewDropPosition pos)
{
/* Note; this function is exported to allow a custom DND
* implementation, so it can't touch TreeViewDragInfo
*/
/* special case a drop on an empty model */
icon_view->priv->empty_view_drop = FALSE;
if (pos == GTK_ICON_VIEW_DROP_ABOVE && path
&& gtk_tree_path_get_depth (path) == 1
&& gtk_tree_path_get_indices (path)[0] == 0)
{
int n_children;
/**
* gtk_icon_view_get_drag_dest_item:
* @icon_view: a `GtkIconView`
* @path: (out) (nullable) (optional): Return location for the path of
* the highlighted item
* @pos: (out) (optional): Return location for the drop position
*
* Gets information about the item that is highlighted for feedback.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
*/
void
gtk_icon_view_get_drag_dest_item (GtkIconView *icon_view,
GtkTreePath **path,
GtkIconViewDropPosition *pos)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
if (path)
{
if (icon_view->priv->dest_item)
*path = gtk_tree_row_reference_get_path (icon_view->priv->dest_item);
else
*path = NULL;
}
if (pos)
*pos = icon_view->priv->dest_pos;
}
/**
* gtk_icon_view_get_dest_item_at_pos:
* @icon_view: a `GtkIconView`
* @drag_x: the position to determine the destination item for
* @drag_y: the position to determine the destination item for
* @path: (out) (optional): Return location for the path of the item
* @pos: (out) (optional): Return location for the drop position
*
* Determines the destination item for a given position.
*
* Returns: whether there is an item at the given position.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
gboolean
gtk_icon_view_get_dest_item_at_pos (GtkIconView *icon_view,
int drag_x,
int drag_y,
GtkTreePath **path,
GtkIconViewDropPosition *pos)
{
GtkIconViewItem *item;
/* Note; this function is exported to allow a custom DND
* implementation, so it can't touch TreeViewDragInfo
*/
/**
* gtk_icon_view_create_drag_icon:
* @icon_view: a `GtkIconView`
* @path: a `GtkTreePath` in @icon_view
*
* Creates a `GdkPaintable` representation of the item at @path.
* This image is used for a drag icon.
*
* Returns: (transfer full) (nullable): a newly-allocated `GdkPaintable` of the drag icon.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
GdkPaintable *
gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
GtkTreePath *path)
{
GtkWidget *widget;
GtkSnapshot *snapshot;
GdkPaintable *paintable;
GList *l;
int index;
/**
* gtk_icon_view_get_reorderable:
* @icon_view: a `GtkIconView`
*
* Retrieves whether the user can reorder the list via drag-and-drop.
* See gtk_icon_view_set_reorderable().
*
* Returns: %TRUE if the list can be reordered.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
gboolean
gtk_icon_view_get_reorderable (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), FALSE);
return icon_view->priv->reorderable;
}
/**
* gtk_icon_view_set_reorderable:
* @icon_view: A `GtkIconView`.
* @reorderable: %TRUE, if the list of items can be reordered.
*
* This function is a convenience function to allow you to reorder models that
* support the `GtkTreeDragSourceIface` and the `GtkTreeDragDestIface`. Both
* `GtkTreeStore` and `GtkListStore` 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.
*
* 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.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_set_reorderable (GtkIconView *icon_view,
gboolean reorderable)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
reorderable = reorderable != FALSE;
if (icon_view->priv->reorderable == reorderable)
return;
/**
* gtk_icon_view_set_activate_on_single_click:
* @icon_view: a `GtkIconView`
* @single: %TRUE to emit item-activated on a single click
*
* Causes the `GtkIconView`::item-activated signal to be emitted on
* a single click instead of a double click.
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
void
gtk_icon_view_set_activate_on_single_click (GtkIconView *icon_view,
gboolean single)
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
single = single != FALSE;
if (icon_view->priv->activate_on_single_click == single)
return;
/**
* gtk_icon_view_get_activate_on_single_click:
* @icon_view: a `GtkIconView`
*
* Gets the setting set by gtk_icon_view_set_activate_on_single_click().
*
* Returns: %TRUE if item-activated will be emitted on a single click
*
* Deprecated: 4.10: Use [class@Gtk.GridView] instead
**/
gboolean
gtk_icon_view_get_activate_on_single_click (GtkIconView *icon_view)
{
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), FALSE);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.241Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.