]> Pileus Git - ~andy/gtk/blob - gtk/gtkcombobox.h
Add a tearoff-title property, with getter and setter. (#316482, Olexiy
[~andy/gtk] / gtk / gtkcombobox.h
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __GTK_COMBO_BOX_H__
21 #define __GTK_COMBO_BOX_H__
22
23 #include <gtk/gtkbin.h>
24 #include <gtk/gtktreemodel.h>
25 #include <gtk/gtktreeview.h>
26
27 G_BEGIN_DECLS
28
29 #define GTK_TYPE_COMBO_BOX             (gtk_combo_box_get_type ())
30 #define GTK_COMBO_BOX(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COMBO_BOX, GtkComboBox))
31 #define GTK_COMBO_BOX_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_COMBO_BOX, GtkComboBoxClass))
32 #define GTK_IS_COMBO_BOX(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COMBO_BOX))
33 #define GTK_IS_COMBO_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_COMBO_BOX))
34 #define GTK_COMBO_BOX_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_TYPE_COMBO_BOX, GtkComboBoxClass))
35
36 typedef struct _GtkComboBox        GtkComboBox;
37 typedef struct _GtkComboBoxClass   GtkComboBoxClass;
38 typedef struct _GtkComboBoxPrivate GtkComboBoxPrivate;
39
40 struct _GtkComboBox
41 {
42   GtkBin parent_instance;
43
44   /*< private >*/
45   GtkComboBoxPrivate *priv;
46 };
47
48 struct _GtkComboBoxClass
49 {
50   GtkBinClass parent_class;
51
52   /* signals */
53   void     (* changed)          (GtkComboBox *combo_box);
54
55   /* vfuncs */
56   gchar *  (* get_active_text)  (GtkComboBox *combo_box);
57
58   /* Padding for future expansion */
59   void (*_gtk_reserved0) (void);
60   void (*_gtk_reserved1) (void);
61   void (*_gtk_reserved2) (void);
62 };
63
64
65 /* construction */
66 GType         gtk_combo_box_get_type         (void) G_GNUC_CONST;
67 GtkWidget    *gtk_combo_box_new              (void);
68 GtkWidget    *gtk_combo_box_new_with_model   (GtkTreeModel    *model);
69
70 /* grids */
71 gint          gtk_combo_box_get_wrap_width         (GtkComboBox *combo_box);
72 void          gtk_combo_box_set_wrap_width         (GtkComboBox *combo_box,
73                                                     gint         width);
74 gint          gtk_combo_box_get_row_span_column    (GtkComboBox *combo_box);
75 void          gtk_combo_box_set_row_span_column    (GtkComboBox *combo_box,
76                                                     gint         row_span);
77 gint          gtk_combo_box_get_column_span_column (GtkComboBox *combo_box);
78 void          gtk_combo_box_set_column_span_column (GtkComboBox *combo_box,
79                                                     gint         column_span);
80
81 gboolean      gtk_combo_box_get_add_tearoffs       (GtkComboBox *combo_box);
82 void          gtk_combo_box_set_add_tearoffs       (GtkComboBox *combo_box,
83                                                     gboolean     add_tearoffs);
84
85 G_CONST_RETURN gchar *gtk_combo_box_get_title      (GtkComboBox *combo_box);
86 void                  gtk_combo_box_set_title      (GtkComboBox *combo_box,
87                                                     const gchar *title);
88
89 gboolean      gtk_combo_box_get_focus_on_click     (GtkComboBox *combo);
90 void          gtk_combo_box_set_focus_on_click     (GtkComboBox *combo,
91                                                     gboolean     focus_on_click);
92
93 /* get/set active item */
94 gint          gtk_combo_box_get_active       (GtkComboBox     *combo_box);
95 void          gtk_combo_box_set_active       (GtkComboBox     *combo_box,
96                                               gint             index_);
97 gboolean      gtk_combo_box_get_active_iter  (GtkComboBox     *combo_box,
98                                               GtkTreeIter     *iter);
99 void          gtk_combo_box_set_active_iter  (GtkComboBox     *combo_box,
100                                               GtkTreeIter     *iter);
101
102 /* getters and setters */
103 void          gtk_combo_box_set_model        (GtkComboBox     *combo_box,
104                                               GtkTreeModel    *model);
105 GtkTreeModel *gtk_combo_box_get_model        (GtkComboBox     *combo_box);
106
107 GtkTreeViewRowSeparatorFunc gtk_combo_box_get_row_separator_func (GtkComboBox                *combo_box);
108 void                        gtk_combo_box_set_row_separator_func (GtkComboBox                *combo_box,
109                                                                   GtkTreeViewRowSeparatorFunc func,
110                                                                   gpointer                    data,
111                                                                   GtkDestroyNotify            destroy);
112
113 /* convenience -- text */
114 GtkWidget    *gtk_combo_box_new_text         (void);
115 void          gtk_combo_box_append_text      (GtkComboBox     *combo_box,
116                                               const gchar     *text);
117 void          gtk_combo_box_insert_text      (GtkComboBox     *combo_box,
118                                               gint             position,
119                                               const gchar     *text);
120 void          gtk_combo_box_prepend_text     (GtkComboBox     *combo_box,
121                                               const gchar     *text);
122 void          gtk_combo_box_remove_text      (GtkComboBox     *combo_box,
123                                               gint             position);
124 gchar        *gtk_combo_box_get_active_text  (GtkComboBox     *combo_box);
125
126 /* programmatic control */
127 void          gtk_combo_box_popup            (GtkComboBox     *combo_box);
128 void          gtk_combo_box_popdown          (GtkComboBox     *combo_box);
129 AtkObject*    gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box);
130
131 /* private */
132 gboolean     _gtk_combo_box_editing_canceled (GtkComboBox     *combo_box);
133
134 G_END_DECLS
135
136 #endif /* __GTK_COMBO_BOX_H__ */