diff options
author | David Ponce <david@dponce.com> | 2005-10-18 11:30:18 +0000 |
---|---|---|
committer | David Ponce <david@dponce.com> | 2005-10-18 11:30:18 +0000 |
commit | 451988c237677040bce6f463882b8588cca6feac (patch) | |
tree | 1c1f4d1329cbbed541920bff784e872b4467cf6f /lisp/tree-widget.el | |
parent | d00e8dd02e3404ecbb6a4ecca5ed801fd52735b8 (diff) | |
download | emacs-451988c237677040bce6f463882b8588cca6feac.tar.gz |
(tree-widget-button-click): New function.
(tree-widget-button-keymap): Use it.
Diffstat (limited to 'lisp/tree-widget.el')
-rw-r--r-- | lisp/tree-widget.el | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/tree-widget.el b/lisp/tree-widget.el index 708dc294f8d..8ee1d5f9ed9 100644 --- a/lisp/tree-widget.el +++ b/lisp/tree-widget.el @@ -434,16 +434,25 @@ Return the image found, or nil if not found." ;;; Widgets ;; +(defun tree-widget-button-click (event) + "Move to the position clicked on, and if it is a button, invoke it. +EVENT is the mouse event received." + (interactive "e") + (mouse-set-point event) + (let ((pos (widget-event-point event))) + (if (get-char-property pos 'button) + (widget-button-click event)))) + (defvar tree-widget-button-keymap (let ((km (make-sparse-keymap))) (if (boundp 'widget-button-keymap) ;; XEmacs (progn (set-keymap-parent km widget-button-keymap) - (define-key km [button1] 'widget-button-click)) + (define-key km [button1] 'tree-widget-button-click)) ;; Emacs (set-keymap-parent km widget-keymap) - (define-key km [down-mouse-1] 'widget-button-click)) + (define-key km [down-mouse-1] 'tree-widget-button-click)) km) "Keymap used inside node buttons. Handle mouse button 1 click on buttons.") |