annotate src/native-gtk-toolbar.c @ 647:b39c14581166

[xemacs-hg @ 2001-08-13 04:45:47 by ben] removal of unsigned, size_t, etc.
author ben
date Mon, 13 Aug 2001 04:46:48 +0000
parents 0784d089fdc9
children e38acbeb1cae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1 /* toolbar implementation -- GTK interface.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
2 Copyright (C) 2000 Aaron Lehmann
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
3
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
4 This file is part of XEmacs.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
5
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9 later version.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
10
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
14 for more details.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
15
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23 #include <config.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24 #include "lisp.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26 #include "console-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 #include "glyphs-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28 #include "objects-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30 #include "faces.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31 #include "frame.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
32 #include "toolbar.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
33 #include "window.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
34
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
35 #define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag) \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
36 do { \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
37 switch (pos) \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
38 { \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
39 case TOP_TOOLBAR: \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
40 (frame)->top_toolbar_was_visible = flag; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41 break; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42 case BOTTOM_TOOLBAR: \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43 (frame)->bottom_toolbar_was_visible = flag; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 break; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45 case LEFT_TOOLBAR: \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46 (frame)->left_toolbar_was_visible = flag; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47 break; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 case RIGHT_TOOLBAR: \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49 (frame)->right_toolbar_was_visible = flag; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50 break; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51 default: \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52 abort (); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 } \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 } while (0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
57 gtk_clear_toolbar (struct frame *f, enum toolbar_pos pos);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60 gtk_toolbar_callback (GtkWidget *w, gpointer user_data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
62 struct toolbar_button *tb = (struct toolbar_button *) user_data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
63
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64 call0 (tb->callback);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
66
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
67
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
68 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69 gtk_output_toolbar (struct frame *f, enum toolbar_pos pos)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71 GtkWidget *toolbar;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
72 Lisp_Object button, window, glyph, instance;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
73 unsigned int checksum = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
74 struct window *w;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
75 int x, y, bar_width, bar_height, vert;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
76 int cur_x, cur_y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
77
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
78 window = FRAME_LAST_NONMINIBUF_WINDOW (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
79 w = XWINDOW (window);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
80
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
81 get_toolbar_coords (f, pos, &x, &y, &bar_width, &bar_height, &vert, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
82
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
83 /* Get the toolbar and delete the old widgets in it */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
84 button = FRAME_TOOLBAR_BUTTONS (f, pos);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
85
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86 /* First loop over all of the buttons to determine how many there
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
87 are. This loop will also make sure that all instances are
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88 instantiated so when we actually output them they will come up
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
89 immediately. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
90 while (!NILP (button))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
91 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
92 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
93 checksum = HASH4 (checksum,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94 internal_hash (get_toolbar_button_glyph(w, tb), 0),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95 internal_hash (tb->callback, 0),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96 0 /* width */);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
97 button = tb->next;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
99
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
100 /* Only do updates if the toolbar has changed, or this is the first
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 time we have drawn it in this position
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 if (FRAME_GTK_TOOLBAR_WIDGET (f)[pos] &&
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
104 FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) == checksum)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
107 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
108
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109 /* Loop through buttons and add them to our toolbar.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 This code ignores the button dimensions as we let GTK handle that :)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111 Attach the toolbar_button struct to the toolbar button so we know what
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
112 function to use as a callback. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
113
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115 gtk_clear_toolbar (f, pos);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116 FRAME_GTK_TOOLBAR_WIDGET (f)[pos] = toolbar =
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 gtk_toolbar_new (((pos == TOP_TOOLBAR) || (pos == BOTTOM_TOOLBAR)) ?
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118 GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
119 GTK_TOOLBAR_BOTH);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
120 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
121
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
122 if (NILP (w->toolbar_buttons_captioned_p))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
123 gtk_toolbar_set_style (toolbar, GTK_TOOLBAR_ICONS);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
124 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
125 gtk_toolbar_set_style (toolbar, GTK_TOOLBAR_BOTH);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
126
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
127 FRAME_GTK_TOOLBAR_CHECKSUM(f, pos) = checksum;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 button = FRAME_TOOLBAR_BUTTONS (f, pos);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
129
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130 cur_x = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131 cur_y = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
133 while (!NILP (button))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
135 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
136
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
137 if (tb->blank)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
138 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139 /* It is a blank space... we do not pay attention to the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 size, because the GTK toolbar does not allow us to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 specify different spacings. *sigh*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
142 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
143 gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
144 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
145 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
147 /* It actually has a glyph associated with it! What WILL
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
148 they think of next?
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
150 glyph = tb->up_glyph;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
151
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
152 /* #### It is currently possible for users to trash us by directly
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
153 changing the toolbar glyphs. Avoid crashing in that case. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
154 if (GLYPHP (glyph))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
155 instance = glyph_image_instance (glyph, window, ERROR_ME_NOT, 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
156 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
157 instance = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
158
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
159 if (IMAGE_INSTANCEP(instance))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
160 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
161 GtkWidget *pixmapwid;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
162 GdkPixmap *pixmap;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
163 GdkBitmap *mask;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
164 char *tooltip = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
165
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
166 if (STRINGP (tb->help_string))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
167 tooltip = XSTRING_DATA (tb->help_string);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169 pixmap = XIMAGE_INSTANCE_GTK_PIXMAP(instance);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170 mask = XIMAGE_INSTANCE_GTK_MASK(instance);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 pixmapwid = gtk_pixmap_new (pixmap, mask);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
172
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
173 gtk_widget_set_usize (pixmapwid, tb->width, tb->height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
174
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175 gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), NULL, tooltip, NULL,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
176 pixmapwid, gtk_toolbar_callback, (gpointer) tb);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
177 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
178 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
179 cur_x += vert ? 0 : tb->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 cur_y += vert ? tb->height : 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 /* Who's idea was it to use a linked list for toolbar buttons? */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
182 button = tb->next;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
183 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
184
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
185 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
186
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
187 x -= vert ? 3 : 2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
188 y -= vert ? 2 : 3;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
189
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
190 gtk_fixed_put (GTK_FIXED (FRAME_GTK_TEXT_WIDGET (f)), FRAME_GTK_TOOLBAR_WIDGET (f)[pos],x, y);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
191 gtk_widget_show_all (FRAME_GTK_TOOLBAR_WIDGET (f)[pos]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
192 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
194 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
195 gtk_clear_toolbar (struct frame *f, enum toolbar_pos pos)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197 FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 if (FRAME_GTK_TOOLBAR_WIDGET(f)[pos])
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 gtk_widget_destroy (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
202
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
203 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
204 gtk_output_frame_toolbars (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207 gtk_output_toolbar (f, TOP_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208 else if (f->top_toolbar_was_visible)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 gtk_clear_toolbar (f, TOP_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
210
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
211 if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
212 gtk_output_toolbar (f, BOTTOM_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
213 else if (f->bottom_toolbar_was_visible)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
214 gtk_clear_toolbar (f, LEFT_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
215
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
216 if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
217 gtk_output_toolbar (f, LEFT_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
218 else if (f->left_toolbar_was_visible)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
219 gtk_clear_toolbar (f, LEFT_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
220
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
221 if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
222 gtk_output_toolbar (f, RIGHT_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
223 else if (f->right_toolbar_was_visible)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
224 gtk_clear_toolbar (f, RIGHT_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
225 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
226
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
227 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
228 gtk_initialize_frame_toolbars (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
229 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
230 stderr_out ("We should draw toolbars\n");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
231 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
232
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
233
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
234 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
235 /* initialization */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
236 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
237
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
238 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
239 console_type_create_toolbar_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
240 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
241 CONSOLE_HAS_METHOD (gtk, output_frame_toolbars);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
242 CONSOLE_HAS_METHOD (gtk, initialize_frame_toolbars);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
243 }