1 /* 2 * Copyright (C) 2009 - 2011 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 21 #ifndef __GDAUI_DATA_SELECTOR_H_ 22 #define __GDAUI_DATA_SELECTOR_H_ 23 24 #include <glib-object.h> 25 #include <gtk/gtk.h> 26 #include <libgda/libgda.h> 27 #include "gdaui-decl.h" 28 29 G_BEGIN_DECLS 30 31 #define GDAUI_TYPE_DATA_SELECTOR (gdaui_data_selector_get_type()) 32 #define GDAUI_DATA_SELECTOR(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GDAUI_TYPE_DATA_SELECTOR, GdauiDataSelector) 33 #define GDAUI_IS_DATA_SELECTOR(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GDAUI_TYPE_DATA_SELECTOR) 34 #define GDAUI_DATA_SELECTOR_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDAUI_TYPE_DATA_SELECTOR, GdauiDataSelectorIface)) 35 36 typedef struct _GdauiDataSelectorIface GdauiDataSelectorIface; 37 typedef struct _GdauiDataSelector GdauiDataSelector; 38 39 /* struct for the interface */ 40 struct _GdauiDataSelectorIface 41 { 42 GTypeInterface g_iface; 43 44 /* virtual table */ 45 GdaDataModel *(*get_model) (GdauiDataSelector *iface); 46 void (*set_model) (GdauiDataSelector *iface, GdaDataModel *model); 47 GArray *(*get_selected_rows) (GdauiDataSelector *iface); 48 GdaDataModelIter *(*get_data_set) (GdauiDataSelector *iface); 49 gboolean (*select_row) (GdauiDataSelector *iface, gint row); 50 void (*unselect_row) (GdauiDataSelector *iface, gint row); 51 void (*set_column_visible) (GdauiDataSelector *iface, gint column, gboolean visible); 52 53 /* signals */ 54 void (* selection_changed) (GdauiDataSelector *iface); 55 }; 56 57 /** 58 * SECTION:gdaui-data-selector 59 * @short_description: Selecting data in a #GdaDataModel 60 * @title: GdauiDataSelector 61 * @stability: Stable 62 * @Image: 63 * @see_also: 64 * 65 * The #GdauiDataSelector interface is implemented by widgets which allow the user 66 * to select some data from a #GdaDataModel. Depending on the actual widget, the selection 67 * can be a single row or more than one row. 68 * 69 * This interface allows one to set and get the #GdaDataModel from which data is to be selected 70 * and offers a few other common behaviours. 71 * 72 * Please note that any row number in this interface is in reference to the #GdaDataModel returned by 73 * the gdaui_data_selector_get_model() method. 74 */ 75 76 GType gdaui_data_selector_get_type (void) G_GNUC_CONST; 77 78 GdaDataModel *gdaui_data_selector_get_model (GdauiDataSelector *iface); 79 void gdaui_data_selector_set_model (GdauiDataSelector *iface, GdaDataModel *model); 80 GArray *gdaui_data_selector_get_selected_rows (GdauiDataSelector *iface); 81 GdaDataModelIter *gdaui_data_selector_get_data_set (GdauiDataSelector *iface); 82 gboolean gdaui_data_selector_select_row (GdauiDataSelector *iface, gint row); 83 void gdaui_data_selector_unselect_row (GdauiDataSelector *iface, gint row); 84 void gdaui_data_selector_set_column_visible (GdauiDataSelector *iface, gint column, gboolean visible); 85 86 G_END_DECLS 87 88 #endif 89