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
29G_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
38typedef struct _GtkComboBox GtkComboBox;
39typedef struct _GtkComboBoxClass GtkComboBoxClass;
40typedef struct _GtkComboBoxPrivate GtkComboBoxPrivate;
41
42struct _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 */
57struct _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 */
78GDK_AVAILABLE_IN_ALL
79GType gtk_combo_box_get_type (void) G_GNUC_CONST;
80GDK_AVAILABLE_IN_ALL
81GtkWidget *gtk_combo_box_new (void);
82GDK_AVAILABLE_IN_ALL
83GtkWidget *gtk_combo_box_new_with_area (GtkCellArea *area);
84GDK_AVAILABLE_IN_ALL
85GtkWidget *gtk_combo_box_new_with_area_and_entry (GtkCellArea *area);
86GDK_AVAILABLE_IN_ALL
87GtkWidget *gtk_combo_box_new_with_entry (void);
88GDK_AVAILABLE_IN_ALL
89GtkWidget *gtk_combo_box_new_with_model (GtkTreeModel *model);
90GDK_AVAILABLE_IN_ALL
91GtkWidget *gtk_combo_box_new_with_model_and_entry (GtkTreeModel *model);
92
93/* grids */
94GDK_AVAILABLE_IN_ALL
95gint gtk_combo_box_get_wrap_width (GtkComboBox *combo_box);
96GDK_AVAILABLE_IN_ALL
97void gtk_combo_box_set_wrap_width (GtkComboBox *combo_box,
98 gint width);
99GDK_AVAILABLE_IN_ALL
100gint gtk_combo_box_get_row_span_column (GtkComboBox *combo_box);
101GDK_AVAILABLE_IN_ALL
102void gtk_combo_box_set_row_span_column (GtkComboBox *combo_box,
103 gint row_span);
104GDK_AVAILABLE_IN_ALL
105gint gtk_combo_box_get_column_span_column (GtkComboBox *combo_box);
106GDK_AVAILABLE_IN_ALL
107void gtk_combo_box_set_column_span_column (GtkComboBox *combo_box,
108 gint column_span);
109
110GDK_DEPRECATED_IN_3_10
111gboolean gtk_combo_box_get_add_tearoffs (GtkComboBox *combo_box);
112GDK_DEPRECATED_IN_3_10
113void gtk_combo_box_set_add_tearoffs (GtkComboBox *combo_box,
114 gboolean add_tearoffs);
115
116GDK_DEPRECATED_IN_3_10
117const gchar * gtk_combo_box_get_title (GtkComboBox *combo_box);
118GDK_DEPRECATED_IN_3_10
119void gtk_combo_box_set_title (GtkComboBox *combo_box,
120 const gchar *title);
121
122GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_get_focus_on_click)
123gboolean gtk_combo_box_get_focus_on_click (GtkComboBox *combo);
124GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_set_focus_on_click)
125void gtk_combo_box_set_focus_on_click (GtkComboBox *combo,
126 gboolean focus_on_click);
127
128/* get/set active item */
129GDK_AVAILABLE_IN_ALL
130gint gtk_combo_box_get_active (GtkComboBox *combo_box);
131GDK_AVAILABLE_IN_ALL
132void gtk_combo_box_set_active (GtkComboBox *combo_box,
133 gint index_);
134GDK_AVAILABLE_IN_ALL
135gboolean gtk_combo_box_get_active_iter (GtkComboBox *combo_box,
136 GtkTreeIter *iter);
137GDK_AVAILABLE_IN_ALL
138void gtk_combo_box_set_active_iter (GtkComboBox *combo_box,
139 GtkTreeIter *iter);
140
141/* getters and setters */
142GDK_AVAILABLE_IN_ALL
143void gtk_combo_box_set_model (GtkComboBox *combo_box,
144 GtkTreeModel *model);
145GDK_AVAILABLE_IN_ALL
146GtkTreeModel *gtk_combo_box_get_model (GtkComboBox *combo_box);
147
148GDK_AVAILABLE_IN_ALL
149GtkTreeViewRowSeparatorFunc gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box);
150GDK_AVAILABLE_IN_ALL
151void gtk_combo_box_set_row_separator_func (GtkComboBox *combo_box,
152 GtkTreeViewRowSeparatorFunc func,
153 gpointer data,
154 GDestroyNotify destroy);
155
156GDK_AVAILABLE_IN_ALL
157void gtk_combo_box_set_button_sensitivity (GtkComboBox *combo_box,
158 GtkSensitivityType sensitivity);
159GDK_AVAILABLE_IN_ALL
160GtkSensitivityType gtk_combo_box_get_button_sensitivity (GtkComboBox *combo_box);
161
162GDK_AVAILABLE_IN_ALL
163gboolean gtk_combo_box_get_has_entry (GtkComboBox *combo_box);
164GDK_AVAILABLE_IN_ALL
165void gtk_combo_box_set_entry_text_column (GtkComboBox *combo_box,
166 gint text_column);
167GDK_AVAILABLE_IN_ALL
168gint gtk_combo_box_get_entry_text_column (GtkComboBox *combo_box);
169
170GDK_AVAILABLE_IN_ALL
171void gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box,
172 gboolean fixed);
173GDK_AVAILABLE_IN_ALL
174gboolean gtk_combo_box_get_popup_fixed_width (GtkComboBox *combo_box);
175
176/* programmatic control */
177GDK_AVAILABLE_IN_ALL
178void gtk_combo_box_popup (GtkComboBox *combo_box);
179GDK_AVAILABLE_IN_ALL
180void gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
181 GdkDevice *device);
182GDK_AVAILABLE_IN_ALL
183void gtk_combo_box_popdown (GtkComboBox *combo_box);
184GDK_AVAILABLE_IN_ALL
185AtkObject * gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box);
186
187GDK_AVAILABLE_IN_ALL
188gint gtk_combo_box_get_id_column (GtkComboBox *combo_box);
189GDK_AVAILABLE_IN_ALL
190void gtk_combo_box_set_id_column (GtkComboBox *combo_box,
191 gint id_column);
192GDK_AVAILABLE_IN_ALL
193const gchar * gtk_combo_box_get_active_id (GtkComboBox *combo_box);
194GDK_AVAILABLE_IN_ALL
195gboolean gtk_combo_box_set_active_id (GtkComboBox *combo_box,
196 const gchar *active_id);
197
198G_END_DECLS
199
200#endif /* __GTK_COMBO_BOX_H__ */
201