;;; tree-widget.el --- Tree widget
-;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2016 Free Software Foundation, Inc.
;; Author: David Ponce <david@dponce.com>
;; Maintainer: David Ponce <david@dponce.com>
;; This file is part of GNU Emacs
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 3, or (at
-;; your option) any later version.
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;; General Public License for more details.
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;
;;; Code:
-(eval-when-compile (require 'cl))
(require 'wid-edit)
\f
;;; Customization
:version "22.1"
:group 'widgets)
-(defcustom tree-widget-image-enable
- (not (or (featurep 'xemacs) (< emacs-major-version 21)))
- "*Non-nil means that tree-widget will try to use images."
+(defcustom tree-widget-image-enable (if (fboundp 'display-images-p)
+ (display-images-p))
+ "Non-nil means that tree-widget will try to use images."
:type 'boolean
:group 'tree-widget)
XEmacs.")
(defcustom tree-widget-themes-directory "tree-widget"
- "*Name of the directory in which to look for an image theme.
+ "Name of the directory in which to look for an image theme.
When nil use the directory where the tree-widget library is located.
When it is a relative name, search in all occurrences of that sub
directory in the path specified by `tree-widget-themes-load-path'.
:group 'tree-widget)
(defcustom tree-widget-theme nil
- "*Name of the theme in which to look for images.
+ "Name of the theme in which to look for images.
This is a sub directory of the themes directory specified by the
`tree-widget-themes-directory' option.
The default theme is \"default\". When an image is not found in a
(defcustom tree-widget-image-properties-emacs
'(:ascent center :mask (heuristic t))
- "*Default properties of Emacs images."
+ "Default properties of Emacs images."
:type 'plist
:group 'tree-widget)
(defcustom tree-widget-image-properties-xemacs
nil
- "*Default properties of XEmacs images."
+ "Default properties of XEmacs images."
:type 'plist
:group 'tree-widget)
(defcustom tree-widget-space-width 0.5
"Amount of space between an icon image and a node widget.
-Must be a valid space :width display property."
+Must be a valid space :width display property.
+See Info node `(elisp)Specified Space'."
:group 'tree-widget
- :type 'sexp)
+ :type '(choice (number :tag "Multiple of normal character width")
+ sexp))
\f
;;; Image support
;;
(tree-widget-set-parent-theme \"my-parent-theme\")
(tree-widget-set-image-properties
- (if (featurep 'xemacs)
- '(:ascent center)
- '(:ascent center :mask (heuristic t))
+ (if (featurep \\='xemacs)
+ \\='(:ascent center)
+ \\='(:ascent center :mask (heuristic t))
))"
(or name (setq name (or tree-widget-theme "default")))
(unless (string-equal name (tree-widget-theme-name))
(widget-get tree :dynargs)))
tree))
+(defvar widget-glyph-enable) ; XEmacs
+
(defun tree-widget-value-create (tree)
"Create the TREE tree-widget."
(let* ((node (tree-widget-node tree))
(flags (widget-get tree :tree-widget--guide-flags))
(indent (widget-get tree :indent))
;; Setup widget's image support. Looking up for images, and
- ;; setting widgets' :tag-glyph is done here, to allow to
+ ;; setting widgets' :tag-glyph is done here, to allow us to
;; dynamically change the image theme.
(widget-image-enable (tree-widget-use-image-p)) ; Emacs
(widget-glyph-enable widget-image-enable) ; XEmacs
property is non-nil the tree has been expanded, else collapsed.
This hook should be local in the buffer setup to display widgets.")
-(defun tree-widget-action (tree &optional event)
+(defun tree-widget-action (tree &optional _event)
"Handle the :action of the TREE tree-widget.
That is, toggle expansion of the TREE tree-widget.
Ignore the EVENT argument."
(provide 'tree-widget)
-;; arch-tag: c3a1ada2-1663-41dc-9d16-2479ed8320e8
;;; tree-widget.el ends here