Mercurial > emacs
comparison src/gtkutil.c @ 59420:eb72706060ad
* xterm.h (struct x_output): New member, toolbar_detached.
* gtkutil.c (xg_create_frame_widgets): Set initial tool bar height to
38.
(xg_tool_bar_detach_callback): Set toolbar_detached to 1.
(xg_tool_bar_attach_callback): Set toolbar_detached to 0.
(xg_create_tool_bar): Initialize toolbar_detached.
(update_frame_tool_bar): Only set FRAME_TOOLBAR_HEIGHT (f) if
toolbar_detached is zero.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sat, 08 Jan 2005 16:49:14 +0000 |
parents | ecb6689e04bf |
children | 77c91b49b403 cb67264d6096 |
comparison
equal
deleted
inserted
replaced
59419:9a44c6f6d8b7 | 59420:eb72706060ad |
---|---|
754 This makes geometry handling difficult, for example -0-0 will end | 754 This makes geometry handling difficult, for example -0-0 will end |
755 up in the wrong place as tool bar height has not been taken into account. | 755 up in the wrong place as tool bar height has not been taken into account. |
756 So we cheat a bit by setting a height that is what it will have | 756 So we cheat a bit by setting a height that is what it will have |
757 later on when tool bar items are added. */ | 757 later on when tool bar items are added. */ |
758 if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0) | 758 if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0) |
759 FRAME_TOOLBAR_HEIGHT (f) = 34; | 759 FRAME_TOOLBAR_HEIGHT (f) = 38; |
760 | 760 |
761 | 761 |
762 /* We don't want this widget double buffered, because we draw on it | 762 /* We don't want this widget double buffered, because we draw on it |
763 with regular X drawing primitives, so from a GTK/GDK point of | 763 with regular X drawing primitives, so from a GTK/GDK point of |
764 view, the widget is totally blank. When an expose comes, this | 764 view, the widget is totally blank. When an expose comes, this |
3154 { | 3154 { |
3155 FRAME_PTR f = (FRAME_PTR) client_data; | 3155 FRAME_PTR f = (FRAME_PTR) client_data; |
3156 | 3156 |
3157 if (f) | 3157 if (f) |
3158 { | 3158 { |
3159 FRAME_X_OUTPUT (f)->toolbar_detached = 1; | |
3160 | |
3159 /* When detaching a tool bar, not everything dissapear. There are | 3161 /* When detaching a tool bar, not everything dissapear. There are |
3160 a few pixels left that are used to drop the tool bar back into | 3162 a few pixels left that are used to drop the tool bar back into |
3161 place. */ | 3163 place. */ |
3162 int bw = gtk_container_get_border_width (GTK_CONTAINER (wbox)); | 3164 int bw = gtk_container_get_border_width (GTK_CONTAINER (wbox)); |
3163 FRAME_TOOLBAR_HEIGHT (f) = 2; | 3165 FRAME_TOOLBAR_HEIGHT (f) = 2; |
3185 | 3187 |
3186 if (f) | 3188 if (f) |
3187 { | 3189 { |
3188 GtkRequisition req; | 3190 GtkRequisition req; |
3189 | 3191 |
3192 FRAME_X_OUTPUT (f)->toolbar_detached = 0; | |
3193 | |
3190 gtk_widget_size_request (w, &req); | 3194 gtk_widget_size_request (w, &req); |
3191 FRAME_TOOLBAR_HEIGHT (f) = req.height; | 3195 FRAME_TOOLBAR_HEIGHT (f) = req.height; |
3192 | 3196 |
3193 /* The height has changed, resize outer widget and set columns | 3197 /* The height has changed, resize outer widget and set columns |
3194 rows to what we had before detaching the tool bar. */ | 3198 rows to what we had before attaching the tool bar. */ |
3195 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); | 3199 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
3196 } | 3200 } |
3197 } | 3201 } |
3198 | 3202 |
3199 /* This callback is called when the mouse enters or leaves a tool bar item. | 3203 /* This callback is called when the mouse enters or leaves a tool bar item. |
3303 GtkRequisition req; | 3307 GtkRequisition req; |
3304 int vbox_pos = x->menubar_widget ? 1 : 0; | 3308 int vbox_pos = x->menubar_widget ? 1 : 0; |
3305 | 3309 |
3306 x->toolbar_widget = gtk_toolbar_new (); | 3310 x->toolbar_widget = gtk_toolbar_new (); |
3307 x->handlebox_widget = gtk_handle_box_new (); | 3311 x->handlebox_widget = gtk_handle_box_new (); |
3312 x->toolbar_detached = 0; | |
3313 | |
3308 gtk_container_add (GTK_CONTAINER (x->handlebox_widget), | 3314 gtk_container_add (GTK_CONTAINER (x->handlebox_widget), |
3309 x->toolbar_widget); | 3315 x->toolbar_widget); |
3310 | 3316 |
3311 gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, | 3317 gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, |
3312 FALSE, FALSE, 0); | 3318 FALSE, FALSE, 0); |
3535 gtk_widget_hide (w); | 3541 gtk_widget_hide (w); |
3536 iter = g_list_next (iter); | 3542 iter = g_list_next (iter); |
3537 } | 3543 } |
3538 | 3544 |
3539 gtk_widget_size_request (x->toolbar_widget, &new_req); | 3545 gtk_widget_size_request (x->toolbar_widget, &new_req); |
3540 if (old_req.height != new_req.height) | 3546 if (old_req.height != new_req.height |
3547 && ! FRAME_X_OUTPUT (f)->toolbar_detached) | |
3541 { | 3548 { |
3542 FRAME_TOOLBAR_HEIGHT (f) = new_req.height; | 3549 FRAME_TOOLBAR_HEIGHT (f) = new_req.height; |
3543 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); | 3550 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
3544 } | 3551 } |
3545 | 3552 |