X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?p=clnl;a=blobdiff_plain;f=src%2Fmain%2Fmodel.lisp;h=c947987f2dadb12eafb42b1a45682ac21c6762cc;hp=0ab8c101bf190198f7781452d4c92eb3b124fa3a;hb=5f87a9f;hpb=6cb99e3ea911190e3b73adab3a92e75ef36731f1 diff --git a/src/main/model.lisp b/src/main/model.lisp index 0ab8c10..c947987 100644 --- a/src/main/model.lisp +++ b/src/main/model.lisp @@ -425,6 +425,40 @@ DESCRIPTION: :display (button-display-name widget))))) (model-interface model)))) +(defun switches (model) + "SWITCHES MODEL => SWITCH-DEFS + + SWITCH-DEFS: SWITCH-DEF* + SWITCH-DEF: (:left LEFT :top TOP :width WIDTH :var VAR :display DISPLAY :initial-value INITIAL-VALUE) + +ARGUMENTS AND VALUES: + + MODEL: A valid model + LEFT: An integer representing the left position + TOP: An integer representing the top position + WIDTH: An integer representing width + VAR: A symbole representing variable + DISPLAY: A string representing variable name + INITIAL-VALUE: The initial value + +DESCRIPTION: + + Returns switch definitions that get declared in the switches of the + MODEL. This is used to initialize the interface." + (remove nil + (mapcar + (lambda (widget) + (typecase widget + (switch + (list + :left (switch-left widget) + :top (switch-top widget) + :width (- (switch-right widget) (switch-left widget)) + :var (intern (string-upcase (switch-varname widget)) :keyword) + :display (switch-varname widget) + :initial-value (switch-on widget) )))) + (model-interface model)))) + (defun view (model) "VIEW MODEL => VIEW-DEF