summaryrefslogtreecommitdiff
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2010-12-20 08:17:26 +0800
committerChong Yidong <cyd@stupidchicken.com>2010-12-20 08:17:26 +0800
commit949752705efd6a4b7478623d41b3552f93e9596c (patch)
tree3f41f09628f8c7ac17c1c771c69cdb2916cc5fb8 /src/keyboard.c
parentef1b0ba7e5a82308514b8427cd84994805e61a4f (diff)
downloademacs-949752705efd6a4b7478623d41b3552f93e9596c.tar.gz
emacs-949752705efd6a4b7478623d41b3552f93e9596c.tar.bz2
emacs-949752705efd6a4b7478623d41b3552f93e9596c.zip
Implement tool-bar separators for non-GTK tool-bars.
* lisp/tool-bar.el (tool-bar--image-expression): New function. (tool-bar-local-item, tool-bar--image-exp): Use it. (tool-bar-setup): Initialize tool-bar-separator-image-expression. Use :enable instead of :visible to avoid changing the tool-bar configuration unnecessarily. * src/keyboard.c (Vtool_bar_separator_image_expression): New variable. (parse_tool_bar_item): Use it to obtain image separators for displays not using native tool-bar separators. * src/xdisp.c (build_desired_tool_bar_string): Don't handle separators specially, since this is now done in parse_tool_bar_item. * lisp/info.el (info-tool-bar-map): Add separators.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 959c57a81e3..27c311d72e2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -212,6 +212,12 @@ Lisp_Object Vprefix_help_command;
/* List of items that should move to the end of the menu bar. */
Lisp_Object Vmenu_bar_final_items;
+/* Expression to evaluate for the tool bar separator image.
+ This is used for build_desired_tool_bar_string only. For GTK, we
+ use GTK tool bar seperators. */
+
+Lisp_Object Vtool_bar_separator_image_expression;
+
/* Non-nil means show the equivalent key-binding for
any M-x command that has one.
The value can be a length of time to show the message for.
@@ -8294,6 +8300,15 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
if (menu_separator_name_p (SDATA (caption)))
{
PROP (TOOL_BAR_ITEM_TYPE) = Qt;
+#if !defined (USE_GTK) && !defined (HAVE_NS)
+ /* If we use build_desired_tool_bar_string to render the
+ tool bar, the separator is rendered as an image. */
+ PROP (TOOL_BAR_ITEM_IMAGES)
+ = menu_item_eval_property (Vtool_bar_separator_image_expression);
+ PROP (TOOL_BAR_ITEM_ENABLED_P) = Qnil;
+ PROP (TOOL_BAR_ITEM_SELECTED_P) = Qnil;
+ PROP (TOOL_BAR_ITEM_CAPTION) = Qnil;
+#endif
return 1;
}
return 0;
@@ -12151,6 +12166,12 @@ might happen repeatedly and make Emacs nonfunctional. */);
The elements of the list are event types that may have menu bar bindings. */);
Vmenu_bar_final_items = Qnil;
+ DEFVAR_LISP ("tool-bar-separator-image-expression", &Vtool_bar_separator_image_expression,
+ doc: /* Expression evaluating to the image spec for a tool-bar separator.
+This is used internally by graphical displays that do not render
+tool-bar separators natively. Otherwise it is unused (e.g. on GTK). */);
+ Vtool_bar_separator_image_expression = Qnil;
+
DEFVAR_KBOARD ("overriding-terminal-local-map",
Voverriding_terminal_local_map,
doc: /* Per-terminal keymap that overrides all other local keymaps.