mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
iconview: Derive from GtkWidget
GtkIconView is not a container.
This commit is contained in:
parent
825e98dcca
commit
253a39c6e9
@ -852,7 +852,7 @@ _gtk_icon_view_item_accessible_class_init (GtkIconViewItemAccessibleClass *klass
|
||||
static void atk_component_interface_init (AtkComponentIface *iface);
|
||||
static void atk_selection_interface_init (AtkSelectionIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIconViewAccessible, gtk_icon_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIconViewAccessible, gtk_icon_view_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkIconViewAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
|
||||
|
@ -22,7 +22,7 @@
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkcontaineraccessible.h>
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -39,14 +39,14 @@ typedef struct _GtkIconViewAccessiblePrivate GtkIconViewAccessiblePrivate;
|
||||
|
||||
struct _GtkIconViewAccessible
|
||||
{
|
||||
GtkContainerAccessible parent;
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkIconViewAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkIconViewAccessibleClass
|
||||
{
|
||||
GtkContainerAccessibleClass parent_class;
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -181,12 +181,8 @@ static gboolean gtk_icon_view_key_pressed (GtkEventControl
|
||||
GdkModifierType state,
|
||||
GtkWidget *widget);
|
||||
|
||||
/* GtkContainer vfuncs */
|
||||
static void gtk_icon_view_remove (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_icon_view_forall (GtkContainer *container,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data);
|
||||
static void gtk_icon_view_remove (GtkIconView *icon_view,
|
||||
GtkWidget *widget);
|
||||
|
||||
/* GtkIconView vfuncs */
|
||||
static void gtk_icon_view_real_select_all (GtkIconView *icon_view);
|
||||
@ -326,7 +322,7 @@ static void gtk_icon_view_buildable_custom_tag_end (GtkBuildable *bu
|
||||
|
||||
static guint icon_view_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIconView, gtk_icon_view, GTK_TYPE_CONTAINER,
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIconView, gtk_icon_view, GTK_TYPE_WIDGET,
|
||||
G_ADD_PRIVATE (GtkIconView)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
|
||||
gtk_icon_view_cell_layout_init)
|
||||
@ -339,7 +335,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
gobject_class->constructed = gtk_icon_view_constructed;
|
||||
gobject_class->dispose = gtk_icon_view_dispose;
|
||||
@ -353,9 +348,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
widget_class->focus = gtk_widget_focus_self;
|
||||
widget_class->grab_focus = gtk_widget_grab_focus_self;
|
||||
|
||||
container_class->remove = gtk_icon_view_remove;
|
||||
container_class->forall = gtk_icon_view_forall;
|
||||
|
||||
klass->select_all = gtk_icon_view_real_select_all;
|
||||
klass->unselect_all = gtk_icon_view_real_unselect_all;
|
||||
klass->select_cursor_item = gtk_icon_view_real_select_cursor_item;
|
||||
@ -1904,15 +1896,12 @@ gtk_icon_view_leave(GtkEventController *controller,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
gtk_icon_view_remove (GtkIconView *icon_view,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkIconView *icon_view;
|
||||
GtkIconViewChild *child = NULL;
|
||||
GList *tmp_list;
|
||||
|
||||
icon_view = GTK_ICON_VIEW (container);
|
||||
|
||||
tmp_list = icon_view->priv->children;
|
||||
while (tmp_list)
|
||||
{
|
||||
@ -1931,27 +1920,6 @@ gtk_icon_view_remove (GtkContainer *container,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_forall (GtkContainer *container,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkIconView *icon_view;
|
||||
GtkIconViewChild *child = NULL;
|
||||
GList *tmp_list;
|
||||
|
||||
icon_view = GTK_ICON_VIEW (container);
|
||||
|
||||
tmp_list = icon_view->priv->children;
|
||||
while (tmp_list)
|
||||
{
|
||||
child = tmp_list->data;
|
||||
tmp_list = tmp_list->next;
|
||||
|
||||
(* callback) (child->widget, callback_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_item_selected_changed (GtkIconView *icon_view,
|
||||
GtkIconViewItem *item)
|
||||
@ -1997,17 +1965,16 @@ gtk_icon_view_add_editable (GtkCellArea *area,
|
||||
|
||||
static void
|
||||
gtk_icon_view_remove_editable (GtkCellArea *area,
|
||||
GtkCellRenderer *renderer,
|
||||
GtkCellEditable *editable,
|
||||
GtkIconView *icon_view)
|
||||
GtkCellRenderer *renderer,
|
||||
GtkCellEditable *editable,
|
||||
GtkIconView *icon_view)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
||||
if (gtk_widget_has_focus (GTK_WIDGET (editable)))
|
||||
gtk_widget_grab_focus (GTK_WIDGET (icon_view));
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (icon_view),
|
||||
GTK_WIDGET (editable));
|
||||
|
||||
gtk_icon_view_remove (icon_view, GTK_WIDGET (editable));
|
||||
|
||||
path = gtk_tree_path_new_from_string (gtk_cell_area_get_current_path_string (area));
|
||||
gtk_icon_view_queue_draw_path (icon_view, path);
|
||||
|
@ -22,7 +22,7 @@
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkcontainer.h>
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <gtk/gtktreemodel.h>
|
||||
#include <gtk/gtkcellrenderer.h>
|
||||
#include <gtk/gtkcellarea.h>
|
||||
@ -46,8 +46,8 @@ typedef struct _GtkIconView GtkIconView;
|
||||
* selected rows. It will be called on every selected row in the view.
|
||||
*/
|
||||
typedef void (* GtkIconViewForeachFunc) (GtkIconView *icon_view,
|
||||
GtkTreePath *path,
|
||||
gpointer data);
|
||||
GtkTreePath *path,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GtkIconViewDropPosition:
|
||||
@ -81,22 +81,22 @@ GtkWidget * gtk_icon_view_new_with_model (GtkTreeModel *model);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_model (GtkIconView *icon_view,
|
||||
GtkTreeModel *model);
|
||||
GtkTreeModel *model);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTreeModel * gtk_icon_view_get_model (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_text_column (GtkIconView *icon_view,
|
||||
gint column);
|
||||
gint column);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_text_column (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_markup_column (GtkIconView *icon_view,
|
||||
gint column);
|
||||
gint column);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_markup_column (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view,
|
||||
gint column);
|
||||
gint column);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_pixbuf_column (GtkIconView *icon_view);
|
||||
|
||||
@ -107,54 +107,54 @@ GDK_AVAILABLE_IN_ALL
|
||||
GtkOrientation gtk_icon_view_get_item_orientation (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_columns (GtkIconView *icon_view,
|
||||
gint columns);
|
||||
gint columns);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_columns (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_item_width (GtkIconView *icon_view,
|
||||
gint item_width);
|
||||
gint item_width);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_item_width (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_spacing (GtkIconView *icon_view,
|
||||
gint spacing);
|
||||
gint spacing);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_spacing (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
|
||||
gint row_spacing);
|
||||
gint row_spacing);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_row_spacing (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
|
||||
gint column_spacing);
|
||||
gint column_spacing);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_column_spacing (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_margin (GtkIconView *icon_view,
|
||||
gint margin);
|
||||
gint margin);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_margin (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_item_padding (GtkIconView *icon_view,
|
||||
gint item_padding);
|
||||
gint item_padding);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_item_padding (GtkIconView *icon_view);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTreePath * gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
|
||||
gint x,
|
||||
gint y);
|
||||
gint x,
|
||||
gint y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_icon_view_get_item_at_pos (GtkIconView *icon_view,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkTreePath **path,
|
||||
GtkCellRenderer **cell);
|
||||
gint x,
|
||||
gint y,
|
||||
GtkTreePath **path,
|
||||
GtkCellRenderer **cell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_icon_view_get_visible_range (GtkIconView *icon_view,
|
||||
GtkTreePath **start_path,
|
||||
GtkTreePath **end_path);
|
||||
GtkTreePath **start_path,
|
||||
GtkTreePath **end_path);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_activate_on_single_click (GtkIconView *icon_view,
|
||||
gboolean single);
|
||||
@ -163,22 +163,22 @@ gboolean gtk_icon_view_get_activate_on_single_click (GtkIconView *icon_vi
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_selected_foreach (GtkIconView *icon_view,
|
||||
GtkIconViewForeachFunc func,
|
||||
gpointer data);
|
||||
GtkIconViewForeachFunc func,
|
||||
gpointer data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_selection_mode (GtkIconView *icon_view,
|
||||
GtkSelectionMode mode);
|
||||
GtkSelectionMode mode);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkSelectionMode gtk_icon_view_get_selection_mode (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_select_path (GtkIconView *icon_view,
|
||||
GtkTreePath *path);
|
||||
GtkTreePath *path);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_unselect_path (GtkIconView *icon_view,
|
||||
GtkTreePath *path);
|
||||
GtkTreePath *path);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_icon_view_path_is_selected (GtkIconView *icon_view,
|
||||
GtkTreePath *path);
|
||||
GtkTreePath *path);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_icon_view_get_item_row (GtkIconView *icon_view,
|
||||
GtkTreePath *path);
|
||||
@ -193,40 +193,40 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_unselect_all (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_item_activated (GtkIconView *icon_view,
|
||||
GtkTreePath *path);
|
||||
GtkTreePath *path);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_cursor (GtkIconView *icon_view,
|
||||
GtkTreePath *path,
|
||||
GtkCellRenderer *cell,
|
||||
gboolean start_editing);
|
||||
GtkTreePath *path,
|
||||
GtkCellRenderer *cell,
|
||||
gboolean start_editing);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_icon_view_get_cursor (GtkIconView *icon_view,
|
||||
GtkTreePath **path,
|
||||
GtkCellRenderer **cell);
|
||||
GtkTreePath **path,
|
||||
GtkCellRenderer **cell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
|
||||
GtkTreePath *path,
|
||||
gboolean use_align,
|
||||
gfloat row_align,
|
||||
gboolean use_align,
|
||||
gfloat row_align,
|
||||
gfloat col_align);
|
||||
|
||||
/* Drag-and-Drop support */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view,
|
||||
GdkModifierType start_button_mask,
|
||||
GdkContentFormats *formats,
|
||||
GdkDragAction actions);
|
||||
GdkModifierType start_button_mask,
|
||||
GdkContentFormats *formats,
|
||||
GdkDragAction actions);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view,
|
||||
GdkContentFormats *formats,
|
||||
GdkDragAction actions);
|
||||
GdkContentFormats *formats,
|
||||
GdkDragAction actions);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_unset_model_drag_source (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_unset_model_drag_dest (GtkIconView *icon_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_reorderable (GtkIconView *icon_view,
|
||||
gboolean reorderable);
|
||||
gboolean reorderable);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_icon_view_get_reorderable (GtkIconView *icon_view);
|
||||
|
||||
@ -234,27 +234,27 @@ gboolean gtk_icon_view_get_reorderable (GtkIconView
|
||||
/* These are useful to implement your own custom stuff. */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_set_drag_dest_item (GtkIconView *icon_view,
|
||||
GtkTreePath *path,
|
||||
GtkIconViewDropPosition pos);
|
||||
GtkTreePath *path,
|
||||
GtkIconViewDropPosition pos);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_icon_view_get_drag_dest_item (GtkIconView *icon_view,
|
||||
GtkTreePath **path,
|
||||
GtkIconViewDropPosition *pos);
|
||||
GtkTreePath **path,
|
||||
GtkIconViewDropPosition *pos);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_icon_view_get_dest_item_at_pos (GtkIconView *icon_view,
|
||||
gint drag_x,
|
||||
gint drag_y,
|
||||
GtkTreePath **path,
|
||||
GtkIconViewDropPosition *pos);
|
||||
gint drag_x,
|
||||
gint drag_y,
|
||||
GtkTreePath **path,
|
||||
GtkIconViewDropPosition *pos);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkPaintable *gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
|
||||
GtkTreePath *path);
|
||||
GtkTreePath *path);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_icon_view_get_cell_rect (GtkIconView *icon_view,
|
||||
GtkTreePath *path,
|
||||
GtkCellRenderer *cell,
|
||||
GdkRectangle *rect);
|
||||
GtkTreePath *path,
|
||||
GtkCellRenderer *cell,
|
||||
GdkRectangle *rect);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -44,14 +44,14 @@ typedef struct _GtkIconViewPrivate GtkIconViewPrivate;
|
||||
|
||||
struct _GtkIconView
|
||||
{
|
||||
GtkContainer parent;
|
||||
GtkWidget parent;
|
||||
|
||||
GtkIconViewPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkIconViewClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
GtkWidgetClass parent_class;
|
||||
|
||||
void (* item_activated) (GtkIconView *icon_view,
|
||||
GtkTreePath *path);
|
||||
|
Loading…
Reference in New Issue
Block a user