:type 'face
:group 'widget-faces)
-(defface widget-field-face '((((class grayscale color)
+;; TTY gets special definitions here and in the next defface, because
+;; the gray colors defined for other displays cause black text on a black
+;; background, at least on light-background TTYs.
+(defface widget-field-face '((((type tty))
+ (:background "yellow3"))
+ (((class grayscale color)
(background light))
(:background "gray85"))
(((class grayscale color)
"Face used for editable fields."
:group 'widget-faces)
-(defface widget-single-line-field-face '((((class grayscale color)
+(defface widget-single-line-field-face '((((type tty))
+ (:background "green3"))
+ (((class grayscale color)
(background light))
(:background "gray85"))
(((class grayscale color)
;;; The `text' Widget.
(define-widget 'text 'editable-field
- :keymap widget-text-keymap
- "A multiline text area.")
+ "A multiline text area."
+ :keymap widget-text-keymap)
;;; The `menu-choice' Widget.
(defun widget-toggle-value-create (widget)
"Insert text representing the `on' and `off' states."
(if (widget-value widget)
- (widget-image-insert widget
- (widget-get widget :on)
- (widget-get widget :on-glyph))
+ (progn
+ (and (display-graphic-p)
+ (listp (widget-get widget :on-glyph))
+ (widget-put widget :on-glyph
+ (eval (widget-get widget :on-glyph))))
+ (widget-image-insert widget
+ (widget-get widget :on)
+ (widget-get widget :on-glyph)))
+ (and (display-graphic-p)
+ (listp (widget-get widget :off-glyph))
+ (widget-put widget :off-glyph
+ (eval (widget-get widget :off-glyph))))
(widget-image-insert widget
(widget-get widget :off)
(widget-get widget :off-glyph))))
;; We could probably do the same job as the images using single
;; space characters in a boxed face with a stretch specification to
;; make them square.
- :on-glyph (create-image "\377\311\301\343\301\311\377" ; this is an `X'
- 'xbm t :width 7 :height 7
- :foreground "grey75" ; like default mode line
- :background "black"
- :relief -3
- :ascent 'center)
- :off "[ ]"
- :off-glyph (create-image (make-bool-vector 49 1)
+ :on-glyph '(create-image "\000\066\076\034\076\066\000"
'xbm t :width 7 :height 7
- :foreground "grey75"
- :relief 3
+ :background "grey75" ; like default mode line
+ :foreground "black"
+ :relief -3
:ascent 'center)
+ :off "[ ]"
+ :off-glyph '(create-image (make-string 7 0)
+ 'xbm t :width 7 :height 7
+ :background "grey75"
+ :foreground "black"
+ :relief 3
+ :ascent 'center)
:help-echo "Toggle this item."
:action 'widget-checkbox-action)
:format "%v"
:offset 4
:entry-format "%b %v"
- :menu-tag "checklist"
:greedy nil
:value-create 'widget-checklist-value-create
:value-delete 'widget-children-value-delete
:offset 4
:format "%v"
:entry-format "%b %v"
- :menu-tag "radio"
:value-create 'widget-radio-value-create
:value-delete 'widget-children-value-delete
:value-get 'widget-radio-value-get
:format "%v%i\n"
:format-handler 'widget-editable-list-format-handler
:entry-format "%i %d %v"
- :menu-tag "editable-list"
:value-create 'widget-editable-list-value-create
:value-delete 'widget-children-value-delete
:value-get 'widget-editable-list-value-get
(widget-value widget)
(error (widget-get widget :value)))))
(if (color-defined-p value)
- (let ((symbol (intern (concat "fg:" value))))
- (condition-case nil
- (facemenu-get-face symbol)
- (error 'default)))
+ (list (cons 'foreground-color value))
'default)))
(defun widget-color-action (widget &optional event)