emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Local tool-bar (for one frame), [toggle-frame-toolbar]


From: David Reitter
Subject: Local tool-bar (for one frame), [toggle-frame-toolbar]
Date: Sat, 16 Jul 2005 13:53:06 +0100

Would people be interested in a change that introduces a function `tool-bar-toggle' (in toolbar.el), allowing to switch a tool-bar on and off in a single frame? As shown below, it's not a minor mode (opposed to what Drew Adams suggested here: http://lists.gnu.org/archive/html/emacs-devel/ 2004-10/msg00248.html )

Also, I have implemented a little change that binds this to the tool- bar window button which exists on Mac OS X. The button click is bound to an event defined in keyboard.c (right now only in OS X), which gets mapped to [toggle-frame-toolbar] (in macterm.c). Then you do a simple

(global-set-key [toggle-frame-toolbar] 'tool-bar-toggle)




;; local toolbars

(defun tool-bar-enabled-p (&optional frame)
"Evaluates to non-nil if the tool-bar is present
in frame FRAME. If FRAME is nil, the function applies
to the selected frame."
  (> (or (frame-parameter frame 'tool-bar-lines) 0) 0))

(defun tool-bar-toggle (&optional frame)
"Switches the tool bar on and off in frame FRAME.
If FRAME is nil, the change applies to the selected frame."
(interactive)
  (modify-frame-parameters frame
   (list (cons 'tool-bar-lines
           (if (tool-bar-enabled-p)
           0
         1
         )))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]