gtkmm r1087 - in trunk: . gtk/src



Author: murrayc
Date: Tue Jan 27 09:13:44 2009
New Revision: 1087
URL: http://svn.gnome.org/viewvc/gtkmm?rev=1087&view=rev

Log:
2009-01-27  Murray Cumming  <murrayc murrayc com>

* gtk/src/treeview.[hg|ccg]: get_path_at_pos(): 
Improved the documentation because it was improved in GTK+.
Added a get_path_at_pos() overload that takes less parameters.

Modified:
   trunk/ChangeLog
   trunk/gtk/src/treeview.ccg
   trunk/gtk/src/treeview.hg

Modified: trunk/gtk/src/treeview.ccg
==============================================================================
--- trunk/gtk/src/treeview.ccg	(original)
+++ trunk/gtk/src/treeview.ccg	Tue Jan 27 09:13:44 2009
@@ -205,7 +205,7 @@
 {
   GtkTreePath* pTreePath = 0;
   GtkTreeViewColumn* pTreeViewColumn = 0;
-  bool result = gtk_tree_view_get_path_at_pos(gobj(), x, y, &pTreePath, &pTreeViewColumn, &cell_x, &cell_y);
+  const bool result = gtk_tree_view_get_path_at_pos(gobj(), x, y, &pTreePath, &pTreeViewColumn, &cell_x, &cell_y);
 
   path = TreeModel::Path(pTreePath, false /* don't take a copy, because the gtk_tree_view_get_path_at_pos() docs say that we must free the path */ );
   column = Glib::wrap(pTreeViewColumn);
@@ -217,13 +217,22 @@
 {
   GtkTreePath* pTreePath = 0;
   GtkTreeViewColumn* pTreeViewColumn = 0;
-  bool result = gtk_tree_view_get_path_at_pos(const_cast<GtkTreeView*>(gobj()), x, y, &pTreePath, &pTreeViewColumn, &cell_x, &cell_y);
+  const bool result = gtk_tree_view_get_path_at_pos(const_cast<GtkTreeView*>(gobj()), x, y, &pTreePath, &pTreeViewColumn, &cell_x, &cell_y);
 
   path = TreeModel::Path(pTreePath, false /* don't take a copy, because the gtk_tree_view_get_path_at_pos() docs say that we must free the path */ );
   column = Glib::wrap(pTreeViewColumn);
   return result;
 }
 
+bool TreeView::get_path_at_pos(int x, int y, TreeModel::Path& path) const
+{
+  GtkTreePath* pTreePath = 0;
+  const bool result = gtk_tree_view_get_path_at_pos(const_cast<GtkTreeView*>(gobj()), x, y, &pTreePath, 0, 0, 0);
+
+  path = TreeModel::Path(pTreePath, false /* don't take a copy, because the gtk_tree_view_get_path_at_pos() docs say that we must free the path */ );
+  return result;
+}
+
 int TreeView::insert_column(const Glib::ustring& title, CellRenderer& cell, int position)
 {
   return gtk_tree_view_insert_column_with_attributes(

Modified: trunk/gtk/src/treeview.hg
==============================================================================
--- trunk/gtk/src/treeview.hg	(original)
+++ trunk/gtk/src/treeview.hg	Tue Jan 27 09:13:44 2009
@@ -500,11 +500,24 @@
   bool get_path_at_pos(int x, int y, TreeModel::Path& path, TreeViewColumn*& column, int& cell_x, int& cell_y);
   _DEPRECATE_IFDEF_END
 
-  /** Finds the path at the point (x, y), relative to widget
-   * coordinates. It is primarily for things like popup menus.
+  /** Finds the path at the point (@a x, @a y), relative to bin_window coordinates
+   * (please get_bin_window()).
+   * That is, @a x and @a y are relative to an events coordinates. @a x and @a y must
+   * come from an event on the TreeView only where <literal>event->window ==
+   * gtk_tree_view_get_bin_window (<!-- -->)</literal>. It is primarily for
+   * things like popup menus. @a path will be filled
+   * with the TreeModel::Path at that point. @a column will be filled
+   * with the column at that point.  @a cell_x and @a cell_y return the coordinates
+   * relative to the cell background (i.e. the background_area passed to
+   * Gtk::CellRenderer::render()).  This method is only meaningful if
+   * the TreeView is realized.
+   *
+   * For converting widget coordinates (eg. the ones you get from
+   * Widget::property_query_tooltip()), please see
+   * convert_widget_to_bin_window_coords().
    *
-   * @param x The x position to be identified
-   * @param y The y position to be identified
+   * @param x The x position to be identified (relative to bin_window).
+   * @param y The y position to be identified (relative to bin_window).
    * @param path A reference to a TreeModel::Path to be filled in
    * @param column A reference to a TreeViewColumn pointer to be filled in
    * @param cell_x A reference where the X coordinate relative to the cell
@@ -512,9 +525,33 @@
    * @param cell_y A reference where the Y coordinate relative to the cell
    *   can be placed
    * @return true if a row exists at that coordinate.
+   *
+   * @newin2p8
    */
   bool get_path_at_pos(int x, int y, TreeModel::Path& path, TreeViewColumn*& column, int& cell_x, int& cell_y) const;
 
+  /** Finds the path at the point (@a x, @a y), relative to bin_window coordinates
+   * (please get_bin_window()).
+   * That is, @a x and @a y are relative to an events coordinates. @a x and @a y must
+   * come from an event on the TreeView only where event->window ==
+   * get_bin_window(). It is primarily for
+   * things like popup menus. @a path will be filled
+   * with the TreeModel::Path at that point.
+   * This method is only meaningful if the TreeView is realized.
+   *
+   * For converting widget coordinates (eg. the ones you get from
+   * Widget::property_query_tooltip()), please see
+   * convert_widget_to_bin_window_coords().
+   *
+   * @param x The x position to be identified (relative to bin_window).
+   * @param y The y position to be identified (relative to bin_window).
+   * @param path A reference to a TreeModel::Path to be filled in
+   * @return true if a row exists at that coordinate.
+   *
+   * newin2p16
+   */
+  bool get_path_at_pos(int x, int y, TreeModel::Path& path) const;
+
   _WRAP_METHOD(void get_cell_area(const TreeModel::Path& path, TreeViewColumn& column, Gdk::Rectangle& rect), gtk_tree_view_get_cell_area, deprecated "Use the const version")
 //We ignore the fact that one of the arguments can be 0 - it does not seem useful.
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]