1 /*
2  *
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
10  * for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public License
13  * along with this program; if not, see <http://www.gnu.org/licenses/>.
14  *
15  *
16  * Authors:
17  *		Chris Lahey <clahey@ximian.com>
18  *		Miguel de Icaza <miguel@ximian.com>
19  *
20  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
21  *
22  */
23 
24 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
25 #error "Only <e-util/e-util.h> should be included directly."
26 #endif
27 
28 #ifndef E_TABLE_SUBSET_H
29 #define E_TABLE_SUBSET_H
30 
31 #include <e-util/e-table-model.h>
32 
33 /* Standard GObject macros */
34 #define E_TYPE_TABLE_SUBSET \
35 	(e_table_subset_get_type ())
36 #define E_TABLE_SUBSET(obj) \
37 	(G_TYPE_CHECK_INSTANCE_CAST \
38 	((obj), E_TYPE_TABLE_SUBSET, ETableSubset))
39 #define E_TABLE_SUBSET_CLASS(cls) \
40 	(G_TYPE_CHECK_CLASS_CAST \
41 	((cls), E_TYPE_TABLE_SUBSET, ETableSubsetClass))
42 #define E_IS_TABLE_SUBSET(obj) \
43 	(G_TYPE_CHECK_INSTANCE_TYPE \
44 	((obj), E_TYPE_TABLE_SUBSET))
45 #define E_IS_TABLE_SUBSET_CLASS(cls) \
46 	(G_TYPE_CHECK_CLASS_TYPE \
47 	((cls), E_TYPE_TABLE_SUBSET))
48 #define E_TABLE_SUBSET_GET_CLASS(obj) \
49 	(G_TYPE_INSTANCE_GET_CLASS \
50 	((obj), E_TYPE_TABLE_SUBSET, ETableSubsetClass))
51 
52 G_BEGIN_DECLS
53 
54 typedef struct _ETableSubset ETableSubset;
55 typedef struct _ETableSubsetClass ETableSubsetClass;
56 typedef struct _ETableSubsetPrivate ETableSubsetPrivate;
57 
58 struct _ETableSubset {
59 	GObject parent;
60 	ETableSubsetPrivate *priv;
61 
62 	/* protected - subclasses modify this directly */
63 	gint n_map;
64 	gint *map_table;
65 };
66 
67 struct _ETableSubsetClass {
68 	GObjectClass parent_class;
69 
70 	void		(*proxy_model_pre_change)
71 						(ETableSubset *table_subset,
72 						 ETableModel *source_model);
73 	void		(*proxy_model_no_change)
74 						(ETableSubset *table_subset,
75 						 ETableModel *source_model);
76 	void		(*proxy_model_changed)	(ETableSubset *table_subset,
77 						 ETableModel *source_model);
78 	void		(*proxy_model_row_changed)
79 						(ETableSubset *table_subset,
80 						 ETableModel *source_model,
81 						 gint row);
82 	void		(*proxy_model_cell_changed)
83 						(ETableSubset *table_subset,
84 						 ETableModel *source_model,
85 						 gint col,
86 						 gint row);
87 	void		(*proxy_model_rows_inserted)
88 						(ETableSubset *table_subset,
89 						 ETableModel *source_model,
90 						 gint row,
91 						 gint count);
92 	void		(*proxy_model_rows_deleted)
93 						(ETableSubset *table_subset,
94 						 ETableModel *source_model,
95 						 gint row,
96 						 gint count);
97 };
98 
99 GType		e_table_subset_get_type		(void) G_GNUC_CONST;
100 ETableModel *	e_table_subset_new		(ETableModel *source_model,
101 						 gint n_vals);
102 ETableModel *	e_table_subset_construct	(ETableSubset *table_subset,
103 						 ETableModel *source_model,
104 						 gint nvals);
105 ETableModel *	e_table_subset_get_source_model	(ETableSubset *table_subset);
106 gint		e_table_subset_model_to_view_row
107 						(ETableSubset *table_subset,
108 						 gint model_row);
109 gint		e_table_subset_view_to_model_row
110 						(ETableSubset *table_subset,
111 						 gint view_row);
112 ETableModel *	e_table_subset_get_toplevel	(ETableSubset *table_subset);
113 void		e_table_subset_print_debugging	(ETableSubset *table_subset);
114 
115 G_END_DECLS
116 
117 #endif /* E_TABLE_SUBSET_H */
118 
119