summaryrefslogtreecommitdiff
path: root/lisp/wid-edit.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2011-01-09 16:05:53 -0500
committerChong Yidong <cyd@stupidchicken.com>2011-01-09 16:05:53 -0500
commit895123f56682ed3fa9d210b1e6cfed0b3857b3e2 (patch)
treebd4292b8d640b6e46456cb898867ed36f0bb2aaa /lisp/wid-edit.el
parent9094fd8fc83cf9587c4eaeca03d6d4149a73f53d (diff)
downloademacs-895123f56682ed3fa9d210b1e6cfed0b3857b3e2.tar.gz
Fix 2010-03-12T22:56:30Z!cyd@stupidchicken.com change -- rename :on/off-image widget props to :on/off-glyph.
* wid-edit.el (visibility): Replace :on-image and :off-image widget properties with :on-glyph and :off-glyph, for consistency with the `visibility' widget. (widget-toggle-value-create, widget-visibility-value-create): Merge into a single function `widget-toggle-value-create'. * cus-edit.el (custom-variable-value-create, custom-visibility) (custom-face-edit-value-create, custom-face-value-create): Replace :on-image and :off-image widget properties with :on-glyph and :off-glyph, for consistency with the `visibility' widget.
Diffstat (limited to 'lisp/wid-edit.el')
-rw-r--r--lisp/wid-edit.el44
1 files changed, 12 insertions, 32 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 5b6bc97db2c..f82039585b2 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -2162,21 +2162,13 @@ when he invoked the menu."
(defun widget-toggle-value-create (widget)
"Insert text representing the `on' and `off' states."
- (if (widget-value widget)
- (let ((image (widget-get widget :on-glyph)))
- (and (display-graphic-p)
- (listp image)
- (not (eq (car image) 'image))
- (widget-put widget :on-glyph (setq image (eval image))))
- (widget-image-insert widget
- (widget-get widget :on)
- image))
- (let ((image (widget-get widget :off-glyph)))
- (and (display-graphic-p)
- (listp image)
- (not (eq (car image) 'image))
- (widget-put widget :off-glyph (setq image (eval image))))
- (widget-image-insert widget (widget-get widget :off) image))))
+ (let* ((val (widget-value widget))
+ (text (widget-get widget (if val :on :off)))
+ (img (widget-image-find
+ (widget-get widget (if val :on-glyph :off-glyph)))))
+ (widget-image-insert widget (or text "")
+ (if img
+ (append img '(:ascent center))))))
(defun widget-toggle-action (widget &optional event)
;; Toggle value.
@@ -2816,34 +2808,22 @@ Return an alist of (TYPE MATCH)."
"An indicator and manipulator for hidden items.
The following properties have special meanings for this widget:
-:on-image Image filename or spec to display when the item is visible.
+:on-glyph Image filename or spec to display when the item is visible.
:on Text shown if the \"on\" image is nil or cannot be displayed.
-:off-image Image filename or spec to display when the item is hidden.
+:off-glyph Image filename or spec to display when the item is hidden.
:off Text shown if the \"off\" image is nil cannot be displayed."
:format "%[%v%]"
:button-prefix ""
:button-suffix ""
- :on-image "down"
+ :on-glyph "down"
:on "Hide"
- :off-image "right"
+ :off-glyph "right"
:off "Show"
:value-create 'widget-visibility-value-create
:action 'widget-toggle-action
:match (lambda (widget value) t))
-(defun widget-visibility-value-create (widget)
- ;; Insert text representing the `on' and `off' states.
- (let* ((val (widget-value widget))
- (text (widget-get widget (if val :on :off)))
- (img (widget-image-find
- (widget-get widget (if val :on-image :off-image)))))
- (widget-image-insert widget
- (if text
- (concat widget-push-button-prefix text
- widget-push-button-suffix)
- "")
- (if img
- (append img '(:ascent center))))))
+(defalias 'widget-visibility-value-create 'widget-toggle-value-create)
;;; The `documentation-link' Widget.
;;