UI/Model Parse - Sliders - WIP
[clnl] / src / main / interface.lisp
index 6b2d85e5a5432eab6aff37f15a78f085ee7d4ed2..e5bcc38f2ca6f9d375c893992fd8892eee0b1c82 100644 (file)
@@ -496,6 +496,24 @@ keep apprised of any updates that may happen.")
     (list :switch (append switch-def (list :height clnl-gltk:*switch-height*)) switch nil)))
   switch-defs))
 
+(defun slider-defs->sliders (slider-defs)
+ (mapcar
+  (lambda (slider-def)
+   (let*
+    ((slider
+      (clnl-gltk:slider
+       (getf slider-def :left)
+       (- *window-height* clnl-gltk:*slider-height* (getf slider-def :top))
+       (getf slider-def :width)
+       (getf slider-def :display)
+       (lambda (state) (execute (format nil "set ~A ~A" (getf slider-def :display) state)))
+       (read-from-string (getf slider-def :min))
+       (read-from-string (getf slider-def :max))
+       (read-from-string (getf slider-def :step))
+       (getf slider-def :initial-value))))
+    (list :slider (append slider-def (list :height clnl-gltk:*slider-height*)) slider nil)))
+  slider-defs))
+
 (defun textbox-defs->textboxes (textbox-defs)
  (mapcar
   (lambda (textbox-def)
@@ -524,7 +542,7 @@ keep apprised of any updates that may happen.")
      textbox nil)))
   textbox-defs))
 
-(defun initialize (&key dims view buttons switches textboxes)
+(defun initialize (&key dims view buttons switches sliders textboxes)
  "INITIALIZE &key DIMS VIEW BUTTONS SWITCHES => RESULT
 
   DIMS: (:xmin XMIN :xmax XMAX :ymin YMIN :ymax YMAX :patch-size PATCH-SIZE)
@@ -563,7 +581,8 @@ DESCRIPTION:
   (append
    (button-defs->buttons buttons)
    (textbox-defs->textboxes textboxes)
-   (switch-defs->switches switches))))
+   (switch-defs->switches switches)
+   (slider-defs->sliders sliders))))
 
 (defun run ()
  "RUN => RESULT