1/* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 * GtkToolbar copyright (C) Federico Mena
4 *
5 * Copyright (C) 2002 Anders Carlsson <[email protected]>
6 * Copyright (C) 2002 James Henstridge <[email protected]>
7 * Copyright (C) 2003 Soeren Sandmann <[email protected]>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
23 */
24
25/*
26 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
27 * file for a list of people on the GTK+ Team. See the ChangeLog
28 * files for a list of changes. These files are distributed with
29 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
30 */
31
32#ifndef __GTK_TOOLBAR_H__
33#define __GTK_TOOLBAR_H__
34
35
36#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
37#error "Only <gtk/gtk.h> can be included directly."
38#endif
39
40#include <gtk/gtkcontainer.h>
41#include <gtk/gtktooltips.h>
42#include <gtk/gtktoolitem.h>
43
44#ifndef GTK_DISABLE_DEPRECATED
45
46/* Not needed, retained for compatibility -Yosh */
47#include <gtk/gtkpixmap.h>
48#include <gtk/gtksignal.h>
49
50#endif /* GTK_DISABLE_DEPRECATED */
51
52G_BEGIN_DECLS
53
54#define GTK_TYPE_TOOLBAR (gtk_toolbar_get_type ())
55#define GTK_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOOLBAR, GtkToolbar))
56#define GTK_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOOLBAR, GtkToolbarClass))
57#define GTK_IS_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOOLBAR))
58#define GTK_IS_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOOLBAR))
59#define GTK_TOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TOOLBAR, GtkToolbarClass))
60
61#ifndef GTK_DISABLE_DEPRECATED
62typedef enum
63{
64 GTK_TOOLBAR_CHILD_SPACE,
65 GTK_TOOLBAR_CHILD_BUTTON,
66 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
67 GTK_TOOLBAR_CHILD_RADIOBUTTON,
68 GTK_TOOLBAR_CHILD_WIDGET
69} GtkToolbarChildType;
70
71typedef struct _GtkToolbarChild GtkToolbarChild;
72
73struct _GtkToolbarChild
74{
75 GtkToolbarChildType type;
76 GtkWidget *widget;
77 GtkWidget *icon;
78 GtkWidget *label;
79};
80
81#endif /* GTK_DISABLE_DEPRECATED */
82
83typedef enum
84{
85 GTK_TOOLBAR_SPACE_EMPTY,
86 GTK_TOOLBAR_SPACE_LINE
87} GtkToolbarSpaceStyle;
88
89typedef struct _GtkToolbar GtkToolbar;
90typedef struct _GtkToolbarClass GtkToolbarClass;
91typedef struct _GtkToolbarPrivate GtkToolbarPrivate;
92
93struct _GtkToolbar
94{
95 GtkContainer container;
96
97 /*< public >*/
98 gint GSEAL (num_children);
99 GList *GSEAL (children);
100 GtkOrientation GSEAL (orientation);
101 GtkToolbarStyle GSEAL (style);
102 GtkIconSize GSEAL (icon_size);
103
104#ifndef GTK_DISABLE_DEPRECATED
105 GtkTooltips *GSEAL (tooltips);
106#else
107 gpointer GSEAL (_tooltips);
108#endif
109
110 /*< private >*/
111 gint GSEAL (button_maxw); /* maximum width of homogeneous children */
112 gint GSEAL (button_maxh); /* maximum height of homogeneous children */
113
114 guint _gtk_reserved1;
115 guint _gtk_reserved2;
116
117 guint GSEAL (style_set) : 1;
118 guint GSEAL (icon_size_set) : 1;
119};
120
121struct _GtkToolbarClass
122{
123 GtkContainerClass parent_class;
124
125 /* signals */
126 void (* orientation_changed) (GtkToolbar *toolbar,
127 GtkOrientation orientation);
128 void (* style_changed) (GtkToolbar *toolbar,
129 GtkToolbarStyle style);
130 gboolean (* popup_context_menu) (GtkToolbar *toolbar,
131 gint x,
132 gint y,
133 gint button_number);
134
135 /* Padding for future expansion */
136 void (*_gtk_reserved1) (void);
137 void (*_gtk_reserved2) (void);
138 void (*_gtk_reserved3) (void);
139};
140
141GType gtk_toolbar_get_type (void) G_GNUC_CONST;
142GtkWidget * gtk_toolbar_new (void);
143
144void gtk_toolbar_insert (GtkToolbar *toolbar,
145 GtkToolItem *item,
146 gint pos);
147
148gint gtk_toolbar_get_item_index (GtkToolbar *toolbar,
149 GtkToolItem *item);
150gint gtk_toolbar_get_n_items (GtkToolbar *toolbar);
151GtkToolItem * gtk_toolbar_get_nth_item (GtkToolbar *toolbar,
152 gint n);
153
154gboolean gtk_toolbar_get_show_arrow (GtkToolbar *toolbar);
155void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar,
156 gboolean show_arrow);
157
158GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar);
159void gtk_toolbar_set_style (GtkToolbar *toolbar,
160 GtkToolbarStyle style);
161void gtk_toolbar_unset_style (GtkToolbar *toolbar);
162
163GtkIconSize gtk_toolbar_get_icon_size (GtkToolbar *toolbar);
164void gtk_toolbar_set_icon_size (GtkToolbar *toolbar,
165 GtkIconSize icon_size);
166void gtk_toolbar_unset_icon_size (GtkToolbar *toolbar);
167
168GtkReliefStyle gtk_toolbar_get_relief_style (GtkToolbar *toolbar);
169gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar,
170 gint x,
171 gint y);
172void gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar,
173 GtkToolItem *tool_item,
174 gint index_);
175
176
177/* internal functions */
178gchar * _gtk_toolbar_elide_underscores (const gchar *original);
179void _gtk_toolbar_paint_space_line (GtkWidget *widget,
180 GtkToolbar *toolbar,
181 const GdkRectangle *area,
182 const GtkAllocation *allocation);
183gint _gtk_toolbar_get_default_space_size (void);
184
185
186
187#ifndef GTK_DISABLE_DEPRECATED
188
189GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar);
190void gtk_toolbar_set_orientation (GtkToolbar *toolbar,
191 GtkOrientation orientation);
192gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar);
193void gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
194 gboolean enable);
195
196/* Simple button items */
197GtkWidget* gtk_toolbar_append_item (GtkToolbar *toolbar,
198 const char *text,
199 const char *tooltip_text,
200 const char *tooltip_private_text,
201 GtkWidget *icon,
202 GCallback callback,
203 gpointer user_data);
204GtkWidget* gtk_toolbar_prepend_item (GtkToolbar *toolbar,
205 const char *text,
206 const char *tooltip_text,
207 const char *tooltip_private_text,
208 GtkWidget *icon,
209 GCallback callback,
210 gpointer user_data);
211GtkWidget* gtk_toolbar_insert_item (GtkToolbar *toolbar,
212 const char *text,
213 const char *tooltip_text,
214 const char *tooltip_private_text,
215 GtkWidget *icon,
216 GCallback callback,
217 gpointer user_data,
218 gint position);
219
220/* Stock Items */
221GtkWidget* gtk_toolbar_insert_stock (GtkToolbar *toolbar,
222 const gchar *stock_id,
223 const char *tooltip_text,
224 const char *tooltip_private_text,
225 GCallback callback,
226 gpointer user_data,
227 gint position);
228
229/* Space Items */
230void gtk_toolbar_append_space (GtkToolbar *toolbar);
231void gtk_toolbar_prepend_space (GtkToolbar *toolbar);
232void gtk_toolbar_insert_space (GtkToolbar *toolbar,
233 gint position);
234void gtk_toolbar_remove_space (GtkToolbar *toolbar,
235 gint position);
236/* Any element type */
237GtkWidget* gtk_toolbar_append_element (GtkToolbar *toolbar,
238 GtkToolbarChildType type,
239 GtkWidget *widget,
240 const char *text,
241 const char *tooltip_text,
242 const char *tooltip_private_text,
243 GtkWidget *icon,
244 GCallback callback,
245 gpointer user_data);
246
247GtkWidget* gtk_toolbar_prepend_element (GtkToolbar *toolbar,
248 GtkToolbarChildType type,
249 GtkWidget *widget,
250 const char *text,
251 const char *tooltip_text,
252 const char *tooltip_private_text,
253 GtkWidget *icon,
254 GCallback callback,
255 gpointer user_data);
256
257GtkWidget* gtk_toolbar_insert_element (GtkToolbar *toolbar,
258 GtkToolbarChildType type,
259 GtkWidget *widget,
260 const char *text,
261 const char *tooltip_text,
262 const char *tooltip_private_text,
263 GtkWidget *icon,
264 GCallback callback,
265 gpointer user_data,
266 gint position);
267
268/* Generic Widgets */
269void gtk_toolbar_append_widget (GtkToolbar *toolbar,
270 GtkWidget *widget,
271 const char *tooltip_text,
272 const char *tooltip_private_text);
273void gtk_toolbar_prepend_widget (GtkToolbar *toolbar,
274 GtkWidget *widget,
275 const char *tooltip_text,
276 const char *tooltip_private_text);
277void gtk_toolbar_insert_widget (GtkToolbar *toolbar,
278 GtkWidget *widget,
279 const char *tooltip_text,
280 const char *tooltip_private_text,
281 gint position);
282
283#endif /* GTK_DISABLE_DEPRECATED */
284
285
286G_END_DECLS
287
288#endif /* __GTK_TOOLBAR_H__ */
289