1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2011 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Library General Public
22 * License as published by the Free Software Foundation; either
23 * version 2 of the License, or (at your option) any later version.
25 * This library is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Library General Public License for more details.
30 * You should have received a copy of the GNU Library General Public
31 * License along with this library; if not, write to the
32 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
33 * Boston, MA 02111-1307, USA.
36 #ifndef __PSPP_SHEET_SELECTION_H__
37 #define __PSPP_SHEET_SELECTION_H__
44 #define PSPP_TYPE_SHEET_SELECTION (pspp_sheet_selection_get_type ())
45 #define PSPP_SHEET_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPP_TYPE_SHEET_SELECTION, PsppSheetSelection))
46 #define PSPP_SHEET_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PSPP_TYPE_SHEET_SELECTION, PsppSheetSelectionClass))
47 #define PSPP_IS_SHEET_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPP_TYPE_SHEET_SELECTION))
48 #define PSPP_IS_SHEET_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPP_TYPE_SHEET_SELECTION))
49 #define PSPP_SHEET_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PSPP_TYPE_SHEET_SELECTION, PsppSheetSelectionClass))
53 /* Same as GtkSelectionMode. */
54 PSPP_SHEET_SELECTION_NONE = GTK_SELECTION_NONE,
55 PSPP_SHEET_SELECTION_SINGLE = GTK_SELECTION_SINGLE,
56 PSPP_SHEET_SELECTION_BROWSE = GTK_SELECTION_BROWSE,
57 PSPP_SHEET_SELECTION_MULTIPLE = GTK_SELECTION_MULTIPLE,
59 /* PsppSheetView extension. */
60 PSPP_SHEET_SELECTION_RECTANGLE = 10
62 PsppSheetSelectionMode;
64 typedef gboolean (* PsppSheetSelectionFunc) (PsppSheetSelection *selection,
67 gboolean path_currently_selected,
69 typedef void (* PsppSheetSelectionForeachFunc) (GtkTreeModel *model,
74 struct _PsppSheetSelection
80 PsppSheetView *PSEAL (tree_view);
81 PsppSheetSelectionMode PSEAL (type);
84 struct _PsppSheetSelectionClass
86 GObjectClass parent_class;
88 void (* changed) (PsppSheetSelection *selection);
90 /* Padding for future expansion */
91 void (*_gtk_reserved1) (void);
92 void (*_gtk_reserved2) (void);
93 void (*_gtk_reserved3) (void);
94 void (*_gtk_reserved4) (void);
98 GType pspp_sheet_selection_get_type (void) G_GNUC_CONST;
100 void pspp_sheet_selection_set_mode (PsppSheetSelection *selection,
101 PsppSheetSelectionMode type);
102 PsppSheetSelectionMode pspp_sheet_selection_get_mode (PsppSheetSelection *selection);
103 void pspp_sheet_selection_set_select_function (PsppSheetSelection *selection,
104 PsppSheetSelectionFunc func,
106 GDestroyNotify destroy);
107 gpointer pspp_sheet_selection_get_user_data (PsppSheetSelection *selection);
108 PsppSheetView* pspp_sheet_selection_get_tree_view (PsppSheetSelection *selection);
110 PsppSheetSelectionFunc pspp_sheet_selection_get_select_function (PsppSheetSelection *selection);
112 /* Only meaningful if PSPP_SHEET_SELECTION_SINGLE or PSPP_SHEET_SELECTION_BROWSE is set */
113 /* Use selected_foreach or get_selected_rows for
114 PSPP_SHEET_SELECTION_MULTIPLE */
115 gboolean pspp_sheet_selection_get_selected (PsppSheetSelection *selection,
116 GtkTreeModel **model,
118 GList * pspp_sheet_selection_get_selected_rows (PsppSheetSelection *selection,
119 GtkTreeModel **model);
120 gint pspp_sheet_selection_count_selected_rows (PsppSheetSelection *selection);
121 void pspp_sheet_selection_selected_foreach (PsppSheetSelection *selection,
122 PsppSheetSelectionForeachFunc func,
124 void pspp_sheet_selection_select_path (PsppSheetSelection *selection,
126 void pspp_sheet_selection_unselect_path (PsppSheetSelection *selection,
128 void pspp_sheet_selection_select_iter (PsppSheetSelection *selection,
130 void pspp_sheet_selection_unselect_iter (PsppSheetSelection *selection,
132 gboolean pspp_sheet_selection_path_is_selected (PsppSheetSelection *selection,
134 gboolean pspp_sheet_selection_iter_is_selected (PsppSheetSelection *selection,
136 void pspp_sheet_selection_select_all (PsppSheetSelection *selection);
137 void pspp_sheet_selection_unselect_all (PsppSheetSelection *selection);
138 void pspp_sheet_selection_select_range (PsppSheetSelection *selection,
139 GtkTreePath *start_path,
140 GtkTreePath *end_path);
141 void pspp_sheet_selection_unselect_range (PsppSheetSelection *selection,
142 GtkTreePath *start_path,
143 GtkTreePath *end_path);
144 struct range_set *pspp_sheet_selection_get_range_set (PsppSheetSelection *selection);
147 GList * pspp_sheet_selection_get_selected_columns (PsppSheetSelection *selection);
148 gint pspp_sheet_selection_count_selected_columns (PsppSheetSelection *selection);
149 void pspp_sheet_selection_select_all_columns (PsppSheetSelection *selection);
150 void pspp_sheet_selection_unselect_all_columns (PsppSheetSelection *selection);
151 void pspp_sheet_selection_select_column (PsppSheetSelection *selection,
152 PsppSheetViewColumn *column);
153 void pspp_sheet_selection_select_column_range (PsppSheetSelection *selection,
154 PsppSheetViewColumn *first,
155 PsppSheetViewColumn *last);
159 #endif /* __PSPP_SHEET_SELECTION_H__ */