finch/libgnt/gntcombobox.h

changeset 39360
e7bed293aad5
parent 39302
64aabebb476b
child 39361
a1068caa3600
equal deleted inserted replaced
39302:64aabebb476b 39360:e7bed293aad5
1 /*
2 * GNT - The GLib Ncurses Toolkit
3 *
4 * GNT is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this
6 * source distribution.
7 *
8 * This library is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 */
22
23 #ifndef GNT_COMBO_BOX_H
24 #define GNT_COMBO_BOX_H
25 /**
26 * SECTION:gntcombobox
27 * @section_id: libgnt-gntcombobox
28 * @short_description: <filename>gntcombobox.h</filename>
29 * @title: Combobox
30 */
31
32 #include "gnt.h"
33 #include "gntcolors.h"
34 #include "gntkeys.h"
35 #include "gntwidget.h"
36
37 #define GNT_TYPE_COMBO_BOX (gnt_combo_box_get_type())
38 #define GNT_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_COMBO_BOX, GntComboBox))
39 #define GNT_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_COMBO_BOX, GntComboBoxClass))
40 #define GNT_IS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_COMBO_BOX))
41 #define GNT_IS_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_COMBO_BOX))
42 #define GNT_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_COMBO_BOX, GntComboBoxClass))
43
44 #define GNT_COMBO_BOX_FLAGS(obj) (GNT_COMBO_BOX(obj)->priv.flags)
45 #define GNT_COMBO_BOX_SET_FLAGS(obj, flags) (GNT_COMBO_BOX_FLAGS(obj) |= flags)
46 #define GNT_COMBO_BOX_UNSET_FLAGS(obj, flags) (GNT_COMBO_BOX_FLAGS(obj) &= ~(flags))
47
48 typedef struct _GntComboBox GntComboBox;
49 typedef struct _GntComboBoxPriv GntComboBoxPriv;
50 typedef struct _GntComboBoxClass GntComboBoxClass;
51
52 struct _GntComboBox
53 {
54 GntWidget parent;
55
56 GntWidget *dropdown; /* This is a GntTree */
57
58 void *selected; /* Currently selected key */
59 };
60
61 struct _GntComboBoxClass
62 {
63 GntWidgetClass parent;
64
65 /*< private >*/
66 void (*gnt_reserved1)(void);
67 void (*gnt_reserved2)(void);
68 void (*gnt_reserved3)(void);
69 void (*gnt_reserved4)(void);
70 };
71
72 G_BEGIN_DECLS
73
74 /**
75 * gnt_combo_box_get_type:
76 *
77 * Returns: Get the GType for GntComboBox
78 */
79 GType gnt_combo_box_get_type(void);
80
81 /**
82 * gnt_combo_box_new:
83 *
84 * Create a new GntComboBox
85 *
86 * Returns: A new GntComboBox
87 */
88 GntWidget * gnt_combo_box_new(void);
89
90 /**
91 * gnt_combo_box_add_data:
92 * @box: The GntComboBox
93 * @key: The data
94 * @text: The text to display
95 *
96 * Add an entry
97 */
98 void gnt_combo_box_add_data(GntComboBox *box, gpointer key, const char *text);
99
100 /**
101 * gnt_combo_box_remove:
102 * @box: The GntComboBox
103 * @key: The data to be removed
104 *
105 * Remove an entry
106 */
107 void gnt_combo_box_remove(GntComboBox *box, gpointer key);
108
109 /**
110 * gnt_combo_box_remove_all:
111 * @box: The GntComboBox
112 *
113 * Remove all entries
114 */
115 void gnt_combo_box_remove_all(GntComboBox *box);
116
117 /**
118 * gnt_combo_box_get_selected_data:
119 * @box: The GntComboBox
120 *
121 * Get the data that is currently selected
122 *
123 * Returns: (transfer none): The data of the currently selected entry
124 */
125 gpointer gnt_combo_box_get_selected_data(GntComboBox *box);
126
127 /**
128 * gnt_combo_box_set_selected:
129 * @box: The GntComboBox
130 * @key: The data to be set to
131 *
132 * Set the current selection to a specific entry
133 */
134 void gnt_combo_box_set_selected(GntComboBox *box, gpointer key);
135
136 G_END_DECLS
137
138 #endif /* GNT_COMBO_BOX_H */

mercurial