1 /* gtkcombobox.h 2 * Copyright (C) 2002, 2003 Kristian Rietveld <kris@gtk.org> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library 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 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef __GTK_COMBO_BOX_H__ 19 #define __GTK_COMBO_BOX_H__ 20 21 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) 22 #error "Only <gtk/gtk.h> can be included directly." 23 #endif 24 25 #include <gtk/gtkbin.h> 26 #include <gtk/gtktreemodel.h> 27 #include <gtk/gtktreeview.h> 28 29 G_BEGIN_DECLS 30 31 #define GTK_TYPE_COMBO_BOX (gtk_combo_box_get_type ()) 32 #define GTK_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COMBO_BOX, GtkComboBox)) 33 #define GTK_COMBO_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_COMBO_BOX, GtkComboBoxClass)) 34 #define GTK_IS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COMBO_BOX)) 35 #define GTK_IS_COMBO_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_COMBO_BOX)) 36 #define GTK_COMBO_BOX_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_TYPE_COMBO_BOX, GtkComboBoxClass)) 37 38 typedef struct _GtkComboBox GtkComboBox; 39 typedef struct _GtkComboBoxClass GtkComboBoxClass; 40 typedef struct _GtkComboBoxPrivate GtkComboBoxPrivate; 41 42 struct _GtkComboBox 43 { 44 GtkBin parent_instance; 45 46 /*< private >*/ 47 GtkComboBoxPrivate *priv; 48 }; 49 50 /** 51 * GtkComboBoxClass: 52 * @parent_class: The parent class. 53 * @changed: Signal is emitted when the active item is changed. 54 * @format_entry_text: Signal which allows you to change how the text 55 * displayed in a combo box’s entry is displayed. 56 */ 57 struct _GtkComboBoxClass 58 { 59 GtkBinClass parent_class; 60 61 /*< public >*/ 62 63 /* signals */ 64 void (* changed) (GtkComboBox *combo_box); 65 gchar *(* format_entry_text) (GtkComboBox *combo_box, 66 const gchar *path); 67 68 /*< private >*/ 69 70 /* Padding for future expansion */ 71 void (*_gtk_reserved1) (void); 72 void (*_gtk_reserved2) (void); 73 void (*_gtk_reserved3) (void); 74 }; 75 76 77 /* construction */ 78 GDK_AVAILABLE_IN_ALL 79 GType gtk_combo_box_get_type (void) G_GNUC_CONST; 80 GDK_AVAILABLE_IN_ALL 81 GtkWidget *gtk_combo_box_new (void); 82 GDK_AVAILABLE_IN_ALL 83 GtkWidget *gtk_combo_box_new_with_area (GtkCellArea *area); 84 GDK_AVAILABLE_IN_ALL 85 GtkWidget *gtk_combo_box_new_with_area_and_entry (GtkCellArea *area); 86 GDK_AVAILABLE_IN_ALL 87 GtkWidget *gtk_combo_box_new_with_entry (void); 88 GDK_AVAILABLE_IN_ALL 89 GtkWidget *gtk_combo_box_new_with_model (GtkTreeModel *model); 90 GDK_AVAILABLE_IN_ALL 91 GtkWidget *gtk_combo_box_new_with_model_and_entry (GtkTreeModel *model); 92 93 /* grids */ 94 GDK_AVAILABLE_IN_ALL 95 gint gtk_combo_box_get_wrap_width (GtkComboBox *combo_box); 96 GDK_AVAILABLE_IN_ALL 97 void gtk_combo_box_set_wrap_width (GtkComboBox *combo_box, 98 gint width); 99 GDK_AVAILABLE_IN_ALL 100 gint gtk_combo_box_get_row_span_column (GtkComboBox *combo_box); 101 GDK_AVAILABLE_IN_ALL 102 void gtk_combo_box_set_row_span_column (GtkComboBox *combo_box, 103 gint row_span); 104 GDK_AVAILABLE_IN_ALL 105 gint gtk_combo_box_get_column_span_column (GtkComboBox *combo_box); 106 GDK_AVAILABLE_IN_ALL 107 void gtk_combo_box_set_column_span_column (GtkComboBox *combo_box, 108 gint column_span); 109 110 GDK_DEPRECATED_IN_3_10 111 gboolean gtk_combo_box_get_add_tearoffs (GtkComboBox *combo_box); 112 GDK_DEPRECATED_IN_3_10 113 void gtk_combo_box_set_add_tearoffs (GtkComboBox *combo_box, 114 gboolean add_tearoffs); 115 116 GDK_DEPRECATED_IN_3_10 117 const gchar * gtk_combo_box_get_title (GtkComboBox *combo_box); 118 GDK_DEPRECATED_IN_3_10 119 void gtk_combo_box_set_title (GtkComboBox *combo_box, 120 const gchar *title); 121 122 GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_get_focus_on_click) 123 gboolean gtk_combo_box_get_focus_on_click (GtkComboBox *combo); 124 GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_set_focus_on_click) 125 void gtk_combo_box_set_focus_on_click (GtkComboBox *combo, 126 gboolean focus_on_click); 127 128 /* get/set active item */ 129 GDK_AVAILABLE_IN_ALL 130 gint gtk_combo_box_get_active (GtkComboBox *combo_box); 131 GDK_AVAILABLE_IN_ALL 132 void gtk_combo_box_set_active (GtkComboBox *combo_box, 133 gint index_); 134 GDK_AVAILABLE_IN_ALL 135 gboolean gtk_combo_box_get_active_iter (GtkComboBox *combo_box, 136 GtkTreeIter *iter); 137 GDK_AVAILABLE_IN_ALL 138 void gtk_combo_box_set_active_iter (GtkComboBox *combo_box, 139 GtkTreeIter *iter); 140 141 /* getters and setters */ 142 GDK_AVAILABLE_IN_ALL 143 void gtk_combo_box_set_model (GtkComboBox *combo_box, 144 GtkTreeModel *model); 145 GDK_AVAILABLE_IN_ALL 146 GtkTreeModel *gtk_combo_box_get_model (GtkComboBox *combo_box); 147 148 GDK_AVAILABLE_IN_ALL 149 GtkTreeViewRowSeparatorFunc gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box); 150 GDK_AVAILABLE_IN_ALL 151 void gtk_combo_box_set_row_separator_func (GtkComboBox *combo_box, 152 GtkTreeViewRowSeparatorFunc func, 153 gpointer data, 154 GDestroyNotify destroy); 155 156 GDK_AVAILABLE_IN_ALL 157 void gtk_combo_box_set_button_sensitivity (GtkComboBox *combo_box, 158 GtkSensitivityType sensitivity); 159 GDK_AVAILABLE_IN_ALL 160 GtkSensitivityType gtk_combo_box_get_button_sensitivity (GtkComboBox *combo_box); 161 162 GDK_AVAILABLE_IN_ALL 163 gboolean gtk_combo_box_get_has_entry (GtkComboBox *combo_box); 164 GDK_AVAILABLE_IN_ALL 165 void gtk_combo_box_set_entry_text_column (GtkComboBox *combo_box, 166 gint text_column); 167 GDK_AVAILABLE_IN_ALL 168 gint gtk_combo_box_get_entry_text_column (GtkComboBox *combo_box); 169 170 GDK_AVAILABLE_IN_ALL 171 void gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box, 172 gboolean fixed); 173 GDK_AVAILABLE_IN_ALL 174 gboolean gtk_combo_box_get_popup_fixed_width (GtkComboBox *combo_box); 175 176 /* programmatic control */ 177 GDK_AVAILABLE_IN_ALL 178 void gtk_combo_box_popup (GtkComboBox *combo_box); 179 GDK_AVAILABLE_IN_ALL 180 void gtk_combo_box_popup_for_device (GtkComboBox *combo_box, 181 GdkDevice *device); 182 GDK_AVAILABLE_IN_ALL 183 void gtk_combo_box_popdown (GtkComboBox *combo_box); 184 GDK_AVAILABLE_IN_ALL 185 AtkObject * gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box); 186 187 GDK_AVAILABLE_IN_ALL 188 gint gtk_combo_box_get_id_column (GtkComboBox *combo_box); 189 GDK_AVAILABLE_IN_ALL 190 void gtk_combo_box_set_id_column (GtkComboBox *combo_box, 191 gint id_column); 192 GDK_AVAILABLE_IN_ALL 193 const gchar * gtk_combo_box_get_active_id (GtkComboBox *combo_box); 194 GDK_AVAILABLE_IN_ALL 195 gboolean gtk_combo_box_set_active_id (GtkComboBox *combo_box, 196 const gchar *active_id); 197 198 G_END_DECLS 199 200 #endif /* __GTK_COMBO_BOX_H__ */ 201