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 * 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_TABLE_GROUP_H_ 28 #define _E_TABLE_GROUP_H_ 29 30 #include <libgnomecanvas/libgnomecanvas.h> 31 32 #include <e-util/e-misc-utils.h> 33 #include <e-util/e-printable.h> 34 #include <e-util/e-table-defines.h> 35 #include <e-util/e-table-header.h> 36 #include <e-util/e-table-model.h> 37 #include <e-util/e-table-sort-info.h> 38 39 /* Standard GObject macros */ 40 #define E_TYPE_TABLE_GROUP \ 41 (e_table_group_get_type ()) 42 #define E_TABLE_GROUP(obj) \ 43 (G_TYPE_CHECK_INSTANCE_CAST \ 44 ((obj), E_TYPE_TABLE_GROUP, ETableGroup)) 45 #define E_TABLE_GROUP_CLASS(cls) \ 46 (G_TYPE_CHECK_CLASS_CAST \ 47 ((cls), E_TYPE_TABLE_GROUP, ETableGroupClass)) 48 #define E_IS_TABLE_GROUP(obj) \ 49 (G_TYPE_CHECK_INSTANCE_TYPE \ 50 ((obj), E_TYPE_TABLE_GROUP)) 51 #define E_IS_TABLE_GROUP_CLASS(cls) \ 52 (G_TYPE_CHECK_CLASS_TYPE \ 53 ((cls), E_TYPE_TABLE_GROUP)) 54 #define E_TABLE_GROUP_GET_CLASS(obj) \ 55 (G_TYPE_INSTANCE_GET_CLASS \ 56 ((obj), E_TYPE_TABLE_GROUP, ETableGroupClass)) 57 58 G_BEGIN_DECLS 59 60 typedef struct _ETableGroup ETableGroup; 61 typedef struct _ETableGroupClass ETableGroupClass; 62 63 struct _ETableGroup { 64 GnomeCanvasGroup group; 65 66 /* 67 * The full header. 68 */ 69 ETableHeader *full_header; 70 ETableHeader *header; 71 72 /* 73 * The model we pull data from. 74 */ 75 ETableModel *model; 76 77 /* 78 * Whether we should add indentation and open/close markers, 79 * or if we just act as containers of subtables. 80 */ 81 guint transparent : 1; 82 83 guint has_focus : 1; 84 85 guint frozen : 1; 86 }; 87 88 struct _ETableGroupClass { 89 GnomeCanvasGroupClass parent_class; 90 91 /* Signals */ 92 void (*cursor_change) (ETableGroup *table_group, 93 gint row); 94 void (*cursor_activated) (ETableGroup *table_group, 95 gint row); 96 void (*double_click) (ETableGroup *table_group, 97 gint row, 98 gint col, 99 GdkEvent *event); 100 gboolean (*right_click) (ETableGroup *table_group, 101 gint row, 102 gint col, 103 GdkEvent *event); 104 gboolean (*click) (ETableGroup *table_group, 105 gint row, 106 gint col, 107 GdkEvent *event); 108 gboolean (*key_press) (ETableGroup *table_group, 109 gint row, 110 gint col, 111 GdkEvent *event); 112 gint (*start_drag) (ETableGroup *table_group, 113 gint row, 114 gint col, 115 GdkEvent *event); 116 117 /* Virtual functions. */ 118 void (*add) (ETableGroup *table_group, 119 gint row); 120 void (*add_array) (ETableGroup *table_group, 121 const gint *array, 122 gint count); 123 void (*add_all) (ETableGroup *table_group); 124 gboolean (*remove) (ETableGroup *table_group, 125 gint row); 126 gint (*row_count) (ETableGroup *table_group); 127 void (*increment) (ETableGroup *table_group, 128 gint position, 129 gint amount); 130 void (*decrement) (ETableGroup *table_group, 131 gint position, 132 gint amount); 133 void (*set_focus) (ETableGroup *table_group, 134 EFocus direction, 135 gint view_col); 136 gboolean (*get_focus) (ETableGroup *table_group); 137 gint (*get_focus_column) (ETableGroup *table_group); 138 EPrintable * (*get_printable) (ETableGroup *table_group); 139 void (*compute_location) (ETableGroup *table_group, 140 gint *x, 141 gint *y, 142 gint *row, 143 gint *col); 144 void (*get_mouse_over) (ETableGroup *table_group, 145 gint *row, 146 gint *col); 147 void (*get_cell_geometry) (ETableGroup *table_group, 148 gint *row, 149 gint *col, 150 gint *x, 151 gint *y, 152 gint *width, 153 gint *height); 154 }; 155 156 GType e_table_group_get_type (void) G_GNUC_CONST; 157 ETableGroup * e_table_group_new (GnomeCanvasGroup *parent, 158 ETableHeader *full_header, 159 ETableHeader *header, 160 ETableModel *model, 161 ETableSortInfo *sort_info, 162 gint n); 163 void e_table_group_construct (GnomeCanvasGroup *parent, 164 ETableGroup *table_group, 165 ETableHeader *full_header, 166 ETableHeader *header, 167 ETableModel *model); 168 169 /* Virtual functions */ 170 void e_table_group_add (ETableGroup *table_group, 171 gint row); 172 void e_table_group_add_array (ETableGroup *table_group, 173 const gint *array, 174 gint count); 175 void e_table_group_add_all (ETableGroup *table_group); 176 gboolean e_table_group_remove (ETableGroup *table_group, 177 gint row); 178 void e_table_group_increment (ETableGroup *table_group, 179 gint position, 180 gint amount); 181 void e_table_group_decrement (ETableGroup *table_group, 182 gint position, 183 gint amount); 184 gint e_table_group_row_count (ETableGroup *table_group); 185 void e_table_group_set_focus (ETableGroup *table_group, 186 EFocus direction, 187 gint view_col); 188 gboolean e_table_group_get_focus (ETableGroup *table_group); 189 gint e_table_group_get_focus_column (ETableGroup *table_group); 190 ETableHeader * e_table_group_get_header (ETableGroup *table_group); 191 EPrintable * e_table_group_get_printable (ETableGroup *table_group); 192 void e_table_group_compute_location (ETableGroup *table_group, 193 gint *x, 194 gint *y, 195 gint *row, 196 gint *col); 197 void e_table_group_get_mouse_over (ETableGroup *table_group, 198 gint *row, 199 gint *col); 200 void e_table_group_get_cell_geometry (ETableGroup *table_group, 201 gint *row, 202 gint *col, 203 gint *x, 204 gint *y, 205 gint *width, 206 gint *height); 207 208 /* For emitting the signals */ 209 void e_table_group_cursor_change (ETableGroup *table_group, 210 gint row); 211 void e_table_group_cursor_activated (ETableGroup *table_group, 212 gint row); 213 void e_table_group_double_click (ETableGroup *table_group, 214 gint row, 215 gint col, 216 GdkEvent *event); 217 gboolean e_table_group_right_click (ETableGroup *table_group, 218 gint row, 219 gint col, 220 GdkEvent *event); 221 gboolean e_table_group_click (ETableGroup *table_group, 222 gint row, 223 gint col, 224 GdkEvent *event); 225 gboolean e_table_group_key_press (ETableGroup *table_group, 226 gint row, 227 gint col, 228 GdkEvent *event); 229 gint e_table_group_start_drag (ETableGroup *table_group, 230 gint row, 231 gint col, 232 GdkEvent *event); 233 234 typedef void (*ETableGroupLeafFn) (gpointer e_table_item, gpointer closure); 235 void e_table_group_apply_to_leafs (ETableGroup *table_group, 236 ETableGroupLeafFn fn, 237 gpointer closure); 238 239 gboolean e_table_group_is_editing (ETableGroup *table_group); 240 241 G_END_DECLS 242 243 #endif /* _E_TABLE_GROUP_H_ */ 244