1 /*
2  * This program is free software; you can redistribute it and/or modify it
3  * under the terms of the GNU Lesser General Public License as published by
4  * the Free Software Foundation.
5  *
6  * This program is distributed in the hope that it will be useful, but
7  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9  * for more details.
10  *
11  * You should have received a copy of the GNU Lesser General Public License
12  * along with this program; if not, see <http://www.gnu.org/licenses/>.
13  *
14  *
15  * Authors:
16  *		Chris Lahey <clahey@ximian.com>
17  *		Chris Toshok <toshok@ximian.com>
18  *
19  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
20  *
21  */
22 
23 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
24 #error "Only <e-util/e-util.h> should be included directly."
25 #endif
26 
27 #ifndef E_TREE_TABLE_ADAPTER_H
28 #define E_TREE_TABLE_ADAPTER_H
29 
30 #include <libxml/tree.h>
31 
32 #include <e-util/e-table-header.h>
33 #include <e-util/e-table-model.h>
34 #include <e-util/e-table-sort-info.h>
35 #include <e-util/e-tree-model.h>
36 
37 /* Standard GObject macros */
38 #define E_TYPE_TREE_TABLE_ADAPTER \
39 	(e_tree_table_adapter_get_type ())
40 #define E_TREE_TABLE_ADAPTER(obj) \
41 	(G_TYPE_CHECK_INSTANCE_CAST \
42 	((obj), E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapter))
43 #define E_TREE_TABLE_ADAPTER_CLASS(cls) \
44 	(G_TYPE_CHECK_CLASS_CAST \
45 	((cls), E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapterClass))
46 #define E_IS_TREE_TABLE_ADAPTER(obj) \
47 	(G_TYPE_CHECK_INSTANCE_TYPE \
48 	((obj), E_TYPE_TREE_TABLE_ADAPTER))
49 #define E_IS_TREE_TABLE_ADAPTER_CLASS(cls) \
50 	(G_TYPE_CHECK_CLASS_TYPE \
51 	((cls), E_TYPE_TREE_TABLE_ADAPTER))
52 #define E_TREE_TABLE_ADAPTER_GET_CLASS(obj) \
53 	(G_TYPE_INSTANCE_GET_CLASS \
54 	((obj), E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapterClass))
55 
56 G_BEGIN_DECLS
57 
58 typedef struct _ETreeTableAdapter ETreeTableAdapter;
59 typedef struct _ETreeTableAdapterClass ETreeTableAdapterClass;
60 typedef struct _ETreeTableAdapterPrivate ETreeTableAdapterPrivate;
61 
62 struct _ETreeTableAdapter {
63 	GObject parent;
64 	ETreeTableAdapterPrivate *priv;
65 };
66 
67 struct _ETreeTableAdapterClass {
68 	GObjectClass parent_class;
69 
70 	/* Signals */
71 	gboolean	(*sorting_changed)	(ETreeTableAdapter *etta);
72 };
73 
74 GType		e_tree_table_adapter_get_type	(void) G_GNUC_CONST;
75 ETableModel *	e_tree_table_adapter_new	(ETreeModel *source_model,
76 						 ETableSortInfo *sort_info,
77 						 ETableHeader *header);
78 ETableHeader *	e_tree_table_adapter_get_header	(ETreeTableAdapter *etta);
79 ETableSortInfo *e_tree_table_adapter_get_sort_info
80 						(ETreeTableAdapter *etta);
81 void		e_tree_table_adapter_set_sort_info
82 						(ETreeTableAdapter *etta,
83 						 ETableSortInfo *sort_info);
84 gboolean	e_tree_table_adapter_get_sort_children_ascending
85 						(ETreeTableAdapter *etta);
86 void		e_tree_table_adapter_set_sort_children_ascending
87 						(ETreeTableAdapter *etta,
88 						 gboolean sort_children_ascending);
89 ETreeModel *	e_tree_table_adapter_get_source_model
90 						(ETreeTableAdapter *etta);
91 
92 ETreePath	e_tree_table_adapter_node_get_next
93 						(ETreeTableAdapter *etta,
94 						 ETreePath path);
95 gboolean	e_tree_table_adapter_node_is_expanded
96 						(ETreeTableAdapter *etta,
97 						 ETreePath path);
98 void		e_tree_table_adapter_node_set_expanded
99 						(ETreeTableAdapter *etta,
100 						 ETreePath path,
101 						 gboolean expanded);
102 void		e_tree_table_adapter_node_set_expanded_recurse
103 						(ETreeTableAdapter *etta,
104 						 ETreePath path,
105 						 gboolean expanded);
106 void		e_tree_table_adapter_force_expanded_state
107 						(ETreeTableAdapter *etta,
108 						 gint state);
109 void		e_tree_table_adapter_root_node_set_visible
110 						(ETreeTableAdapter *etta,
111 						 gboolean visible);
112 ETreePath	e_tree_table_adapter_node_at_row
113 						(ETreeTableAdapter *etta,
114 						 gint row);
115 gint		e_tree_table_adapter_row_of_node
116 						(ETreeTableAdapter *etta,
117 						 ETreePath path);
118 gboolean	e_tree_table_adapter_root_node_is_visible
119 						(ETreeTableAdapter *etta);
120 
121 void		e_tree_table_adapter_show_node	(ETreeTableAdapter *etta,
122 						 ETreePath path);
123 
124 void		e_tree_table_adapter_save_expanded_state
125 						(ETreeTableAdapter *etta,
126 						 const gchar *filename);
127 void		e_tree_table_adapter_load_expanded_state
128 						(ETreeTableAdapter *etta,
129 						 const gchar *filename);
130 
131 xmlDoc *	e_tree_table_adapter_save_expanded_state_xml
132 						(ETreeTableAdapter *etta);
133 void		e_tree_table_adapter_load_expanded_state_xml
134 						(ETreeTableAdapter *etta,
135 						 xmlDoc *doc);
136 void		e_tree_table_adapter_clear_nodes_silent
137 						(ETreeTableAdapter *etta);
138 
139 G_END_DECLS
140 
141 #endif /* E_TREE_TABLE_ADAPTER_H */
142