Mercurial > emacs
comparison lisp/wid-edit.el @ 41605:faa52db1ed51
(widget-toggle-value-create): On graphic terminal,
if :on-glyph or :off-glyph is a list, eval it and store it back.
(checkbox): Quote the values for :on-glyph and :off-glyph.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 27 Nov 2001 05:04:13 +0000 |
parents | 250cd759b106 |
children | 541b53a03028 |
comparison
equal
deleted
inserted
replaced
41604:b825c024c5de | 41605:faa52db1ed51 |
---|---|
1994 :off "off") | 1994 :off "off") |
1995 | 1995 |
1996 (defun widget-toggle-value-create (widget) | 1996 (defun widget-toggle-value-create (widget) |
1997 "Insert text representing the `on' and `off' states." | 1997 "Insert text representing the `on' and `off' states." |
1998 (if (widget-value widget) | 1998 (if (widget-value widget) |
1999 (widget-image-insert widget | 1999 (progn |
2000 (widget-get widget :on) | 2000 (and (display-graphic-p) |
2001 (widget-get widget :on-glyph)) | 2001 (listp (widget-get widget :on-glyph)) |
2002 (widget-put widget :on-glyph | |
2003 (eval (widget-get widget :on-glyph)))) | |
2004 (widget-image-insert widget | |
2005 (widget-get widget :on) | |
2006 (widget-get widget :on-glyph))) | |
2007 (and (display-graphic-p) | |
2008 (listp (widget-get widget :off-glyph)) | |
2009 (widget-put widget :off-glyph | |
2010 (eval (widget-get widget :off-glyph)))) | |
2002 (widget-image-insert widget | 2011 (widget-image-insert widget |
2003 (widget-get widget :off) | 2012 (widget-get widget :off) |
2004 (widget-get widget :off-glyph)))) | 2013 (widget-get widget :off-glyph)))) |
2005 | 2014 |
2006 (defun widget-toggle-action (widget &optional event) | 2015 (defun widget-toggle-action (widget &optional event) |
2018 :format "%[%v%]" | 2027 :format "%[%v%]" |
2019 :on "[X]" | 2028 :on "[X]" |
2020 ;; We could probably do the same job as the images using single | 2029 ;; We could probably do the same job as the images using single |
2021 ;; space characters in a boxed face with a stretch specification to | 2030 ;; space characters in a boxed face with a stretch specification to |
2022 ;; make them square. | 2031 ;; make them square. |
2023 :on-glyph (create-image "\000\066\076\034\076\066\000" | 2032 :on-glyph '(create-image "\000\066\076\034\076\066\000" |
2024 'xbm t :width 7 :height 7 | 2033 'xbm t :width 7 :height 7 |
2025 :background "grey75" ; like default mode line | 2034 :background "grey75" ; like default mode line |
2026 :foreground "black" | 2035 :foreground "black" |
2027 :relief -3 | 2036 :relief -3 |
2028 :ascent 'center) | 2037 :ascent 'center) |
2029 :off "[ ]" | 2038 :off "[ ]" |
2030 :off-glyph (create-image (make-string 7 0) | 2039 :off-glyph '(create-image (make-string 7 0) |
2031 'xbm t :width 7 :height 7 | 2040 'xbm t :width 7 :height 7 |
2032 :background "grey75" | 2041 :background "grey75" |
2033 :foreground "black" | 2042 :foreground "black" |
2034 :relief 3 | 2043 :relief 3 |
2035 :ascent 'center) | 2044 :ascent 'center) |
2036 :help-echo "Toggle this item." | 2045 :help-echo "Toggle this item." |
2037 :action 'widget-checkbox-action) | 2046 :action 'widget-checkbox-action) |
2038 | 2047 |
2039 (defun widget-checkbox-action (widget &optional event) | 2048 (defun widget-checkbox-action (widget &optional event) |
2040 "Toggle checkbox, notify parent, and set active state of sibling." | 2049 "Toggle checkbox, notify parent, and set active state of sibling." |