Update.
[gnt.git] / gntcombobox.h
blob4965e4b15c4481a61dfebb6a1aa0f8023395e3b3
1 /**
2 * @file gntcombobox.h Combobox API
3 * @ingroup gnt
4 */
5 /*
6 * GNT - The GLib Ncurses Toolkit
8 * GNT is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #ifndef GNT_COMBO_BOX_H
28 #define GNT_COMBO_BOX_H
30 #include "gnt.h"
31 #include "gntcolors.h"
32 #include "gntkeys.h"
33 #include "gntwidget.h"
35 #define GNT_TYPE_COMBO_BOX (gnt_combo_box_get_gtype())
36 #define GNT_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_COMBO_BOX, GntComboBox))
37 #define GNT_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_COMBO_BOX, GntComboBoxClass))
38 #define GNT_IS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_COMBO_BOX))
39 #define GNT_IS_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_COMBO_BOX))
40 #define GNT_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_COMBO_BOX, GntComboBoxClass))
42 #define GNT_COMBO_BOX_FLAGS(obj) (GNT_COMBO_BOX(obj)->priv.flags)
43 #define GNT_COMBO_BOX_SET_FLAGS(obj, flags) (GNT_COMBO_BOX_FLAGS(obj) |= flags)
44 #define GNT_COMBO_BOX_UNSET_FLAGS(obj, flags) (GNT_COMBO_BOX_FLAGS(obj) &= ~(flags))
46 typedef struct _GntComboBox GntComboBox;
47 typedef struct _GntComboBoxPriv GntComboBoxPriv;
48 typedef struct _GntComboBoxClass GntComboBoxClass;
50 struct _GntComboBox
52 GntWidget parent;
54 GntWidget *dropdown; /* This is a GntTree */
56 void *selected; /* Currently selected key */
59 struct _GntComboBoxClass
61 GntWidgetClass parent;
63 void (*gnt_reserved1)(void);
64 void (*gnt_reserved2)(void);
65 void (*gnt_reserved3)(void);
66 void (*gnt_reserved4)(void);
69 G_BEGIN_DECLS
71 /**
72 * @return Get the GType for GntComboBox
74 GType gnt_combo_box_get_gtype(void);
76 /**
77 * Create a new GntComboBox
79 * @return A new GntComboBox
81 GntWidget * gnt_combo_box_new(void);
83 /**
84 * Add an entry
86 * @param box The GntComboBox
87 * @param key The data
88 * @param text The text to display
90 void gnt_combo_box_add_data(GntComboBox *box, gpointer key, const char *text);
92 /**
93 * Remove an entry
95 * @param box The GntComboBox
96 * @param key The data to be removed
98 void gnt_combo_box_remove(GntComboBox *box, gpointer key);
101 * Remove all entries
103 * @param box The GntComboBox
105 void gnt_combo_box_remove_all(GntComboBox *box);
108 * Get the data that is currently selected
110 * @param box The GntComboBox
112 * @return The data of the currently selected entry
114 gpointer gnt_combo_box_get_selected_data(GntComboBox *box);
117 * Set the current selection to a specific entry
119 * @param box The GntComboBox
120 * @param key The data to be set to
122 void gnt_combo_box_set_selected(GntComboBox *box, gpointer key);
124 G_END_DECLS
126 #endif /* GNT_COMBO_BOX_H */