Mercurial > emacs
comparison src/gtkutil.c @ 90288:7432ca837c8d
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-9
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 16-33)
- Update from CVS
- Install ERC.
- Fix ERC compiler warnings.
- Use utf-8 encoding in ERC ChangeLogs.
- Merge ERC-related Viper hacks into Viper.
- Merge from erc--main--0
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 8-13)
- Merge from emacs--devo--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 01 Feb 2006 10:07:17 +0000 |
parents | 7beb78bc1f8e 4e4d545ce006 |
children | c5406394f567 |
comparison
equal
deleted
inserted
replaced
90287:3cd97358d81a | 90288:7432ca837c8d |
---|---|
3357 int idx = (int) (EMACS_INT) client_data; | 3357 int idx = (int) (EMACS_INT) client_data; |
3358 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); | 3358 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); |
3359 Lisp_Object help, frame; | 3359 Lisp_Object help, frame; |
3360 | 3360 |
3361 if (! GTK_IS_BUTTON (w)) | 3361 if (! GTK_IS_BUTTON (w)) |
3362 { | 3362 return FALSE; |
3363 return FALSE; | |
3364 } | |
3365 | 3363 |
3366 if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items)) | 3364 if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items)) |
3367 return FALSE; | 3365 return FALSE; |
3368 | 3366 |
3369 if (event->type == GDK_ENTER_NOTIFY) | 3367 if (event->type == GDK_ENTER_NOTIFY) |
3594 } | 3592 } |
3595 | 3593 |
3596 if (! wicon) | 3594 if (! wicon) |
3597 { | 3595 { |
3598 GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); | 3596 GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); |
3597 GtkToolItem *ti = gtk_tool_button_new (w, ""); | |
3599 | 3598 |
3600 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); | 3599 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); |
3601 | 3600 |
3601 gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), | |
3602 ti, | |
3603 i); | |
3602 /* The EMACS_INT cast avoids a warning. */ | 3604 /* The EMACS_INT cast avoids a warning. */ |
3603 gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), | 3605 g_signal_connect (GTK_WIDGET (ti), "clicked", |
3604 0, 0, 0, | 3606 GTK_SIGNAL_FUNC (xg_tool_bar_callback), |
3605 w, | 3607 (gpointer) (EMACS_INT) i); |
3606 GTK_SIGNAL_FUNC (xg_tool_bar_callback), | 3608 |
3607 (gpointer) (EMACS_INT) i); | 3609 gtk_widget_show (GTK_WIDGET (ti)); |
3610 gtk_widget_show (GTK_WIDGET (w)); | |
3608 | 3611 |
3609 /* Save the image so we can see if an update is needed when | 3612 /* Save the image so we can see if an update is needed when |
3610 this function is called again. */ | 3613 this function is called again. */ |
3611 g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, | 3614 g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, |
3612 (gpointer)img->pixmap); | 3615 (gpointer)img->pixmap); |
3613 | 3616 |
3617 g_object_set_data (G_OBJECT (ti), XG_FRAME_DATA, (gpointer)f); | |
3618 | |
3614 /* Catch expose events to overcome an annoying redraw bug, see | 3619 /* Catch expose events to overcome an annoying redraw bug, see |
3615 comment for xg_tool_bar_item_expose_callback. */ | 3620 comment for xg_tool_bar_item_expose_callback. */ |
3616 g_signal_connect (G_OBJECT (w), | 3621 g_signal_connect (G_OBJECT (ti), |
3617 "expose-event", | 3622 "expose-event", |
3618 G_CALLBACK (xg_tool_bar_item_expose_callback), | 3623 G_CALLBACK (xg_tool_bar_item_expose_callback), |
3619 0); | 3624 0); |
3620 | 3625 |
3621 /* We must set sensitive on the button that is the parent | 3626 gtk_widget_set_sensitive (GTK_WIDGET (ti), enabled_p); |
3622 of the GtkImage parent. Go upwards until we find the button. */ | 3627 gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (ti), FALSE); |
3628 | |
3623 while (! GTK_IS_BUTTON (w)) | 3629 while (! GTK_IS_BUTTON (w)) |
3624 w = gtk_widget_get_parent (w); | 3630 w = gtk_widget_get_parent (w); |
3625 | 3631 |
3626 if (w) | 3632 g_object_set_data (G_OBJECT (w), XG_FRAME_DATA, (gpointer)f); |
3627 { | 3633 |
3628 /* Save the frame in the button so the xg_tool_bar_callback | 3634 /* Use enter/leave notify to show help. We use the events |
3629 can get at it. */ | 3635 rather than the GtkButton specific signals "enter" and |
3630 g_object_set_data (G_OBJECT (w), XG_FRAME_DATA, (gpointer)f); | 3636 "leave", so we can have only one callback. The event |
3631 gtk_widget_set_sensitive (w, enabled_p); | 3637 will tell us what kind of event it is. */ |
3632 | 3638 /* The EMACS_INT cast avoids a warning. */ |
3633 /* Use enter/leave notify to show help. We use the events | 3639 g_signal_connect (G_OBJECT (w), |
3634 rather than the GtkButton specific signals "enter" and | 3640 "enter-notify-event", |
3635 "leave", so we can have only one callback. The event | 3641 G_CALLBACK (xg_tool_bar_help_callback), |
3636 will tell us what kind of event it is. */ | 3642 (gpointer) (EMACS_INT) i); |
3637 /* The EMACS_INT cast avoids a warning. */ | 3643 g_signal_connect (G_OBJECT (w), |
3638 g_signal_connect (G_OBJECT (w), | 3644 "leave-notify-event", |
3639 "enter-notify-event", | 3645 G_CALLBACK (xg_tool_bar_help_callback), |
3640 G_CALLBACK (xg_tool_bar_help_callback), | 3646 (gpointer) (EMACS_INT) i); |
3641 (gpointer) (EMACS_INT) i); | |
3642 g_signal_connect (G_OBJECT (w), | |
3643 "leave-notify-event", | |
3644 G_CALLBACK (xg_tool_bar_help_callback), | |
3645 (gpointer) (EMACS_INT) i); | |
3646 } | |
3647 } | 3647 } |
3648 else | 3648 else |
3649 { | 3649 { |
3650 /* The child of the tool bar is a button. Inside that button | 3650 /* The child of the tool bar is a button. Inside that button |
3651 is a vbox. Inside that vbox is the GtkImage. */ | 3651 is a vbox. Inside that vbox is the GtkImage. */ |