1 /*
2  * Copyright (C) 2009 - 2012 Vivien Malerba <malerba@gnome-db.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA  02110-1301, USA.
18  */
19 
20 #ifndef __GDAUI_RAW_GRID__
21 #define __GDAUI_RAW_GRID__
22 
23 #include <gtk/gtk.h>
24 
25 G_BEGIN_DECLS
26 
27 #define GDAUI_TYPE_RAW_GRID          (gdaui_raw_grid_get_type())
28 #define GDAUI_RAW_GRID(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, gdaui_raw_grid_get_type(), GdauiRawGrid)
29 #define GDAUI_RAW_GRID_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gdaui_raw_grid_get_type (), GdauiRawGridClass)
30 #define GDAUI_IS_RAW_GRID(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, gdaui_raw_grid_get_type ())
31 
32 
33 typedef struct _GdauiRawGrid      GdauiRawGrid;
34 typedef struct _GdauiRawGridClass GdauiRawGridClass;
35 typedef struct _GdauiRawGridPriv  GdauiRawGridPriv;
36 
37 /* struct for the object's data */
38 struct _GdauiRawGrid
39 {
40 	GtkTreeView         object;
41 
42 	GdauiRawGridPriv   *priv;
43 };
44 
45 /* struct for the object's class */
46 struct _GdauiRawGridClass
47 {
48 	GtkTreeViewClass    parent_class;
49 
50 	void             (* double_clicked)    (GdauiRawGrid *grid, gint row);
51         void             (* populate_popup)    (GdauiRawGrid *grid, GtkMenu *menu);
52 };
53 
54 /**
55  * SECTION:gdaui-raw-grid
56  * @short_description: Grid widget to manipulate data in a #GdaDataModel
57  * @title: GdauiRawGrid
58  * @stability: Stable
59  * @Image: vi-raw-grid.png
60  * @see_also: the #GdauiGrid widget which uses the #GdauiRawGrid and adds decorations such as information about data model size, and features searching.
61  *
62  * The #GdauiGrid widget which uses the #GdauiRawGrid and adds decorations such as
63  * information about data model size, and features searching.
64  */
65 
66 GType      gdaui_raw_grid_get_type              (void) G_GNUC_CONST;
67 
68 GtkWidget *gdaui_raw_grid_new                   (GdaDataModel *model);
69 
70 void       gdaui_raw_grid_set_sample_size       (GdauiRawGrid *grid, gint sample_size);
71 void       gdaui_raw_grid_set_sample_start      (GdauiRawGrid *grid, gint sample_start);
72 
73 void       gdaui_raw_grid_set_layout_from_file  (GdauiRawGrid *grid, const gchar *file_name, const gchar *grid_name);
74 
75 typedef void (*GdauiRawGridFormatFunc) (GtkCellRenderer *cell, GtkTreeViewColumn *column, gint column_pos, GdaDataModel *model, gint row, gpointer data);
76 void       gdaui_raw_grid_add_formatting_function (GdauiRawGrid *grid, GdauiRawGridFormatFunc func,
77 						   gpointer data, GDestroyNotify dnotify);
78 void       gdaui_raw_grid_remove_formatting_function (GdauiRawGrid *grid, GdauiRawGridFormatFunc func);
79 
80 /* private API */
81 GList     *_gdaui_raw_grid_get_selection        (GdauiRawGrid *grid);
82 
83 G_END_DECLS
84 
85 #endif
86 
87 
88 
89