1 /*
2  * Copyright (C) 2010 - 2011 Vivien Malerba <malerba@gnome-db.org>
3  * Copyright (C) 2011 Murray Cumming <murrayc@murrayc.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19 
20 #ifndef __UI_FORMGRID__
21 #define __UI_FORMGRID__
22 
23 #include <gtk/gtk.h>
24 #include <libgda/gda-data-model.h>
25 #include <libgda-ui/gdaui-data-proxy-info.h>
26 #include <libgda-ui/gdaui-raw-grid.h>
27 #include "../browser-connection.h"
28 
29 G_BEGIN_DECLS
30 
31 #define UI_TYPE_FORMGRID          (ui_formgrid_get_type())
32 #define UI_FORMGRID(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, ui_formgrid_get_type(), UiFormGrid)
33 #define UI_FORMGRID_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, ui_formgrid_get_type (), UiFormGridClass)
34 #define UI_IS_FORMGRID(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, ui_formgrid_get_type ())
35 
36 
37 typedef struct _UiFormGrid      UiFormGrid;
38 typedef struct _UiFormGridClass UiFormGridClass;
39 typedef struct _UiFormGridPriv  UiFormGridPriv;
40 
41 /* struct for the object's data */
42 struct _UiFormGrid
43 {
44 	GtkBox             object;
45 
46 	UiFormGridPriv     *priv;
47 };
48 
49 /* struct for the object's class */
50 struct _UiFormGridClass
51 {
52 	GtkBoxClass       parent_class;
53 	/* signals */
54 	void             (*data_set_changed) (UiFormGrid *fg);
55 };
56 
57 /**
58  * SECTION:ui-formgrid
59  * @short_description: Widget embedding both a form and a grid to display a #GdaDataModel's contents
60  * @title: UiFormgrid
61  * @stability: Stable
62  * @see_also:
63  */
64 
65 GType             ui_formgrid_get_type            (void);
66 
67 GtkWidget        *ui_formgrid_new                 (GdaDataModel *model, gboolean scroll_form,
68 						   GdauiDataProxyInfoFlag flags);
69 void              ui_formgrid_handle_user_prefs   (UiFormGrid *formgrid, BrowserConnection *bcnc,
70 						   GdaStatement *stmt);
71 
72 GArray           *ui_formgrid_get_selection       (UiFormGrid *formgrid);
73 GdaDataModelIter *ui_formgrid_get_form_data_set   (UiFormGrid *formgrid);
74 GdaDataModelIter *ui_formgrid_get_grid_data_set   (UiFormGrid *formgrid);
75 void              ui_formgrid_set_sample_size     (UiFormGrid *formgrid, gint sample_size);
76 GdauiRawGrid     *ui_formgrid_get_grid_widget     (UiFormGrid *formgrid);
77 
78 void              ui_formgrid_set_connection      (UiFormGrid *formgrid, BrowserConnection *bcnc);
79 GtkUIManager     *ui_formgrid_get_ui_manager      (UiFormGrid *formgrid);
80 
81 G_END_DECLS
82 
83 #endif
84 
85 
86 
87