All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

NextPrevUpTopContentsIndex

switchable-layout

Class
Summary

A layout which displays only one of its children at a time, and supports switching to another child.

Package

capi

Superclasses

simple-layout

Initargs

:visible-child

The currently visible pane from the children.

:combine-child-constraints

A generalized boolean.

Readers

switchable-layout-visible-child
switchable-layout-combine-child-constraints

Description

The class switchable-layout is a subclass of simple-layout which displays only one of its children at a time, and provides functionality for switching the displayed child to one of the other children.

The layout's description contains a list of its children. The argument visible-child specifies the initially visible child (which defaults to the first of the children).

switchable-layout inherits most of its layout behavior from simple-layout as it only ever lays out one child at a time.

combine-child-constraints influences the initial size of the layout. When combine-child-constraints is nil the constraints of the switchable layout depend only on its currently visible child pane. Switching to a different child pane might cause the layout to resize. When combine-child-constraints is non-nil, the constraints depend on all of the child panes, including those that are not visible. This might increase the time taken to create the switchable layout initially, but can prevent unexpected resizing later. The default value of combine-child-constraints is nil.

Example
(setq children (list
                (make-instance 'capi:push-button
                               :text "Press Me")
                (make-instance 'capi:list-panel
                               :items '(1 2 3 4 5))))
 
(setq layout (capi:contain
              (make-instance
               'capi:switchable-layout
               :description children)))
 
(capi:apply-in-pane-process 
 layout #'(setf capi:switchable-layout-visible-child)
 (second children) layout)
 
(capi:apply-in-pane-process 
  layout #'(setf capi:switchable-layout-visible-child) 
  (first children) layout)

Here is a further example:

(example-edit-file "capi/layouts/switchable")
See also

simple-layout
switchable-layout-switchable-children
Laying Out CAPI Panes
Programming with CAPI Windows
Changing a non-standard toolbar dynamically


CAPI User Guide and Reference Manual (Unix version) - 3 Aug 2017

NextPrevUpTopContentsIndex