2666 |
} |
} |
2667 |
|
|
2668 |
|
|
2669 |
|
/* This callback is called when a tool bar item shall be redrawn. |
2670 |
|
It modifies the expose event so that the GtkImage widget redraws the |
2671 |
|
whole image. This to overcome a bug that makes GtkImage draw the image |
2672 |
|
in the wrong place when it tries to redraw just a part of the image. |
2673 |
|
W is the GtkImage to be redrawn. |
2674 |
|
EVENT is the expose event for W. |
2675 |
|
CLIENT_DATA is unused. |
2676 |
|
|
2677 |
|
Returns FALSE to tell GTK to keep processing this event. */ |
2678 |
|
static gboolean |
2679 |
|
xg_tool_bar_expose_callback (w, event, client_data) |
2680 |
|
GtkWidget *w; |
2681 |
|
GdkEventExpose *event; |
2682 |
|
gpointer client_data; |
2683 |
|
{ |
2684 |
|
event->area.x = event->area.y = 0; |
2685 |
|
event->area.width = event->area.height = 1000; |
2686 |
|
return FALSE; |
2687 |
|
} |
2688 |
|
|
2689 |
static void |
static void |
2690 |
xg_create_tool_bar (f) |
xg_create_tool_bar (f) |
2691 |
FRAME_PTR f; |
FRAME_PTR f; |
2705 |
gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget, |
gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget, |
2706 |
vbox_pos); |
vbox_pos); |
2707 |
|
|
2708 |
|
gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar"); |
2709 |
|
|
2710 |
|
/* We only have icons, so override any user setting. We could |
2711 |
|
use the caption property of the toolbar item (see update_frame_tool_bar |
2712 |
|
below), but some of those strings are long, making the toolbar so |
2713 |
|
long it does not fit on the screen. The GtkToolbar widget makes every |
2714 |
|
item equal size, so the longest caption determine the size of every |
2715 |
|
tool bar item. I think the creators of the GtkToolbar widget |
2716 |
|
counted on 4 or 5 character long strings. */ |
2717 |
|
gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS); |
2718 |
|
gtk_toolbar_set_orientation (GTK_TOOLBAR (x->toolbar_widget), |
2719 |
|
GTK_ORIENTATION_HORIZONTAL); |
2720 |
|
|
2721 |
g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", |
g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", |
2722 |
G_CALLBACK (xg_tool_bar_detach_callback), f); |
G_CALLBACK (xg_tool_bar_detach_callback), f); |
2723 |
g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", |
g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", |
2769 |
struct image *img; |
struct image *img; |
2770 |
Lisp_Object image; |
Lisp_Object image; |
2771 |
GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0; |
GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0; |
2772 |
|
|
2773 |
if (iter) iter = g_list_next (iter); |
if (iter) iter = g_list_next (iter); |
2774 |
|
|
2775 |
/* If image is a vector, choose the image according to the |
/* If image is a vector, choose the image according to the |
2827 |
g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, |
g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, |
2828 |
(gpointer)img); |
(gpointer)img); |
2829 |
|
|
2830 |
|
/* Catch expose events to overcome an annoying redraw bug, see |
2831 |
|
comment for xg_tool_bar_expose_callback. */ |
2832 |
|
g_signal_connect (G_OBJECT (w), |
2833 |
|
"expose-event", |
2834 |
|
G_CALLBACK (xg_tool_bar_expose_callback), |
2835 |
|
0); |
2836 |
|
|
2837 |
/* We must set sensitive on the button that is the parent |
/* We must set sensitive on the button that is the parent |
2838 |
of the GtkImage parent. Go upwards until we find the button. */ |
of the GtkImage parent. Go upwards until we find the button. */ |
2839 |
while (! GTK_IS_BUTTON (w)) |
while (! GTK_IS_BUTTON (w)) |