]> Pileus Git - ~andy/gtk/commitdiff
New function to convert widget coords to what is expected by the at_pos
authorMatthias Clasen <mclasen@redhat.com>
Wed, 11 Jul 2007 18:14:46 +0000 (18:14 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 11 Jul 2007 18:14:46 +0000 (18:14 +0000)
2007-07-11  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtk.symbols:
        * gtk/gtkiconview.[hc]
        (gtk_icon_view_convert_widget_to_bin_window_coords): New
        function to convert widget coords to what is expected by
        the at_pos functions.  (#455984)

svn path=/trunk/; revision=18445

ChangeLog
docs/reference/ChangeLog
docs/reference/gtk/gtk-sections.txt
gtk/gtk.symbols
gtk/gtkiconview.c
gtk/gtkiconview.h

index 8227fdb2a9578ba69ccd8d8040e7a83fbe05d4ef..71197c0ce0be1640d8e17a3025cc10e3e82a3804 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2007-07-11  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtk.symbols:
+       * gtk/gtkiconview.[hc]
+       (gtk_icon_view_convert_widget_to_bin_window_coords): New
+       function to convert widget coords to what is expected by
+       the at_pos functions.  (#455984)
+
+2007-07-11  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkwiget.c: Don't include gtktooltips.h, it is
+       not needed anymore.
+
 2007-07-11  Christian Persch  <chpe@gnome.org>
 
        * gtk/gtkaction.c: (gtk_action_buildable_set_name),
index 0b26c720ee6565fd0c59722d3c88cd03620128d2..a6c00e11e54971652f49571ecf239e8a8421bbde 100644 (file)
@@ -1,3 +1,7 @@
+2007-07-11  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtk-sections.txt: Updates
+
 2007-07-11  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/migrating-GtkTooltip.sgml: Migration chapter
index 7a453542548a7a349538fda069676594c064f751..acdb2f419a9dcd31093f9ee2fca60385e97862f2 100644 (file)
@@ -1780,6 +1780,7 @@ gtk_icon_view_set_pixbuf_column
 gtk_icon_view_get_pixbuf_column
 gtk_icon_view_get_path_at_pos
 gtk_icon_view_get_item_at_pos
+gtk_icon_view_convert_widget_to_bin_window_coords
 gtk_icon_view_set_cursor
 gtk_icon_view_get_cursor
 gtk_icon_view_selected_foreach
index bbd4e9d4c733f2b97a19200cdb05ec35db54e1c9..b99de6773f5ab9d0928d26a583f9b9bdecf3313c 100644 (file)
@@ -1844,6 +1844,7 @@ gtk_icon_view_get_model
 gtk_icon_view_get_orientation
 gtk_icon_view_get_path_at_pos
 gtk_icon_view_get_item_at_pos
+gtk_icon_view_convert_widget_to_bin_window_coords
 gtk_icon_view_get_pixbuf_column
 gtk_icon_view_get_row_spacing
 gtk_icon_view_get_selected_items
index 96e09eb33aa86f365e576e9e91bae25fc3e60495..88d75543d418c2580f9a09ac6e5cd68bf056df0a 100644 (file)
@@ -4518,6 +4518,39 @@ gtk_icon_view_new_with_model (GtkTreeModel *model)
   return g_object_new (GTK_TYPE_ICON_VIEW, "model", model, NULL);
 }
 
+/**
+ * gtk_icon_view_convert_widget_to_bin_window_coords:
+ * @wx: X coordinate relative to the widget
+ * @wy: Y coordinate relative to the widget
+ * @bx: return location for bin_window X coordinate
+ * @by: return location for bin_window Y coordinate
+ * 
+ * Converts widget coordinates to coordinates for the bin_window,
+ * as expected by e.g. gtk_icon_view_get_path_at_pos(). 
+ *
+ * Since: 2.12
+ */
+void
+gtk_icon_view_convert_widget_to_bin_window_coords (GtkIconView *icon_view,
+                                                   gint         wx,
+                                                   gint         wy, 
+                                                   gint        *bx,
+                                                   gint        *by)
+{
+  gint x, y;
+
+  g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
+
+  if (icon_view->priv->bin_window) 
+    gdk_window_get_position (icon_view->priv->bin_window, &x, &y);
+  else
+    x = y = 0;
+  if (bx)
+    *bx = wx - x;
+  if (by)
+    *by = wy - y;
+}
 
 /**
  * gtk_icon_view_get_path_at_pos:
@@ -4525,9 +4558,11 @@ gtk_icon_view_new_with_model (GtkTreeModel *model)
  * @x: The x position to be identified
  * @y: The y position to be identified
  * 
- * Finds the path at the point (@x, @y), relative to widget coordinates.
+ * 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.
+ * the cell at the specified position. 
+ * See gtk_icon_view_convert_widget_to_bin_window_coords() for converting
+ * widget coordinates to bin_window coordinates.
  * 
  * Return value: The #GtkTreePath corresponding to the icon or %NULL
  * if no icon exists at that position.
@@ -4541,6 +4576,7 @@ gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
 {
   GtkIconViewItem *item;
   GtkTreePath *path;
+  gint px, py;
   
   g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), NULL);
 
@@ -4563,10 +4599,12 @@ gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
  * @cell: Return location for the renderer responsible for the cell
  *   at (@x, @y), or %NULL
  * 
- * Finds the path at the point (@x, @y), relative to widget coordinates.
+ * 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.
  * 
  * Return value: %TRUE if an item exists at the specified position
  *
index b6e5d46bed97bcf5a59755aa78227a50514f682c..62780c3f817552f069110b6ce5d6d7a23f1adbb3 100644 (file)
@@ -195,6 +195,12 @@ gboolean               gtk_icon_view_get_dest_item_at_pos     (GtkIconView
 GdkPixmap             *gtk_icon_view_create_drag_icon         (GtkIconView              *icon_view,
                                                               GtkTreePath              *path);
 
+void    gtk_icon_view_convert_widget_to_bin_window_coords     (GtkIconView *icon_view,
+                                                               gint         wx,
+                                                               gint         wy,
+                                                               gint        *bx,
+                                                               gint        *by);
+
 
 G_END_DECLS