1 |
;;; wid-edit.el --- Functions for creating and using widgets -*-byte-compile-dynamic: t;-*- |
;;; wid-edit.el --- Functions for creating and using widgets -*-byte-compile-dynamic: t;-*- |
2 |
;; |
;; |
3 |
;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
4 |
;; |
;; |
5 |
;; Author: Per Abrahamsen <abraham@dina.kvl.dk> |
;; Author: Per Abrahamsen <abraham@dina.kvl.dk> |
6 |
;; Maintainer: FSF |
;; Maintainer: FSF |
63 |
"Character position of the end of event if that exists, or nil." |
"Character position of the end of event if that exists, or nil." |
64 |
(posn-point (event-end event))) |
(posn-point (event-end event))) |
65 |
|
|
|
(autoload 'pp-to-string "pp") |
|
|
(autoload 'Info-goto-node "info") |
|
|
|
|
66 |
(defun widget-button-release-event-p (event) |
(defun widget-button-release-event-p (event) |
67 |
"Non-nil if EVENT is a mouse-button-release event object." |
"Non-nil if EVENT is a mouse-button-release event object." |
68 |
(and (eventp event) |
(and (eventp event) |
233 |
;; Define SPC as a prefix char to get to this menu. |
;; Define SPC as a prefix char to get to this menu. |
234 |
(define-key overriding-terminal-local-map " " |
(define-key overriding-terminal-local-map " " |
235 |
(setq map (make-sparse-keymap title))) |
(setq map (make-sparse-keymap title))) |
236 |
(save-excursion |
(with-current-buffer (get-buffer-create " widget-choose") |
|
(set-buffer (get-buffer-create " widget-choose")) |
|
237 |
(erase-buffer) |
(erase-buffer) |
238 |
(insert "Available choices:\n\n") |
(insert "Available choices:\n\n") |
239 |
(while items |
(while items |
300 |
;; |
;; |
301 |
;; These functions are for specifying text properties. |
;; These functions are for specifying text properties. |
302 |
|
|
303 |
(defvar widget-field-add-space t |
;; We can set it to nil now that get_local_map uses get_pos_property. |
304 |
|
(defconst widget-field-add-space nil |
305 |
"Non-nil means add extra space at the end of editable text fields. |
"Non-nil means add extra space at the end of editable text fields. |
306 |
If you don't add the space, it will become impossible to edit a zero |
If you don't add the space, it will become impossible to edit a zero |
307 |
size field.") |
size field.") |
567 |
(widget nil) |
(widget nil) |
568 |
(parent nil) |
(parent nil) |
569 |
(overlays (if buffer |
(overlays (if buffer |
570 |
(save-excursion (set-buffer buffer) (overlay-lists)) |
(with-current-buffer buffer (overlay-lists)) |
571 |
(overlay-lists)))) |
(overlay-lists)))) |
572 |
(setq overlays (append (car overlays) (cdr overlays))) |
(setq overlays (append (car overlays) (cdr overlays))) |
573 |
(while (setq cur (pop overlays)) |
(while (setq cur (pop overlays)) |
1101 |
|
|
1102 |
;;; Setting up the buffer. |
;;; Setting up the buffer. |
1103 |
|
|
1104 |
(defvar widget-field-new nil) |
(defvar widget-field-new nil |
1105 |
;; List of all newly created editable fields in the buffer. |
"List of all newly created editable fields in the buffer.") |
1106 |
(make-variable-buffer-local 'widget-field-new) |
(make-variable-buffer-local 'widget-field-new) |
1107 |
|
|
1108 |
(defvar widget-field-list nil) |
(defvar widget-field-list nil |
1109 |
;; List of all editable fields in the buffer. |
"List of all editable fields in the buffer.") |
1110 |
(make-variable-buffer-local 'widget-field-list) |
(make-variable-buffer-local 'widget-field-list) |
1111 |
|
|
1112 |
(defun widget-at (&optional pos) |
(defun widget-at (&optional pos) |
1672 |
|
|
1673 |
(defun widget-info-link-action (widget &optional event) |
(defun widget-info-link-action (widget &optional event) |
1674 |
"Open the info node specified by WIDGET." |
"Open the info node specified by WIDGET." |
1675 |
(Info-goto-node (widget-value widget))) |
(info (widget-value widget))) |
1676 |
|
|
1677 |
;;; The `url-link' Widget. |
;;; The `url-link' Widget. |
1678 |
|
|