]> Pileus Git - ~andy/gtk/blob - gtk/gtktoolbar.h
applied patch from Andreas Persenius <ndap@swipnet.se> that updates the
[~andy/gtk] / gtk / gtktoolbar.h
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  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 /*
22  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
23  * file for a list of people on the GTK+ Team.  See the ChangeLog
24  * files for a list of changes.  These files are distributed with
25  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
26  */
27
28 #ifndef __GTK_TOOLBAR_H__
29 #define __GTK_TOOLBAR_H__
30
31
32 #include <gdk/gdk.h>
33 #include <gtk/gtkcontainer.h>
34 #include <gtk/gtkenums.h>
35 #include <gtk/gtkpixmap.h>
36 #include <gtk/gtksignal.h>
37 #include <gtk/gtktooltips.h>
38
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif /* __cplusplus */
43
44
45 #define GTK_TYPE_TOOLBAR                  (gtk_toolbar_get_type ())
46 #define GTK_TOOLBAR(obj)                  (GTK_CHECK_CAST ((obj), GTK_TYPE_TOOLBAR, GtkToolbar))
47 #define GTK_TOOLBAR_CLASS(klass)          (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOOLBAR, GtkToolbarClass))
48 #define GTK_IS_TOOLBAR(obj)               (GTK_CHECK_TYPE ((obj), GTK_TYPE_TOOLBAR))
49 #define GTK_IS_TOOLBAR_CLASS(klass)       (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOOLBAR))
50 #define GTK_TOOLBAR_GET_CLASS(obj)        (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TOOLBAR, GtkToolbarClass))
51
52
53 typedef enum
54 {
55   GTK_TOOLBAR_CHILD_SPACE,
56   GTK_TOOLBAR_CHILD_BUTTON,
57   GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
58   GTK_TOOLBAR_CHILD_RADIOBUTTON,
59   GTK_TOOLBAR_CHILD_WIDGET
60 } GtkToolbarChildType;
61
62 typedef enum
63 {
64   GTK_TOOLBAR_SPACE_EMPTY,
65   GTK_TOOLBAR_SPACE_LINE
66 } GtkToolbarSpaceStyle;
67
68 typedef struct _GtkToolbarChild      GtkToolbarChild;
69 typedef struct _GtkToolbar           GtkToolbar;
70 typedef struct _GtkToolbarClass      GtkToolbarClass;
71
72 struct _GtkToolbarChild
73 {
74   GtkToolbarChildType type;
75   GtkWidget *widget;
76   GtkWidget *icon;
77   GtkWidget *label;
78 };
79
80 struct _GtkToolbar
81 {
82   GtkContainer container;
83
84   gint             num_children;
85   GList           *children;
86   GtkOrientation   orientation;
87   GtkToolbarStyle  style;
88   gint             space_size; /* big optional space between buttons */
89   GtkToolbarSpaceStyle space_style;
90
91   GtkTooltips     *tooltips;
92
93   gint             button_maxw;
94   gint             button_maxh;
95   GtkReliefStyle   relief;
96 };
97
98 struct _GtkToolbarClass
99 {
100   GtkContainerClass parent_class;
101
102   void (* orientation_changed) (GtkToolbar      *toolbar,
103                                 GtkOrientation   orientation);
104   void (* style_changed)       (GtkToolbar      *toolbar,
105                                 GtkToolbarStyle  style);
106 };
107
108
109 GtkType    gtk_toolbar_get_type        (void);
110 GtkWidget* gtk_toolbar_new             (GtkOrientation   orientation,
111                                         GtkToolbarStyle  style);
112
113 /* Simple button items */
114 GtkWidget* gtk_toolbar_append_item     (GtkToolbar      *toolbar,
115                                         const char      *text,
116                                         const char      *tooltip_text,
117                                         const char      *tooltip_private_text,
118                                         GtkWidget       *icon,
119                                         GtkSignalFunc    callback,
120                                         gpointer         user_data);
121 GtkWidget* gtk_toolbar_prepend_item    (GtkToolbar      *toolbar,
122                                         const char      *text,
123                                         const char      *tooltip_text,
124                                         const char      *tooltip_private_text,
125                                         GtkWidget       *icon,
126                                         GtkSignalFunc    callback,
127                                         gpointer         user_data);
128 GtkWidget* gtk_toolbar_insert_item     (GtkToolbar      *toolbar,
129                                         const char      *text,
130                                         const char      *tooltip_text,
131                                         const char      *tooltip_private_text,
132                                         GtkWidget       *icon,
133                                         GtkSignalFunc    callback,
134                                         gpointer         user_data,
135                                         gint             position);
136
137 /* Space Items */
138 void       gtk_toolbar_append_space    (GtkToolbar      *toolbar);
139 void       gtk_toolbar_prepend_space   (GtkToolbar      *toolbar);
140 void       gtk_toolbar_insert_space    (GtkToolbar      *toolbar,
141                                         gint             position);
142
143 /* Any element type */
144 GtkWidget* gtk_toolbar_append_element  (GtkToolbar      *toolbar,
145                                         GtkToolbarChildType type,
146                                         GtkWidget       *widget,
147                                         const char      *text,
148                                         const char      *tooltip_text,
149                                         const char      *tooltip_private_text,
150                                         GtkWidget       *icon,
151                                         GtkSignalFunc    callback,
152                                         gpointer         user_data);
153
154 GtkWidget* gtk_toolbar_prepend_element (GtkToolbar      *toolbar,
155                                         GtkToolbarChildType type,
156                                         GtkWidget       *widget,
157                                         const char      *text,
158                                         const char      *tooltip_text,
159                                         const char      *tooltip_private_text,
160                                         GtkWidget       *icon,
161                                         GtkSignalFunc    callback,
162                                         gpointer         user_data);
163
164 GtkWidget* gtk_toolbar_insert_element  (GtkToolbar      *toolbar,
165                                         GtkToolbarChildType type,
166                                         GtkWidget       *widget,
167                                         const char      *text,
168                                         const char      *tooltip_text,
169                                         const char      *tooltip_private_text,
170                                         GtkWidget       *icon,
171                                         GtkSignalFunc    callback,
172                                         gpointer         user_data,
173                                         gint             position);
174
175 /* Generic Widgets */
176 void       gtk_toolbar_append_widget   (GtkToolbar      *toolbar,
177                                         GtkWidget       *widget,
178                                         const char      *tooltip_text,
179                                         const char      *tooltip_private_text);
180 void       gtk_toolbar_prepend_widget  (GtkToolbar      *toolbar,
181                                         GtkWidget       *widget,
182                                         const char      *tooltip_text,
183                                         const char      *tooltip_private_text);
184 void       gtk_toolbar_insert_widget   (GtkToolbar      *toolbar,
185                                         GtkWidget       *widget,
186                                         const char      *tooltip_text,
187                                         const char      *tooltip_private_text,
188                                         gint             position);
189
190 /* Style functions */
191 void       gtk_toolbar_set_orientation       (GtkToolbar           *toolbar,
192                                               GtkOrientation        orientation);
193 void       gtk_toolbar_set_style             (GtkToolbar           *toolbar,
194                                               GtkToolbarStyle       style);
195 void       gtk_toolbar_set_space_size        (GtkToolbar           *toolbar,
196                                               gint                  space_size);
197 void       gtk_toolbar_set_space_style       (GtkToolbar           *toolbar,
198                                               GtkToolbarSpaceStyle  space_style);
199 void       gtk_toolbar_set_tooltips          (GtkToolbar           *toolbar,
200                                               gint                  enable);
201 void       gtk_toolbar_set_button_relief     (GtkToolbar           *toolbar,
202                                               GtkReliefStyle        relief);
203 GtkReliefStyle gtk_toolbar_get_button_relief (GtkToolbar           *toolbar);
204
205
206 #ifdef __cplusplus
207 }
208 #endif /* __cplusplus */
209
210 #endif /* __GTK_TOOLBAR_H__ */