gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
- toolbar_set_orientation (x->toolbar_widget,
- GTK_ORIENTATION_HORIZONTAL);
+ toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
}
int i)
{
GtkToolItem *ti = gtk_tool_item_new ();
- GtkWidget *vb = EQ (Vtool_bar_style, Qboth_horiz)
+ Lisp_Object style = Ftool_bar_get_system_style ();
+ int both_horiz = EQ (style, Qboth_horiz);
+ int text_image = EQ (style, Qtext_image_horiz);
+
+ GtkWidget *vb = both_horiz || text_image
? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0);
GtkWidget *wb = gtk_button_new ();
GtkWidget *weventbox = gtk_event_box_new ();
- if (wimage)
+ if (wimage && ! text_image)
gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vb), gtk_label_new (label), TRUE, TRUE, 0);
+
+ if (wimage && text_image)
+ gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
+
gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (wb), vb);
xg_show_toolbar_item (GtkToolItem *ti)
{
Lisp_Object style = Ftool_bar_get_system_style ();
+ int both_horiz = EQ (style, Qboth_horiz);
+ int text_image = EQ (style, Qtext_image_horiz);
- int show_label = EQ (style, Qboth)
- || EQ (style, Qboth_horiz) || EQ (style, Qtext);
+ int horiz = both_horiz || text_image;
+ int show_label = ! EQ (style, Qimage);
int show_image = ! EQ (style, Qtext);
- int horiz = EQ (style, Qboth_horiz);
GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti));
GtkWidget *wbutton = gtk_bin_get_child (GTK_BIN (weventbox));
new_box = gtk_hbox_new (FALSE, 0);
else if (GTK_IS_HBOX (vb) && !horiz && show_label && show_image)
new_box = gtk_vbox_new (FALSE, 0);
- if (new_box)
+
+ if (!new_box && horiz)
+ gtk_box_reorder_child (GTK_BOX (vb), wlbl, text_image ? 0 : 1);
+ else if (new_box)
{
g_object_ref (G_OBJECT (wimage));
g_object_ref (G_OBJECT (wlbl));
gtk_container_remove (GTK_CONTAINER (vb), wimage);
gtk_container_remove (GTK_CONTAINER (vb), wlbl);
gtk_widget_destroy (GTK_WIDGET (vb));
- gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0);
+ if (! text_image)
+ gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (new_box), wlbl, TRUE, TRUE, 0);
+ if (text_image)
+ gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (wbutton), new_box);
g_object_unref (G_OBJECT (wimage));
g_object_unref (G_OBJECT (wlbl));
Lisp_Object Qrect, Qcircle, Qpoly;
/* Tool bar styles */
-Lisp_Object Qtext, Qboth, Qboth_horiz;
+Lisp_Object Qtext, Qboth, Qboth_horiz, Qtext_image_horiz;
/* Non-zero means print newline to stdout before next mini-buffer
message. */
staticpro (&Qboth);
Qboth_horiz = intern_c_string ("both-horiz");
staticpro (&Qboth_horiz);
+ Qtext_image_horiz = intern_c_string ("text-image-horiz");
+ staticpro (&Qtext_image_horiz);
QCmap = intern_c_string (":map");
staticpro (&QCmap);
QCpointer = intern_c_string (":pointer");
DEFVAR_LISP ("tool-bar-style", &Vtool_bar_style,
doc: /* *Tool bar style to use.
It can be one of
- image - show images only
- text - show text only
- both - show both, text under image
- both-horiz - show text to the right of the image
- any other - use system default or image if no system default. */);
+ image - show images only
+ text - show text only
+ both - show both, text below image
+ both-horiz - show text to the right of the image
+ text-image-horiz - show text to the left of the image
+ any other - use system default or image if no system default. */);
Vtool_bar_style = Qnil;
DEFVAR_INT ("tool-bar-max-label-size", &tool_bar_max_label_size,