annotate src/native-gtk-toolbar.c @ 2993:49316578f12d

[xemacs-hg @ 2005-10-14 01:02:29 by ben] Include config.h in lib-src progs i.c, mmencode.c: Always include config.h first. winclient.c: Move include of windows.h after config.h.
author ben
date Fri, 14 Oct 2005 01:02:30 +0000
parents 3d8143fc88e1
children d372b17f63ce 8b2f75cecb89
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: \
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2286
diff changeset
52 ABORT (); \
462
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
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 793
diff changeset
60 gtk_toolbar_callback (GtkWidget *UNUSED (w), gpointer user_data)
462
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))
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 462
diff changeset
155 instance = glyph_image_instance (glyph, window,
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 462
diff changeset
156 ERROR_ME_DEBUG_WARN, 1);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
157 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
158 instance = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
159
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
160 if (IMAGE_INSTANCEP(instance))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
161 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
162 GtkWidget *pixmapwid;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
163 GdkPixmap *pixmap;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
164 GdkBitmap *mask;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
165 char *tooltip = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
166
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
167 if (STRINGP (tb->help_string))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168 tooltip = XSTRING_DATA (tb->help_string);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170 pixmap = XIMAGE_INSTANCE_GTK_PIXMAP(instance);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 mask = XIMAGE_INSTANCE_GTK_MASK(instance);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
172 pixmapwid = gtk_pixmap_new (pixmap, mask);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
173
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
174 gtk_widget_set_usize (pixmapwid, tb->width, tb->height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
176 gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), NULL, tooltip, NULL,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
177 pixmapwid, gtk_toolbar_callback, (gpointer) tb);
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 cur_x += vert ? 0 : tb->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 cur_y += vert ? tb->height : 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
182 /* 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
183 button = tb->next;
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
186 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
187
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
188 x -= vert ? 3 : 2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
189 y -= vert ? 2 : 3;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
190
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
191 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
192 gtk_widget_show_all (FRAME_GTK_TOOLBAR_WIDGET (f)[pos]);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
195 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196 gtk_clear_toolbar (struct frame *f, enum toolbar_pos pos)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 if (FRAME_GTK_TOOLBAR_WIDGET(f)[pos])
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 gtk_widget_destroy (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
204 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205 gtk_output_frame_toolbars (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207 if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208 gtk_output_toolbar (f, TOP_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 else if (f->top_toolbar_was_visible)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
210 gtk_clear_toolbar (f, TOP_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
211
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
212 if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
213 gtk_output_toolbar (f, BOTTOM_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
214 else if (f->bottom_toolbar_was_visible)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
215 gtk_clear_toolbar (f, LEFT_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
216
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
217 if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
218 gtk_output_toolbar (f, LEFT_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
219 else if (f->left_toolbar_was_visible)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
220 gtk_clear_toolbar (f, LEFT_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
221
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
222 if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
223 gtk_output_toolbar (f, RIGHT_TOOLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
224 else if (f->right_toolbar_was_visible)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
225 gtk_clear_toolbar (f, RIGHT_TOOLBAR);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
228 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 793
diff changeset
229 gtk_initialize_frame_toolbars (struct frame *UNUSED (f))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
230 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
231 stderr_out ("We should draw toolbars\n");
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 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
236 /* initialization */
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
239 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
240 console_type_create_toolbar_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
241 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
242 CONSOLE_HAS_METHOD (gtk, output_frame_toolbars);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
243 CONSOLE_HAS_METHOD (gtk, initialize_frame_toolbars);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
244 }