Defining custom views

clog-moldable-inspector

View objects

A view defined by defview must return or an instance of class , which has two subclasses:

Writing HTML view definitions

Since HTML + ALIST is the most common type of view, there is an extensive support library for writing them, which is best explored by looking at view definitions by alt-clicking. This support code uses the cl-who library for producing HTML code, so it's recommended to read its manual.

Transclusions

You can insert a view into another view, a process known as transclusion. As a simple example, here is a transcluded view showing the items of the list :

(hv:đź‘€items '(a b))

Transclusion is particularly useful for inserting the source code of classes or functions in the system. For example, this is the source code for the function transclusion:

hv:transclusion

Title bars

The title bar of an inspector pane consists of two single-line HTML views, constructed by methods of two generic functions:

There are very few specializers for html-inspector-views:title-bar because most often it is only the textual representation that needs to be customized. It is constructed by the generic function html-inspector-views:title-bar-representation, which by default simply calls html-inspector-views:html-representation, the generic function that is also used by several HTML views, e.g. to show an object as an item of a list or a vector. Its default implementation calls html-inspector-views:text-representation, which returns a plain-text representation of an object. In most cases, specializing this function is sufficient. Check out its "Methods" view to see examples!