]> Pileus Git - ~andy/gtk/commitdiff
Add a function to determine what parts of the model are visible. (#306726,
authorMatthias Clasen <mclasen@redhat.com>
Sat, 11 Jun 2005 05:15:10 +0000 (05:15 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sat, 11 Jun 2005 05:15:10 +0000 (05:15 +0000)
2005-06-11  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtk.symbols:
* gtk/gtkiconview.h:
* gtk/gtkiconview.c (gtk_icon_view_get_visible_range):
Add a function to determine what parts of the model are
visible.  (#306726, Jonathan Blandford)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtk.symbols
gtk/gtkiconview.c
gtk/gtkiconview.h

index d5a67e8b61c7509deaa115fc40384dd14c572e09..f07b8112b215e9cf7edbc8867a67092a87a1c4a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-06-11  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtk.symbols: 
+       * gtk/gtkiconview.h: 
+       * gtk/gtkiconview.c (gtk_icon_view_get_visible_range): 
+       Add a function to determine what parts of the model are
+       visible.  (#306726, Jonathan Blandford)
+
        * gtk/gtkfilesystemunix.c (create_file_info): Treat backup
        files the same way as hidden files, to be closer to what
        Nautilus does.  (#136196, Sean Middleditch)
index d5a67e8b61c7509deaa115fc40384dd14c572e09..f07b8112b215e9cf7edbc8867a67092a87a1c4a5 100644 (file)
@@ -1,5 +1,11 @@
 2005-06-11  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtk.symbols: 
+       * gtk/gtkiconview.h: 
+       * gtk/gtkiconview.c (gtk_icon_view_get_visible_range): 
+       Add a function to determine what parts of the model are
+       visible.  (#306726, Jonathan Blandford)
+
        * gtk/gtkfilesystemunix.c (create_file_info): Treat backup
        files the same way as hidden files, to be closer to what
        Nautilus does.  (#136196, Sean Middleditch)
index d5a67e8b61c7509deaa115fc40384dd14c572e09..f07b8112b215e9cf7edbc8867a67092a87a1c4a5 100644 (file)
@@ -1,5 +1,11 @@
 2005-06-11  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtk.symbols: 
+       * gtk/gtkiconview.h: 
+       * gtk/gtkiconview.c (gtk_icon_view_get_visible_range): 
+       Add a function to determine what parts of the model are
+       visible.  (#306726, Jonathan Blandford)
+
        * gtk/gtkfilesystemunix.c (create_file_info): Treat backup
        files the same way as hidden files, to be closer to what
        Nautilus does.  (#136196, Sean Middleditch)
index 3ef52afe8e2ae9277ec2376ecb861c9e0b12c4f2..3399ab4a2976a4eebe478bf1b13d67d26824ac6e 100644 (file)
@@ -1675,6 +1675,7 @@ gtk_icon_view_get_selection_mode
 gtk_icon_view_get_spacing
 gtk_icon_view_get_text_column
 gtk_icon_view_get_type G_GNUC_CONST
+gtk_icon_view_get_visible_range
 gtk_icon_view_item_activated
 gtk_icon_view_new
 gtk_icon_view_new_with_model
index 8c733dc3ad5daecde21a39fa975b6cbe596b3a25..34988467465aca639aba3f532f86f25466a8df5c 100644 (file)
@@ -4373,6 +4373,62 @@ gtk_icon_view_get_item_at_pos (GtkIconView      *icon_view,
   return (item != NULL);
 }
 
+
+/**
+ * gtk_icon_view_get_visible_range:
+ * @icon_view: A #GtkIconView
+ * @start_path: Return location for start of region, or %NULL
+ * @end_path: Return location for end of region, or %NULL
+ * 
+ * Sets @start_path and @end_path to be the first and last visible path. 
+ * Note that there may be invisible paths in between.
+ * 
+ * Return value: %TRUE, if valid paths were placed in @start_path and @end_path
+ *
+ * Since: 2.8
+ **/
+gboolean
+gtk_icon_view_get_visible_range (GtkIconView  *icon_view,
+                                GtkTreePath **start_path,
+                                GtkTreePath **end_path)
+{
+  gint start_index = -1;
+  gint end_index = -1;
+  GtkIconViewItem *item;
+  GList *icons;
+
+  g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), FALSE);
+
+  if (icon_view->priv->hadjustment == NULL ||
+      icon_view->priv->vadjustment == NULL)
+    return FALSE;
+
+  if (start_path == NULL && end_path == NULL)
+    return FALSE;
+  
+  for (icons = icon_view->priv->items; icons; icons = icons->next) 
+    {
+      GtkIconViewItem *item = icons->data;
+
+      if ((item->x + item->width >= (int)icon_view->priv->hadjustment->value) &&
+         (item->y + item->height >= (int)icon_view->priv->vadjustment->value) &&
+         (item->x <= (int) (icon_view->priv->hadjustment->value + icon_view->priv->hadjustment->page_size)) &&
+         (item->y <= (int) (icon_view->priv->vadjustment->value + icon_view->priv->vadjustment->page_size)))
+       {
+         if (start_index == -1)
+           start_index = item->index;
+         end_index = item->index;
+       }
+    }
+
+  if (start_path && start_index != -1)
+    *start_path = gtk_tree_path_new_from_indices (start_index, -1);
+  if (end_path && end_index != -1)
+    *end_path = gtk_tree_path_new_from_indices (end_index, -1);
+  
+  return start_index != -1;
+}
+
 /**
  * gtk_icon_view_selected_foreach:
  * @icon_view: A #GtkIconView.
index 0929ce694c8485a990293ff94222878ebecd160e..b6e5d46bed97bcf5a59755aa78227a50514f682c 100644 (file)
@@ -129,6 +129,9 @@ gboolean       gtk_icon_view_get_item_at_pos   (GtkIconView     *icon_view,
                                                gint              y,
                                                GtkTreePath     **path,
                                                GtkCellRenderer **cell);
+gboolean       gtk_icon_view_get_visible_range (GtkIconView      *icon_view,
+                                               GtkTreePath     **start_path,
+                                               GtkTreePath     **end_path);
 
 void           gtk_icon_view_selected_foreach   (GtkIconView            *icon_view,
                                                 GtkIconViewForeachFunc  func,