remove unnecessary cm_return_val_if_fail()
[claws.git] / src / gtk / combobox.h
blobdbd98935c2c3334ef3483969c42b34a439a87b7b
1 /*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2012 Andrej Kacian and the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program 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
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __COMBOBOX_H__
21 #define __COMBOBOX_H__
23 #include <glib.h>
24 #include <gtk/gtk.h>
26 enum {
27 COMBOBOX_TEXT,
28 COMBOBOX_DATA,
29 COMBOBOX_SENS
33 #define COMBOBOX_ADD(menu, label, data) \
34 { \
35 gtk_list_store_append(menu, &iter); \
36 gtk_list_store_set(menu, &iter, \
37 COMBOBOX_TEXT, label, \
38 COMBOBOX_DATA, data, \
39 COMBOBOX_SENS, TRUE, \
40 -1); \
43 #define COMBOBOX_ADD_ESCAPED(menu, label, data) \
44 { \
45 gchar *tmp_esc = g_markup_printf_escaped("%s", label); \
46 gtk_list_store_append(menu, &iter); \
47 gtk_list_store_set(menu, &iter, \
48 COMBOBOX_TEXT, (tmp_esc ? tmp_esc : ""), \
49 COMBOBOX_DATA, data, \
50 COMBOBOX_SENS, TRUE, \
51 -1); \
52 g_free(tmp_esc); \
55 GtkWidget *combobox_text_new(const gboolean with_entry, const gchar *text, ...);
57 void combobox_select_by_data (GtkComboBox *combobox,
58 gint data);
59 void combobox_select_by_text (GtkComboBox *combobox,
60 const gchar *data);
62 gint combobox_get_active_data (GtkComboBox *combobox);
64 /* these two functions require a GtkComboBoxText, so let the compiler warn */
65 void combobox_unset_popdown_strings(GtkComboBoxText *combobox);
66 void combobox_set_popdown_strings(GtkComboBoxText *combobox,
67 GList *list);
69 gboolean combobox_set_value_from_arrow_key(GtkComboBox *combobox,
70 guint keyval);
71 void combobox_set_sensitive (GtkComboBox *combobox,
72 const guint index,
73 const gboolean sensitive);
75 #endif /* __COMBOBOX_H__ */