Mercurial > hg > xemacs-beta
comparison src/native-gtk-toolbar.c @ 5495:1f0b15040456
Merge.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 01 May 2011 18:44:03 +0100 |
parents | 308d34e9f07d |
children |
comparison
equal
deleted
inserted
replaced
5494:861f2601a38b | 5495:1f0b15040456 |
---|---|
1 /* toolbar implementation -- GTK interface. | 1 /* toolbar implementation -- GTK interface. |
2 Copyright (C) 2000 Aaron Lehmann | 2 Copyright (C) 2000 Aaron Lehmann |
3 Copyright (C) 2010 Ben Wing. | |
3 | 4 |
4 This file is part of XEmacs. | 5 This file is part of XEmacs. |
5 | 6 |
6 XEmacs is free software; you can redistribute it and/or modify it | 7 XEmacs is free software: you can redistribute it and/or modify it |
7 under the terms of the GNU General Public License as published by the | 8 under the terms of the GNU General Public License as published by the |
8 Free Software Foundation; either version 2, or (at your option) any | 9 Free Software Foundation, either version 3 of the License, or (at your |
9 later version. | 10 option) any later version. |
10 | 11 |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | 12 XEmacs is distributed in the hope that it will be useful, but WITHOUT |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 for more details. | 15 for more details. |
15 | 16 |
16 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
17 along with XEmacs; see the file COPYING. If not, write to | 18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 Boston, MA 02111-1307, USA. */ | |
20 | 19 |
21 /* Synched up with: Not in FSF. */ | 20 /* Synched up with: Not in FSF. */ |
22 | 21 |
23 #include <config.h> | 22 #include <config.h> |
24 #include "lisp.h" | 23 #include "lisp.h" |
25 | 24 |
26 #include "console-gtk.h" | 25 #include "console-gtk.h" |
27 #include "glyphs-gtk.h" | 26 #include "glyphs-gtk.h" |
28 #include "objects-gtk.h" | 27 #include "fontcolor-gtk.h" |
29 | 28 |
30 #include "faces.h" | 29 #include "faces.h" |
31 #include "frame.h" | 30 #include "frame.h" |
32 #include "toolbar.h" | 31 #include "toolbar.h" |
33 #include "window.h" | 32 #include "window.h" |
34 | 33 |
35 #define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag) \ | 34 static void |
36 do { \ | 35 gtk_clear_toolbar (struct frame *f, enum edge_pos pos); |
37 switch (pos) \ | |
38 { \ | |
39 case TOP_TOOLBAR: \ | |
40 (frame)->top_toolbar_was_visible = flag; \ | |
41 break; \ | |
42 case BOTTOM_TOOLBAR: \ | |
43 (frame)->bottom_toolbar_was_visible = flag; \ | |
44 break; \ | |
45 case LEFT_TOOLBAR: \ | |
46 (frame)->left_toolbar_was_visible = flag; \ | |
47 break; \ | |
48 case RIGHT_TOOLBAR: \ | |
49 (frame)->right_toolbar_was_visible = flag; \ | |
50 break; \ | |
51 default: \ | |
52 ABORT (); \ | |
53 } \ | |
54 } while (0) | |
55 | |
56 static void | |
57 gtk_clear_toolbar (struct frame *f, enum toolbar_pos pos); | |
58 | 36 |
59 static void | 37 static void |
60 gtk_toolbar_callback (GtkWidget *UNUSED (w), gpointer user_data) | 38 gtk_toolbar_callback (GtkWidget *UNUSED (w), gpointer user_data) |
61 { | 39 { |
62 struct toolbar_button *tb = (struct toolbar_button *) user_data; | 40 struct toolbar_button *tb = (struct toolbar_button *) user_data; |
64 call0 (tb->callback); | 42 call0 (tb->callback); |
65 } | 43 } |
66 | 44 |
67 | 45 |
68 static void | 46 static void |
69 gtk_output_toolbar (struct frame *f, enum toolbar_pos pos) | 47 gtk_output_toolbar (struct frame *f, enum edge_pos pos) |
70 { | 48 { |
71 GtkWidget *toolbar; | 49 GtkWidget *toolbar; |
72 Lisp_Object button, window, glyph, instance; | 50 Lisp_Object button, window, glyph, instance; |
73 unsigned int checksum = 0; | 51 unsigned int checksum = 0; |
74 struct window *w; | 52 struct window *w; |
112 function to use as a callback. */ | 90 function to use as a callback. */ |
113 | 91 |
114 { | 92 { |
115 gtk_clear_toolbar (f, pos); | 93 gtk_clear_toolbar (f, pos); |
116 FRAME_GTK_TOOLBAR_WIDGET (f)[pos] = toolbar = | 94 FRAME_GTK_TOOLBAR_WIDGET (f)[pos] = toolbar = |
117 gtk_toolbar_new (((pos == TOP_TOOLBAR) || (pos == BOTTOM_TOOLBAR)) ? | 95 gtk_toolbar_new (((pos == TOP_EDGE) || (pos == BOTTOM_EDGE)) ? |
118 GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, | 96 GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, |
119 GTK_TOOLBAR_BOTH); | 97 GTK_TOOLBAR_BOTH); |
120 } | 98 } |
121 | 99 |
122 if (NILP (w->toolbar_buttons_captioned_p)) | 100 if (NILP (w->toolbar_buttons_captioned_p)) |
191 gtk_fixed_put (GTK_FIXED (FRAME_GTK_TEXT_WIDGET (f)), FRAME_GTK_TOOLBAR_WIDGET (f)[pos],x, y); | 169 gtk_fixed_put (GTK_FIXED (FRAME_GTK_TEXT_WIDGET (f)), FRAME_GTK_TOOLBAR_WIDGET (f)[pos],x, y); |
192 gtk_widget_show_all (FRAME_GTK_TOOLBAR_WIDGET (f)[pos]); | 170 gtk_widget_show_all (FRAME_GTK_TOOLBAR_WIDGET (f)[pos]); |
193 } | 171 } |
194 | 172 |
195 static void | 173 static void |
196 gtk_clear_toolbar (struct frame *f, enum toolbar_pos pos) | 174 gtk_clear_toolbar (struct frame *f, enum edge_pos pos) |
197 { | 175 { |
198 FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) = 0; | 176 FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) = 0; |
199 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0); | 177 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0); |
200 if (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]) | 178 if (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]) |
201 gtk_widget_destroy (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]); | 179 gtk_widget_destroy (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]); |
202 } | 180 } |
203 | 181 |
204 static void | 182 static void |
205 gtk_output_frame_toolbars (struct frame *f) | 183 gtk_output_frame_toolbars (struct frame *f) |
206 { | 184 { |
207 if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f)) | 185 enum edge_pos pos; |
208 gtk_output_toolbar (f, TOP_TOOLBAR); | 186 |
209 else if (f->top_toolbar_was_visible) | 187 EDGE_POS_LOOP (pos) |
210 gtk_clear_toolbar (f, TOP_TOOLBAR); | 188 { |
211 | 189 if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos)) |
212 if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f)) | 190 gtk_output_toolbar (f, pos); |
213 gtk_output_toolbar (f, BOTTOM_TOOLBAR); | 191 else if (f->toolbar_was_visible[pos]) |
214 else if (f->bottom_toolbar_was_visible) | 192 gtk_clear_toolbar (f, pos); |
215 gtk_clear_toolbar (f, LEFT_TOOLBAR); | 193 } |
216 | |
217 if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f)) | |
218 gtk_output_toolbar (f, LEFT_TOOLBAR); | |
219 else if (f->left_toolbar_was_visible) | |
220 gtk_clear_toolbar (f, LEFT_TOOLBAR); | |
221 | |
222 if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f)) | |
223 gtk_output_toolbar (f, RIGHT_TOOLBAR); | |
224 else if (f->right_toolbar_was_visible) | |
225 gtk_clear_toolbar (f, RIGHT_TOOLBAR); | |
226 } | 194 } |
227 | 195 |
228 static void | 196 static void |
229 gtk_initialize_frame_toolbars (struct frame *UNUSED (f)) | 197 gtk_initialize_frame_toolbars (struct frame *UNUSED (f)) |
230 { | 198 { |