The Gnome Chemistry Utils  0.14.0
grid.h
Go to the documentation of this file.
1 /*
2  * Gnome Crystal
3  * grid.h
4  *
5  * Copyright (C) 2010-2012 Jean Bréfort <jean.brefort@normalesup.org>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20  * USA
21  */
22 
23 #ifndef GCR_GRID_H
24 #define GCR_GRID_H
25 
33 #include <gtk/gtk.h>
34 
35 G_BEGIN_DECLS
36 
38 #define GCR_TYPE_GRID (gcr_grid_get_type ())
39 
44 #define GCR_GRID(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GCR_TYPE_GRID, GcrGrid))
45 
48 #define GCR_IS_GRID(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GCR_TYPE_GRID))
49 
58 typedef struct _GcrGrid GcrGrid;
59 
60 GType gcr_grid_get_type (void);
61 
72 GtkWidget *gcr_grid_new (char const *col_title, GType col_type,...);
73 
83 int gcr_grid_get_int (GcrGrid *grid, unsigned row, unsigned column);
84 
94 unsigned gcr_grid_get_uint (GcrGrid *grid, unsigned row, unsigned column);
95 
105 double gcr_grid_get_double (GcrGrid *grid, unsigned row, unsigned column);
106 
116 char const *gcr_grid_get_string (GcrGrid *grid, unsigned row, unsigned column);
117 
127 bool gcr_grid_get_boolean (GcrGrid *grid, unsigned row, unsigned column);
128 
138 void gcr_grid_set_int (GcrGrid *grid, unsigned row, unsigned column, int value);
139 
149 void gcr_grid_set_uint (GcrGrid *grid, unsigned row, unsigned column, unsigned value);
150 
160 void gcr_grid_set_double (GcrGrid *grid, unsigned row, unsigned column, double value);
161 
171 void gcr_grid_set_string (GcrGrid *grid, unsigned row, unsigned column, char const *value);
172 
182 void gcr_grid_set_boolean (GcrGrid *grid, unsigned row, unsigned column, bool value);
183 
191 unsigned gcr_grid_append_row (GcrGrid *grid,...);
192 
199 void gcr_grid_delete_row (GcrGrid *grid, unsigned row);
200 
207 
213 void gcr_grid_delete_all (GcrGrid *grid);
214 
220 void gcr_grid_select_all (GcrGrid *grid);
221 
230 void gcr_grid_customize_column (GcrGrid *grid, unsigned column, unsigned chars, bool editable);
231 
238 void gcr_grid_set_allow_multiple_selection (GcrGrid *grid, bool allow);
239 
247 void gcr_grid_add_row_to_selection (GcrGrid *grid, unsigned row);
248 
255 void gcr_grid_unselect_row (GcrGrid *grid, unsigned row);
256 
257 
264 typedef void (*GridCb) (unsigned i, void *user_data);
265 
273 void gcr_grid_for_each_selected (GcrGrid *grid, GridCb cb, void *user_data);
274 G_END_DECLS
275 
276 #endif // GCR_GRID_H