]> Pileus Git - ~andy/gtk/blob - gtk/gtktoolbar.h
78b9bcf23527eee990793acd340a872e96d5c41c
[~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 Library 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  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library 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-1999.  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_TOOLBAR(obj)         GTK_CHECK_CAST (obj, gtk_toolbar_get_type (), GtkToolbar)
46 #define GTK_TOOLBAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_toolbar_get_type (), GtkToolbarClass)
47 #define GTK_IS_TOOLBAR(obj)      GTK_CHECK_TYPE (obj, gtk_toolbar_get_type ())
48
49 typedef enum
50 {
51   GTK_TOOLBAR_CHILD_SPACE,
52   GTK_TOOLBAR_CHILD_BUTTON,
53   GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
54   GTK_TOOLBAR_CHILD_RADIOBUTTON,
55   GTK_TOOLBAR_CHILD_WIDGET
56 } GtkToolbarChildType;
57
58 typedef enum
59 {
60   GTK_TOOLBAR_SPACE_EMPTY,
61   GTK_TOOLBAR_SPACE_LINE
62 } GtkToolbarSpaceStyle;
63
64 typedef struct _GtkToolbarChild      GtkToolbarChild;
65 typedef struct _GtkToolbar           GtkToolbar;
66 typedef struct _GtkToolbarClass      GtkToolbarClass;
67
68 struct _GtkToolbarChild
69 {
70   GtkToolbarChildType type;
71   GtkWidget *widget;
72   GtkWidget *icon;
73   GtkWidget *label;
74 };
75
76 struct _GtkToolbar
77 {
78   GtkContainer container;
79
80   gint             num_children;
81   GList           *children;
82   GtkOrientation   orientation;
83   GtkToolbarStyle  style;
84   gint             space_size; /* big optional space between buttons */
85   GtkToolbarSpaceStyle space_style;
86
87   GtkTooltips     *tooltips;
88
89   gint             button_maxw;
90   gint             button_maxh;
91   GtkReliefStyle   relief;
92 };
93
94 struct _GtkToolbarClass
95 {
96   GtkContainerClass parent_class;
97
98   void (* orientation_changed) (GtkToolbar      *toolbar,
99                                 GtkOrientation   orientation);
100   void (* style_changed)       (GtkToolbar      *toolbar,
101                                 GtkToolbarStyle  style);
102 };
103
104
105 GtkType    gtk_toolbar_get_type        (void);
106 GtkWidget *gtk_toolbar_new             (GtkOrientation   orientation,
107                                         GtkToolbarStyle  style);
108
109 /* Simple button items */
110 GtkWidget *gtk_toolbar_append_item     (GtkToolbar      *toolbar,
111                                         const char      *text,
112                                         const char      *tooltip_text,
113                                         const char      *tooltip_private_text,
114                                         GtkWidget       *icon,
115                                         GtkSignalFunc    callback,
116                                         gpointer         user_data);
117 GtkWidget *gtk_toolbar_prepend_item    (GtkToolbar      *toolbar,
118                                         const char      *text,
119                                         const char      *tooltip_text,
120                                         const char      *tooltip_private_text,
121                                         GtkWidget       *icon,
122                                         GtkSignalFunc    callback,
123                                         gpointer         user_data);
124 GtkWidget *gtk_toolbar_insert_item     (GtkToolbar      *toolbar,
125                                         const char      *text,
126                                         const char      *tooltip_text,
127                                         const char      *tooltip_private_text,
128                                         GtkWidget       *icon,
129                                         GtkSignalFunc    callback,
130                                         gpointer         user_data,
131                                         gint             position);
132
133 /* Space Items */
134 void       gtk_toolbar_append_space    (GtkToolbar      *toolbar);
135 void       gtk_toolbar_prepend_space   (GtkToolbar      *toolbar);
136 void       gtk_toolbar_insert_space    (GtkToolbar      *toolbar,
137                                         gint             position);
138
139 /* Any element type */
140 GtkWidget *gtk_toolbar_append_element  (GtkToolbar      *toolbar,
141                                         GtkToolbarChildType type,
142                                         GtkWidget       *widget,
143                                         const char      *text,
144                                         const char      *tooltip_text,
145                                         const char      *tooltip_private_text,
146                                         GtkWidget       *icon,
147                                         GtkSignalFunc    callback,
148                                         gpointer         user_data);
149
150 GtkWidget *gtk_toolbar_prepend_element (GtkToolbar      *toolbar,
151                                         GtkToolbarChildType type,
152                                         GtkWidget       *widget,
153                                         const char      *text,
154                                         const char      *tooltip_text,
155                                         const char      *tooltip_private_text,
156                                         GtkWidget       *icon,
157                                         GtkSignalFunc    callback,
158                                         gpointer         user_data);
159
160 GtkWidget *gtk_toolbar_insert_element  (GtkToolbar      *toolbar,
161                                         GtkToolbarChildType type,
162                                         GtkWidget       *widget,
163                                         const char      *text,
164                                         const char      *tooltip_text,
165                                         const char      *tooltip_private_text,
166                                         GtkWidget       *icon,
167                                         GtkSignalFunc    callback,
168                                         gpointer         user_data,
169                                         gint             position);
170
171 /* Generic Widgets */
172 void       gtk_toolbar_append_widget   (GtkToolbar      *toolbar,
173                                         GtkWidget       *widget,
174                                         const char      *tooltip_text,
175                                         const char      *tooltip_private_text);
176 void       gtk_toolbar_prepend_widget  (GtkToolbar      *toolbar,
177                                         GtkWidget       *widget,
178                                         const char      *tooltip_text,
179                                         const char      *tooltip_private_text);
180 void       gtk_toolbar_insert_widget   (GtkToolbar      *toolbar,
181                                         GtkWidget       *widget,
182                                         const char      *tooltip_text,
183                                         const char      *tooltip_private_text,
184                                         gint             position);
185
186 /* Style functions */
187 void       gtk_toolbar_set_orientation       (GtkToolbar           *toolbar,
188                                               GtkOrientation        orientation);
189 void       gtk_toolbar_set_style             (GtkToolbar           *toolbar,
190                                               GtkToolbarStyle       style);
191 void       gtk_toolbar_set_space_size        (GtkToolbar           *toolbar,
192                                               gint                  space_size);
193 void       gtk_toolbar_set_space_style       (GtkToolbar           *toolbar,
194                                               GtkToolbarSpaceStyle  space_style);
195 void       gtk_toolbar_set_tooltips          (GtkToolbar           *toolbar,
196                                               gint                  enable);
197 void       gtk_toolbar_set_button_relief     (GtkToolbar           *toolbar,
198                                               GtkReliefStyle        relief);
199 GtkReliefStyle gtk_toolbar_get_button_relief (GtkToolbar           *toolbar);
200
201
202 #ifdef __cplusplus
203 }
204 #endif /* __cplusplus */
205
206 #endif /* __GTK_TOOLBAR_H__ */