1 /* 2 * Copyright (C) 2009 - 2011 Vivien Malerba <malerba@gnome-db.org> 3 * Copyright (C) 2013 Daniel Espinosa <esodan@gmail.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library 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 GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __GDAUI_SET__ 22 #define __GDAUI_SET__ 23 24 #include <gtk/gtk.h> 25 #include <libgda/gda-decl.h> 26 27 G_BEGIN_DECLS 28 29 #define GDAUI_TYPE_SET (gdaui_set_get_type()) 30 #define GDAUI_SET(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gdaui_set_get_type(), GdauiSet) 31 #define GDAUI_SET_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gdaui_set_get_type (), GdauiSetClass) 32 #define GDAUI_IS_SET(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gdaui_set_get_type ()) 33 34 35 typedef struct _GdauiSet GdauiSet; 36 typedef struct _GdauiSetClass GdauiSetClass; 37 typedef struct _GdauiSetPriv GdauiSetPriv; 38 39 typedef struct _GdauiSetGroup GdauiSetGroup; 40 typedef struct _GdauiSetSource GdauiSetSource; 41 42 #ifdef GSEAL_ENABLE 43 #else 44 struct _GdauiSetGroup { 45 GdaSetGroup* GSEAL(group); 46 GdauiSetSource* GSEAL(source); /* if NULL, then @group->nodes contains exactly one entry */ 47 48 /*< private >*/ 49 /* Padding for future expansion */ 50 gpointer GSEAL(_gda_reserved1); 51 gpointer GSEAL(_gda_reserved2); 52 }; 53 #endif 54 55 #define GDAUI_TYPE_SET_GROUP (gdaui_set_group_get_type ()) 56 #define GDAUI_SET_GROUP(x) ((GdauiSetGroup*)(x)) 57 58 GType gdaui_set_group_get_type (void) G_GNUC_CONST; 59 GdauiSetGroup *gdaui_set_group_new (GdaSetGroup *group); 60 void gdaui_set_group_free (GdauiSetGroup *sg); 61 GdauiSetGroup *gdaui_set_group_copy (GdauiSetGroup *sg); 62 void gdaui_set_group_set_source (GdauiSetGroup *sg, GdauiSetSource *source); 63 GdauiSetSource *gdaui_set_group_get_source (GdauiSetGroup *sg); 64 void gdaui_set_group_set_group (GdauiSetGroup *sg, GdaSetGroup *group); 65 GdaSetGroup *gdaui_set_group_get_group (GdauiSetGroup *sg); 66 67 #ifdef GSEAL_ENABLE 68 #else 69 struct _GdauiSetSource { 70 GdaSetSource* GSEAL(source); 71 72 /* displayed columns in 'source->data_model' */ 73 gint GSEAL(shown_n_cols); 74 gint* GSEAL(shown_cols_index); 75 76 /* columns used as a reference (corresponding to PK values) in 'source->data_model' */ 77 gint GSEAL(ref_n_cols); 78 gint* GSEAL(ref_cols_index); 79 80 /*< private >*/ 81 /* Padding for future expansion */ 82 gpointer GSEAL(_gda_reserved1); 83 gpointer GSEAL(_gda_reserved2); 84 gpointer GSEAL(_gda_reserved3); 85 gpointer GSEAL(_gda_reserved4); 86 }; 87 #endif 88 89 #define GDAUI_TYPE_SET_SOURCE (gdaui_set_source_get_type ()) 90 #define GDAUI_SET_SOURCE(x) ((GdauiSetSource*)(x)) 91 GType gdaui_set_source_get_type (void) G_GNUC_CONST; 92 GdauiSetSource *gdaui_set_source_new (GdaSetSource *source); 93 void gdaui_set_source_free (GdauiSetSource *s); 94 GdauiSetSource *gdaui_set_source_copy (GdauiSetSource *s); 95 void gdaui_set_source_set_source (GdauiSetSource *s, GdaSetSource *source); 96 GdaSetSource *gdaui_set_source_get_source (GdauiSetSource*s); 97 gint gdaui_set_source_get_shown_n_cols (GdauiSetSource *s); 98 gint* gdaui_set_source_get_shown_columns (GdauiSetSource *s); 99 void gdaui_set_source_set_shown_columns (GdauiSetSource *s, gint *columns, gint n_columns); 100 gint gdaui_set_source_get_ref_n_cols (GdauiSetSource *s); 101 gint* gdaui_set_source_get_ref_columns (GdauiSetSource *s); 102 void gdaui_set_source_set_ref_columns (GdauiSetSource *s, gint *columns, gint n_columns); 103 104 105 /* struct for the object's data */ 106 /* FIXME: public members of GdauiSet must be SEALED! */ 107 /** 108 * GdauiSet: 109 * @sources_list: (element-type Gdaui.SetSource): list of #GdauiSetSource 110 * @groups_list: (element-type Gdaui.SetGroup): list of #GdauiSetGroup 111 */ 112 struct _GdauiSet 113 { 114 GObject object; 115 GdauiSetPriv *priv; 116 117 /*< public >*/ 118 GSList *sources_list; /* list of GdauiSetSource */ 119 GSList *groups_list; /* list of GdauiSetGroup */ 120 }; 121 122 /* struct for the object's class */ 123 struct _GdauiSetClass 124 { 125 GObjectClass parent_class; 126 void (*public_data_changed) (GdauiSet *set); 127 void (*source_model_changed) (GdauiSet *set, GdauiSetSource *source); 128 }; 129 130 /* 131 * Generic widget's methods 132 */ 133 GType gdaui_set_get_type (void) G_GNUC_CONST; 134 GdauiSet *gdaui_set_new (GdaSet *set); 135 GdauiSetGroup *gdaui_set_get_group (GdauiSet *dbset, GdaHolder *holder); 136 137 /* Deprecated functions */ 138 GType _gdaui_set_get_type (void); 139 GdauiSet *_gdaui_set_new (GdaSet *set); 140 GdauiSetGroup *_gdaui_set_get_group (GdauiSet *dbset, GdaHolder *holder); 141 G_END_DECLS 142 143 #endif 144 145 146 147