diff options
| author | Jan Djärv | 2003-02-17 18:39:53 +0000 |
|---|---|---|
| committer | Jan Djärv | 2003-02-17 18:39:53 +0000 |
| commit | f098b121caf14e743c05e8ea1f015a78aace5d15 (patch) | |
| tree | 84a70c8a67e635fb5a1387b5b57ce4ef30b17196 /src | |
| parent | a56c637db20fe38ad078f047564f96cf31946d7a (diff) | |
| download | emacs-f098b121caf14e743c05e8ea1f015a78aace5d15.tar.gz emacs-f098b121caf14e743c05e8ea1f015a78aace5d15.zip | |
* gtkutil.c (xg_tool_bar_expose_callback): New function.
(xg_create_tool_bar): Force style of tool bar to be horizontal with
icons. Set name of tool bar to emacs-toolbar.
(update_frame_tool_bar): Connect expose event to
xg_tool_bar_expose_callback.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/gtkutil.c | 42 |
2 files changed, 49 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 57d144c63bc..f9d0f56503e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2003-02-17 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * gtkutil.c (xg_tool_bar_expose_callback): New function. | ||
| 4 | (xg_create_tool_bar): Force style of tool bar to be horizontal with | ||
| 5 | icons. Set name of tool bar to emacs-toolbar. | ||
| 6 | (update_frame_tool_bar): Connect expose event to | ||
| 7 | xg_tool_bar_expose_callback. | ||
| 8 | |||
| 1 | 2003-02-17 Richard M. Stallman <rms@gnu.org> | 9 | 2003-02-17 Richard M. Stallman <rms@gnu.org> |
| 2 | 10 | ||
| 3 | * keyboard.c (this_command_key_count_reset): New variable. | 11 | * keyboard.c (this_command_key_count_reset): New variable. |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 6b92779cbf6..609243912bd 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -2666,6 +2666,26 @@ xg_tool_bar_help_callback (w, event, client_data) | |||
| 2666 | } | 2666 | } |
| 2667 | 2667 | ||
| 2668 | 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 | |||
| 2669 | static void | 2689 | static void |
| 2670 | xg_create_tool_bar (f) | 2690 | xg_create_tool_bar (f) |
| 2671 | FRAME_PTR f; | 2691 | FRAME_PTR f; |
| @@ -2685,6 +2705,19 @@ xg_create_tool_bar (f) | |||
| 2685 | gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget, | 2705 | gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget, |
| 2686 | vbox_pos); | 2706 | vbox_pos); |
| 2687 | 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 | |||
| 2688 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", | 2721 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", |
| 2689 | G_CALLBACK (xg_tool_bar_detach_callback), f); | 2722 | G_CALLBACK (xg_tool_bar_detach_callback), f); |
| 2690 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", | 2723 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", |
| @@ -2736,7 +2769,7 @@ update_frame_tool_bar (f) | |||
| 2736 | struct image *img; | 2769 | struct image *img; |
| 2737 | Lisp_Object image; | 2770 | Lisp_Object image; |
| 2738 | GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0; | 2771 | GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0; |
| 2739 | 2772 | ||
| 2740 | if (iter) iter = g_list_next (iter); | 2773 | if (iter) iter = g_list_next (iter); |
| 2741 | 2774 | ||
| 2742 | /* If image is a vector, choose the image according to the | 2775 | /* If image is a vector, choose the image according to the |
| @@ -2794,6 +2827,13 @@ update_frame_tool_bar (f) | |||
| 2794 | g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, | 2827 | g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, |
| 2795 | (gpointer)img); | 2828 | (gpointer)img); |
| 2796 | 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 | |||
| 2797 | /* We must set sensitive on the button that is the parent | 2837 | /* We must set sensitive on the button that is the parent |
| 2798 | of the GtkImage parent. Go upwards until we find the button. */ | 2838 | of the GtkImage parent. Go upwards until we find the button. */ |
| 2799 | while (! GTK_IS_BUTTON (w)) | 2839 | while (! GTK_IS_BUTTON (w)) |