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 #ifndef __GDAUI_COMBO_H__ 21 #define __GDAUI_COMBO_H__ 22 23 #include <gtk/gtk.h> 24 #include <libgda/libgda.h> 25 26 G_BEGIN_DECLS 27 28 #define GDAUI_TYPE_COMBO (gdaui_combo_get_type()) 29 #define GDAUI_COMBO(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GDAUI_TYPE_COMBO, GdauiCombo)) 30 #define GDAUI_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GDAUI_TYPE_COMBO, GdauiComboClass)) 31 #define GDAUI_IS_COMBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GDAUI_TYPE_COMBO)) 32 #define GDAUI_IS_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDAUI_TYPE_COMBO)) 33 34 typedef struct _GdauiCombo GdauiCombo; 35 typedef struct _GdauiComboClass GdauiComboClass; 36 typedef struct _GdauiComboPrivate GdauiComboPrivate; 37 38 struct _GdauiCombo { 39 GtkComboBox object; 40 GdauiComboPrivate *priv; 41 }; 42 43 struct _GdauiComboClass { 44 GtkComboBoxClass parent_class; 45 }; 46 47 /** 48 * SECTION:gdaui-combo 49 * @short_description: Combo box to choose from the contents of a #GdaDataModel 50 * @title: GdauiCombo 51 * @stability: Stable 52 * @Image: vi-combo.png 53 * @see_also: 54 */ 55 56 GType gdaui_combo_get_type (void) G_GNUC_CONST; 57 58 GtkWidget *gdaui_combo_new (void); 59 GtkWidget *gdaui_combo_new_with_model (GdaDataModel *model, gint n_cols, gint *cols_index); 60 61 void gdaui_combo_set_model (GdauiCombo *combo, GdaDataModel *model, gint n_cols, gint *cols_index); 62 void gdaui_combo_set_data (GdauiCombo *combo, GdaDataModel *model, gint n_cols, gint *cols_index); 63 void gdaui_combo_add_null (GdauiCombo *combo, gboolean add_null); 64 gboolean gdaui_combo_is_null_selected (GdauiCombo *combo); 65 66 67 /* private API */ 68 gboolean _gdaui_combo_set_selected (GdauiCombo *combo, const GSList *values); 69 GSList *_gdaui_combo_get_selected (GdauiCombo *combo); 70 gboolean _gdaui_combo_set_selected_ext (GdauiCombo *combo, const GSList *values, gint *cols_index); 71 GSList *_gdaui_combo_get_selected_ext (GdauiCombo *combo, gint n_cols, gint *cols_index); 72 73 74 G_END_DECLS 75 76 #endif 77