gtkcombobox.h 8.28 KB
Newer Older
1 2 3
/* gtkcombobox.h
 * Copyright (C) 2002, 2003  Kristian Rietveld <kris@gtk.org>
 *
4 5 6 7
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * 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 11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 17
 */

18 19 20
#ifndef __GTK_COMBO_BOX_H__
#define __GTK_COMBO_BOX_H__

21
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 23 24
#error "Only <gtk/gtk.h> can be included directly."
#endif

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#include <gtk/gtkbin.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtktreeview.h>

G_BEGIN_DECLS

#define GTK_TYPE_COMBO_BOX             (gtk_combo_box_get_type ())
#define GTK_COMBO_BOX(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COMBO_BOX, GtkComboBox))
#define GTK_COMBO_BOX_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_COMBO_BOX, GtkComboBoxClass))
#define GTK_IS_COMBO_BOX(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COMBO_BOX))
#define GTK_IS_COMBO_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_COMBO_BOX))
#define GTK_COMBO_BOX_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_TYPE_COMBO_BOX, GtkComboBoxClass))

typedef struct _GtkComboBox        GtkComboBox;
typedef struct _GtkComboBoxClass   GtkComboBoxClass;
typedef struct _GtkComboBoxPrivate GtkComboBoxPrivate;

struct _GtkComboBox
{
  GtkBin parent_instance;

  /*< private >*/
47
  GtkComboBoxPrivate *priv;
48 49
};

50 51 52 53 54
/**
 * GtkComboBoxClass:
 * @parent_class: The parent class.
 * @changed: Signal is emitted when the active item is changed.
 * @format_entry_text: Signal which allows you to change how the text
55
 *    displayed in a combo box’s entry is displayed.
56
 */
57 58 59 60
struct _GtkComboBoxClass
{
  GtkBinClass parent_class;

61 62
  /*< public >*/

63
  /* signals */
64 65 66
  void     (* changed)           (GtkComboBox *combo_box);
  gchar   *(* format_entry_text) (GtkComboBox *combo_box,
				  const gchar *path);
67

68 69
  /*< private >*/

70 71 72
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  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 98
void          gtk_combo_box_set_wrap_width         (GtkComboBox *combo_box,
                                                    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 103
void          gtk_combo_box_set_row_span_column    (GtkComboBox *combo_box,
                                                    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 108 109
void          gtk_combo_box_set_column_span_column (GtkComboBox *combo_box,
                                                    gint         column_span);

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)
Matthias Clasen's avatar
Matthias Clasen committed
123
gboolean      gtk_combo_box_get_focus_on_click     (GtkComboBox *combo);
124
GDK_DEPRECATED_IN_3_20_FOR(gtk_widget_set_focus_on_click)
Matthias Clasen's avatar
Matthias Clasen committed
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 144
void          gtk_combo_box_set_model        (GtkComboBox     *combo_box,
                                              GtkTreeModel    *model);
145
GDK_AVAILABLE_IN_ALL
146 147
GtkTreeModel *gtk_combo_box_get_model        (GtkComboBox     *combo_box);

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 153 154
                                                                  GtkTreeViewRowSeparatorFunc func,
                                                                  gpointer                    data,
                                                                  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 161
GtkSensitivityType gtk_combo_box_get_button_sensitivity (GtkComboBox        *combo_box);

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 169
gint               gtk_combo_box_get_entry_text_column  (GtkComboBox        *combo_box);

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 175
gboolean           gtk_combo_box_get_popup_fixed_width  (GtkComboBox      *combo_box);

Matthias Clasen's avatar
Matthias Clasen committed
176
/* programmatic control */
177
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
178
void          gtk_combo_box_popup            (GtkComboBox     *combo_box);
179
GDK_AVAILABLE_IN_ALL
180 181
void          gtk_combo_box_popup_for_device (GtkComboBox     *combo_box,
                                              GdkDevice       *device);
182
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
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);
Matthias Clasen's avatar
Matthias Clasen committed
186

187
GDK_AVAILABLE_IN_ALL
188
gint          gtk_combo_box_get_id_column        (GtkComboBox *combo_box);
189
GDK_AVAILABLE_IN_ALL
190 191
void          gtk_combo_box_set_id_column        (GtkComboBox *combo_box,
                                                  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 199 200
G_END_DECLS

#endif /* __GTK_COMBO_BOX_H__ */