2000-10-05 01:04:57 +00:00
|
|
|
/* gtktreeselection.h
|
|
|
|
* Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2000-10-05 01:04:57 +00:00
|
|
|
*/
|
|
|
|
|
2012-12-28 14:57:34 +00:00
|
|
|
#ifndef __GTK_TREE_SELECTION_H__
|
|
|
|
#define __GTK_TREE_SELECTION_H__
|
|
|
|
|
2009-10-21 18:30:04 +00:00
|
|
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
2008-05-28 15:07:04 +00:00
|
|
|
#error "Only <gtk/gtk.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
#include <gtk/gtktreeview.h>
|
|
|
|
|
2005-06-21 05:35:43 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
#define GTK_TYPE_TREE_SELECTION (gtk_tree_selection_get_type ())
|
2002-10-07 19:10:39 +00:00
|
|
|
#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))
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2010-12-19 05:01:22 +00:00
|
|
|
typedef struct _GtkTreeSelectionPrivate GtkTreeSelectionPrivate;
|
|
|
|
|
2010-10-22 20:24:36 +00:00
|
|
|
/**
|
|
|
|
* 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
|
2011-01-18 05:28:24 +00:00
|
|
|
* @data: (closure): user data
|
2010-10-22 20:24:36 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
typedef gboolean (* GtkTreeSelectionFunc) (GtkTreeSelection *selection,
|
|
|
|
GtkTreeModel *model,
|
|
|
|
GtkTreePath *path,
|
2001-10-08 05:01:09 +00:00
|
|
|
gboolean path_currently_selected,
|
2000-10-05 01:04:57 +00:00
|
|
|
gpointer data);
|
2010-10-22 20:24:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkTreeSelectionForeachFunc:
|
|
|
|
* @model: The #GtkTreeModel being viewed
|
|
|
|
* @path: The #GtkTreePath of a selected row
|
|
|
|
* @iter: A #GtkTreeIter pointing to a selected row
|
2011-01-18 05:28:24 +00:00
|
|
|
* @data: (closure): user data
|
2010-10-22 20:24:36 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
typedef void (* GtkTreeSelectionForeachFunc) (GtkTreeModel *model,
|
2001-06-29 07:28:08 +00:00
|
|
|
GtkTreePath *path,
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter *iter,
|
2000-10-05 01:04:57 +00:00
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
struct _GtkTreeSelection
|
|
|
|
{
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
/*< private >*/
|
2010-12-19 05:01:22 +00:00
|
|
|
GObject parent;
|
2008-05-28 15:35:43 +00:00
|
|
|
|
2010-12-19 05:01:22 +00:00
|
|
|
GtkTreeSelectionPrivate *priv;
|
2000-10-05 01:04:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkTreeSelectionClass
|
|
|
|
{
|
2001-06-07 22:33:14 +00:00
|
|
|
GObjectClass parent_class;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-08-19 23:46:59 +00:00
|
|
|
void (* changed) (GtkTreeSelection *selection);
|
2002-02-23 20:22:05 +00:00
|
|
|
|
|
|
|
/* Padding for future expansion */
|
|
|
|
void (*_gtk_reserved1) (void);
|
|
|
|
void (*_gtk_reserved2) (void);
|
|
|
|
void (*_gtk_reserved3) (void);
|
|
|
|
void (*_gtk_reserved4) (void);
|
2000-10-05 01:04:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-11-23 20:02:15 +00:00
|
|
|
GType gtk_tree_selection_get_type (void) G_GNUC_CONST;
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
|
2001-01-04 21:33:24 +00:00
|
|
|
void gtk_tree_selection_set_mode (GtkTreeSelection *selection,
|
2001-08-27 19:19:24 +00:00
|
|
|
GtkSelectionMode type);
|
|
|
|
GtkSelectionMode gtk_tree_selection_get_mode (GtkTreeSelection *selection);
|
2000-10-05 01:04:57 +00:00
|
|
|
void gtk_tree_selection_set_select_function (GtkTreeSelection *selection,
|
|
|
|
GtkTreeSelectionFunc func,
|
2001-02-28 00:35:25 +00:00
|
|
|
gpointer data,
|
2008-06-18 09:12:32 +00:00
|
|
|
GDestroyNotify destroy);
|
2000-10-05 01:04:57 +00:00
|
|
|
gpointer gtk_tree_selection_get_user_data (GtkTreeSelection *selection);
|
2001-01-04 23:36:19 +00:00
|
|
|
GtkTreeView* gtk_tree_selection_get_tree_view (GtkTreeSelection *selection);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2008-06-20 11:01:18 +00:00
|
|
|
GtkTreeSelectionFunc gtk_tree_selection_get_select_function (GtkTreeSelection *selection);
|
|
|
|
|
2002-06-05 21:25:52 +00:00
|
|
|
/* Only meaningful if GTK_SELECTION_SINGLE or GTK_SELECTION_BROWSE is set */
|
|
|
|
/* Use selected_foreach or get_selected_rows for GTK_SELECTION_MULTIPLE */
|
2000-10-26 00:36:47 +00:00
|
|
|
gboolean gtk_tree_selection_get_selected (GtkTreeSelection *selection,
|
2000-11-09 16:52:17 +00:00
|
|
|
GtkTreeModel **model,
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter *iter);
|
2002-06-05 21:25:52 +00:00
|
|
|
GList * gtk_tree_selection_get_selected_rows (GtkTreeSelection *selection,
|
|
|
|
GtkTreeModel **model);
|
|
|
|
gint gtk_tree_selection_count_selected_rows (GtkTreeSelection *selection);
|
2000-10-05 01:04:57 +00:00
|
|
|
void gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
|
|
|
|
GtkTreeSelectionForeachFunc func,
|
|
|
|
gpointer data);
|
|
|
|
void gtk_tree_selection_select_path (GtkTreeSelection *selection,
|
|
|
|
GtkTreePath *path);
|
|
|
|
void gtk_tree_selection_unselect_path (GtkTreeSelection *selection,
|
|
|
|
GtkTreePath *path);
|
2000-10-26 00:36:47 +00:00
|
|
|
void gtk_tree_selection_select_iter (GtkTreeSelection *selection,
|
|
|
|
GtkTreeIter *iter);
|
|
|
|
void gtk_tree_selection_unselect_iter (GtkTreeSelection *selection,
|
|
|
|
GtkTreeIter *iter);
|
2001-10-10 05:35:12 +00:00
|
|
|
gboolean gtk_tree_selection_path_is_selected (GtkTreeSelection *selection,
|
|
|
|
GtkTreePath *path);
|
|
|
|
gboolean gtk_tree_selection_iter_is_selected (GtkTreeSelection *selection,
|
|
|
|
GtkTreeIter *iter);
|
2000-10-05 01:04:57 +00:00
|
|
|
void gtk_tree_selection_select_all (GtkTreeSelection *selection);
|
|
|
|
void gtk_tree_selection_unselect_all (GtkTreeSelection *selection);
|
|
|
|
void gtk_tree_selection_select_range (GtkTreeSelection *selection,
|
|
|
|
GtkTreePath *start_path,
|
|
|
|
GtkTreePath *end_path);
|
2002-06-05 21:25:52 +00:00
|
|
|
void gtk_tree_selection_unselect_range (GtkTreeSelection *selection,
|
|
|
|
GtkTreePath *start_path,
|
|
|
|
GtkTreePath *end_path);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
2005-06-21 05:35:43 +00:00
|
|
|
G_END_DECLS
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
#endif /* __GTK_TREE_SELECTION_H__ */
|