]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktreeselection.h
Add GtkBubbleWindow
[~andy/gtk] / gtk / gtktreeselection.h
index 2b8688c1cddf7131ea6a954520614590dd146594..4600930ce745cc1a5ff0fd184678a2cba92d5b58 100644 (file)
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __GTK_TREE_SELECTION_H__
 #define __GTK_TREE_SELECTION_H__
 
-#include <gtk/gtkobject.h>
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
 #include <gtk/gtktreeview.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
 
-#define GTK_TYPE_TREE_SELECTION                        (gtk_tree_selection_get_type ())
-#define GTK_TREE_SELECTION(obj)                        (GTK_CHECK_CAST ((obj), GTK_TYPE_TREE_SELECTION, GtkTreeSelection))
-#define GTK_TREE_SELECTION_CLASS(klass)                (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_SELECTION, GtkTreeSelectionClass))
-#define GTK_IS_TREE_SELECTION(obj)             (GTK_CHECK_TYPE ((obj), GTK_TYPE_TREE_SELECTION))
-#define GTK_IS_TREE_SELECTION_CLASS(klass)     (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_SELECTION))
-#define GTK_TREE_SELECTION_GET_CLASS(obj)       (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TREE_SELECTION, GtkTreeSelectionClass))
 
+#define GTK_TYPE_TREE_SELECTION                        (gtk_tree_selection_get_type ())
+#define GTK_TREE_SELECTION(obj)                        (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_SELECTION, GtkTreeSelection))
+#define GTK_TREE_SELECTION_CLASS(klass)                (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_SELECTION, GtkTreeSelectionClass))
+#define GTK_IS_TREE_SELECTION(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_SELECTION))
+#define GTK_IS_TREE_SELECTION_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_SELECTION))
+#define GTK_TREE_SELECTION_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_SELECTION, GtkTreeSelectionClass))
+
+typedef struct _GtkTreeSelectionPrivate      GtkTreeSelectionPrivate;
+
+/**
+ * GtkTreeSelectionFunc:
+ * @selection: A #GtkTreeSelection
+ * @model: A #GtkTreeModel being viewed
+ * @path: The #GtkTreePath of the row in question
+ * @path_currently_selected: %TRUE, if the path is currently selected
+ * @data: (closure): user data
+ *
+ * A function used by gtk_tree_selection_set_select_function() to filter
+ * whether or not a row may be selected.  It is called whenever a row's
+ * state might change.  A return value of %TRUE indicates to @selection
+ * that it is okay to change the selection.
+ *
+ * Returns: %TRUE, if the selection state of the row can be toggled
+ */
 typedef gboolean (* GtkTreeSelectionFunc)    (GtkTreeSelection  *selection,
                                              GtkTreeModel      *model,
                                              GtkTreePath       *path,
                                               gboolean           path_currently_selected,
                                              gpointer           data);
+
+/**
+ * GtkTreeSelectionForeachFunc:
+ * @model: The #GtkTreeModel being viewed
+ * @path: The #GtkTreePath of a selected row
+ * @iter: A #GtkTreeIter pointing to a selected row
+ * @data: (closure): user data
+ *
+ * A function used by gtk_tree_selection_selected_foreach() to map all
+ * selected rows.  It will be called on every selected row in the view.
+ */
 typedef void (* GtkTreeSelectionForeachFunc) (GtkTreeModel      *model,
                                              GtkTreePath       *path,
                                              GtkTreeIter       *iter,
@@ -46,15 +74,10 @@ typedef void (* GtkTreeSelectionForeachFunc) (GtkTreeModel      *model,
 
 struct _GtkTreeSelection
 {
+  /*< private >*/
   GObject parent;
 
-  /*< private >*/
-  
-  GtkTreeView *tree_view;
-  GtkSelectionMode type;
-  GtkTreeSelectionFunc user_func;
-  gpointer user_data;
-  GtkDestroyNotify destroy;
+  GtkTreeSelectionPrivate *priv;
 };
 
 struct _GtkTreeSelectionClass
@@ -62,10 +85,16 @@ struct _GtkTreeSelectionClass
   GObjectClass parent_class;
 
   void (* changed) (GtkTreeSelection *selection);
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved1) (void);
+  void (*_gtk_reserved2) (void);
+  void (*_gtk_reserved3) (void);
+  void (*_gtk_reserved4) (void);
 };
 
 
-GtkType          gtk_tree_selection_get_type            (void);
+GType            gtk_tree_selection_get_type            (void) G_GNUC_CONST;
 
 void             gtk_tree_selection_set_mode            (GtkTreeSelection            *selection,
                                                         GtkSelectionMode             type);
@@ -73,17 +102,20 @@ GtkSelectionMode gtk_tree_selection_get_mode        (GtkTreeSelection
 void             gtk_tree_selection_set_select_function (GtkTreeSelection            *selection,
                                                         GtkTreeSelectionFunc         func,
                                                         gpointer                     data,
-                                                        GtkDestroyNotify             destroy);
+                                                        GDestroyNotify               destroy);
 gpointer         gtk_tree_selection_get_user_data       (GtkTreeSelection            *selection);
 GtkTreeView*     gtk_tree_selection_get_tree_view       (GtkTreeSelection            *selection);
 
-/* Only meaningful if GTK_TREE_SELECTION_SINGLE is set */
-/* Use selected_foreach for GTK_TREE_SELECTION_MULTI */
+GtkTreeSelectionFunc gtk_tree_selection_get_select_function (GtkTreeSelection        *selection);
+
+/* Only meaningful if GTK_SELECTION_SINGLE or GTK_SELECTION_BROWSE is set */
+/* Use selected_foreach or get_selected_rows for GTK_SELECTION_MULTIPLE */
 gboolean         gtk_tree_selection_get_selected        (GtkTreeSelection            *selection,
                                                         GtkTreeModel               **model,
                                                         GtkTreeIter                 *iter);
-
-/* FIXME: Get a more convenient get_selection function????  one returning GSList?? */
+GList *          gtk_tree_selection_get_selected_rows   (GtkTreeSelection            *selection,
+                                                         GtkTreeModel               **model);
+gint             gtk_tree_selection_count_selected_rows (GtkTreeSelection            *selection);
 void             gtk_tree_selection_selected_foreach    (GtkTreeSelection            *selection,
                                                         GtkTreeSelectionForeachFunc  func,
                                                         gpointer                     data);
@@ -104,12 +136,11 @@ void             gtk_tree_selection_unselect_all        (GtkTreeSelection
 void             gtk_tree_selection_select_range        (GtkTreeSelection            *selection,
                                                         GtkTreePath                 *start_path,
                                                         GtkTreePath                 *end_path);
+void             gtk_tree_selection_unselect_range      (GtkTreeSelection            *selection,
+                                                         GtkTreePath                 *start_path,
+                                                        GtkTreePath                 *end_path);
 
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
+G_END_DECLS
 
 #endif /* __GTK_TREE_SELECTION_H__ */
-