1 CAPI Reference Entries

tab-layout

Class

Summary

The classtab-layout has two distinct modes. The first lays out a number of panes in a switchable layout. Each pane has an associated tab which, when clicked on, pulls the pane to the front. In the second mode the tabs are linked to a:selection-callback as forbutton-panel.

Superclasses

choice
simple-pinboard-layout

Slots

description
The main layout description.

items
Specifies the tabs of the tab layout.

visible-child-function

The visible children for a given selection.

key-function
Specifies a function to use in referring to items in theitems list.

print-function

The function used to print a name on each tab.

callback-type
The type of data passed to the callback function.

selection-callback

The function called when a tab is selected.

Description

A tab layout can have two distinct modes. In its first mode, the tab layout consists of a number of panes, each with its own tab. Clicking on a tab pulls the corresponding pane to the front. In this mode the tab layout is like a switchable layout with the switching performed by the user selecting a tab. In this mode thevisible-child-function is used to specify which child to make visible for a given tab selection.

In its second mode the tab layout does not work as a switchable layout, and the result of any selection is specified using a callback specified by :selection-callback, in a similar way to a button panel callback. In this mode the :description slot is used to describe the main layout of the tab pane.

Examples

The following example shows the use of a switchable tab layout. Each tab is linked to an output pane by pairing them in the:items list.

(defun switchable-tab-layout ()
  (let* ((red-pane (make-instance
                    'capi:output-pane
                    :background :red))
         (blue-pane (make-instance
                     'capi:output-pane
                     :background :blue))
         (tl (make-instance
              'capi:tab-layout
              :items (list (list "Red" red-pane)
                           (list "Blue" blue-pane))
              :print-function 'car
              :visible-child-function 'second)))
  (capi:contain tl)))

(switchable-tab-layout)

Here is an example of the second mode of a tab layout, which uses the selection of a tab to change the nodes of a graph pane through the use of a selection callback.

(defun non-switchable-tab-layout (tabs)
  (let* ((gp (make-instance 
              'capi:graph-pane))
         (tl (make-instance 
              'capi:tab-layout
              :description (list gp)
              :items tabs
              :visible-child-function nil
              :key-function nil
              :print-function (lambda (x) 
                                (format nil "~R" x))
              :callback-type :data
              :selection-callback 
               #'(lambda (data) 
                (setf (capi:graph-pane-roots gp)
                  (list data))))))
  (capi:contain tl)))

(non-switchable-tab-layout '(1 2 4 5 6))

See Also

callbacks
simple-layout
switchable-layout


CAPI Reference Manual, Liquid Common Lisp Version 5.0 - 3 OCT 1997

Generated with Harlequin WebMaker