Skip to content

Latest commit

 

History

History
58 lines (47 loc) · 1.53 KB

File metadata and controls

58 lines (47 loc) · 1.53 KB

Lightfast

Small, direct Common Lisp bindings for FLTK 1.4.

Requires SBCL with ASDF and CFFI, FLTK 1.4 with fltk-config, and a C++17 compiler.

make
make smoke
make layout-smoke
make widget-smoke
make demo
(asdf:load-system :lightfast)

The cl-fltk ASDF system and package nickname are aliases for Lightfast.

Automatic layout

Lightfast includes a deterministic, single-line flex layout engine for ordinary nested rows and columns. It supports:

  • padding and gaps
  • natural or fixed bases
  • weighted growth and shrinking
  • minimum and maximum dimensions
  • justification
  • cross-axis alignment

Layout calculation is pure. Applying it to FLTK widgets is a separate operation.

(let ((layout
        (lightfast:make-layout-column
         :padding 12
         :gap 8
         :children
         (list
          (lightfast:make-layout-item toolbar :basis 32 :shrink 0)
          (lightfast:make-layout-row
           :grow 1
           :gap 8
           :children
           (list
            (lightfast:make-layout-item sidebar :basis 220)
            (lightfast:make-layout-item preview :basis 0 :grow 1)
            (lightfast:make-layout-item inspector :basis 280)))
          (lightfast:make-layout-item status :basis 24 :shrink 0)))))
  (lightfast:layout-on-resize window layout))

Use compute-layout for display-independent rectangle calculation and apply-layout for explicit widget resizing. Container nodes may have a target group; their descendants are then calculated in that group's local coordinate space.