File: tree-widget.el.html
This library provide a tree widget useful to display data structures organized in a hierarchical order.
The following properties are specific to the tree widget:
:open
Set to non-nil to expand the tree. By default the tree is
collapsed.
:node
Specify the widget used to represent the value of a tree node.
By default this is an item widget which displays the
tree-widget :tag property value if defined, or a string
representation of the tree-widget value.
:keep
Specify a list of properties to keep when the tree is collapsed
so they can be recovered when the tree is expanded. This
property can be used in child widgets too.
:expander (obsoletes :dynargs)
Specify a function to be called to dynamically provide the
tree's children in response to an expand request. This function
will be passed the tree widget and must return a list of child
widgets. Child widgets returned by the :expander function are
stored in the :args property of the tree widget.
:expander-p
Specify a predicate which must return non-nil to indicate that
the :expander function above has to be called. By default, to
speed up successive expand requests, the :expander-p predicate
return non-nil when the :args value is nil. So, by default, to
refresh child values, it is necessary to set the :args property
to nil, then redraw the tree.
:open-icon (default tree-widget-open-icon)
:close-icon (default tree-widget-close-icon)
:empty-icon (default tree-widget-empty-icon)
:leaf-icon (default tree-widget-leaf-icon)
Those properties define the icon widgets associated to tree
nodes. Icon widgets must derive from the tree-widget-icon
widget. The :tag and :glyph-name property values are
respectively used when drawing the text and graphic
representation of the tree. The :tag value must be a string
that represent a node icon, like "[+]" for example. The
:glyph-name value must the name of an image found in the current
theme, like "close" for example (see also the variable
tree-widget-theme).
:guide (default tree-widget-guide)
:end-guide (default tree-widget-end-guide)
:no-guide (default tree-widget-no-guide)
:handle (default tree-widget-handle)
:no-handle (default tree-widget-no-handle)
Those properties define item-like widgets used to draw the
tree guide lines. The :tag property value is used when drawing
the text representation of the tree. The graphic look and feel
is given by the images named "guide", "no-guide", "end-guide",
"handle", and "no-handle" found in the current theme (see also
the variable tree-widget-theme).
These are the default :tag values for icons, and guide lines:
open-icon "[-]"
close-icon "[+]"
empty-icon "[X]"
leaf-icon ""
guide " |"
no-guide " "
end-guide " `"
handle "-"
no-handle " "
The text representation of a tree looks like this:
[-] 1 (open-icon :node)
|-[+] 1.0 (guide+handle+close-icon :node)
|-[X] 1.1 (guide+handle+empty-icon :node)
`-[-] 1.2 (end-guide+handle+open-icon :node)
|- 1.2.1 (no-guide+no-handle+guide+handle+leaf-icon leaf)
`- 1.2.2 (no-guide+no-handle+end-guide+handle+leaf-icon leaf)
By default, images will be used instead of strings to draw a
nice-looking tree. See the tree-widget-image-enable,
tree-widget-themes-directory, and tree-widget-theme options for
more details.
Defined variables (9)
tree-widget-after-toggle-functions | Hooks run after toggling a tree-widget expansion. |
tree-widget-before-create-icon-functions | Hooks run before to create a tree-widget icon. |
tree-widget-button-keymap | Keymap used inside node buttons. |
tree-widget-image-enable | Non-nil means that tree-widget will try to use images. |
tree-widget-image-properties-emacs | Default properties of Emacs images. |
tree-widget-space-width | Amount of space between an icon image and a node widget. |
tree-widget-theme | Name of the theme in which to look for images. |
tree-widget-themes-directory | Name of the directory in which to look for an image theme. |
tree-widget-themes-load-path | List of locations in which to search for the themes sub-directory. |
Defined functions (26)
tree-widget--locate-sub-directory | (NAME PATH) |
tree-widget-action | (TREE &optional EVENT) |
tree-widget-button-click | (EVENT) |
tree-widget-children-value-save | (WIDGET &optional ARGS NODE) |
tree-widget-convert-widget | (WIDGET) |
tree-widget-create-image | (TYPE FILE &optional PROPS) |
tree-widget-expander-p | (TREE) |
tree-widget-find-image | (NAME) |
tree-widget-help-echo | (TREE) |
tree-widget-icon-action | (ICON &optional EVENT) |
tree-widget-icon-create | (ICON) |
tree-widget-icon-help-echo | (ICON) |
tree-widget-image-formats | () |
tree-widget-image-properties | (NAME) |
tree-widget-keep | (ARG WIDGET) |
tree-widget-leaf-node-icon-p | (ICON) |
tree-widget-lookup-image | (NAME) |
tree-widget-node | (WIDGET) |
tree-widget-p | (WIDGET) |
tree-widget-set-image-properties | (PROPS) |
tree-widget-set-parent-theme | (NAME) |
tree-widget-set-theme | (&optional NAME) |
tree-widget-theme-name | () |
tree-widget-themes-path | () |
tree-widget-use-image-p | () |
tree-widget-value-create | (TREE) |