Plaese find below an alternative version of def-mk-inline which means
that if the
"title" of a row or stack is nil, an unlabelled frame will be created.

I modified this because I kept feeling like I was repeating myself
with code like
this.....

(bif (title (maybe-get-title))
  (mk-row (title)
     ....)
  (mk-row ()
     ....))

With the definition below, I don't have to repeat myself.

(mk-row ((maybe-get-title))
    ...)

What do you guys think?

(defmacro def-mk-inline (name (unlabelled labelled))
  `(defmacro ,name ((&rest initargs) &rest kids)
    (cond
      ((evenp (length initargs))
       `(make-instance ',',unlabelled
         :fm-parent *parent*
         ,@initargs
         :kids (c? (the-kids ,@kids))))
      ((null (car initargs))
       `(make-instance ',',unlabelled
         :fm-parent *parent*
         ,@(cdr initargs)
         :kids (c? (the-kids ,@kids))))
      (t `(make-instance ',',labelled
           :fm-parent *parent*
           :text ,(car initargs)
           ,@(cdr initargs)
           :kids (c? (the-kids ,@kids)))))))


-- 
----
Andy Chambers
Formedix Ltd

_______________________________________________
cells-devel site list
[email protected]
http://common-lisp.net/mailman/listinfo/cells-devel

Reply via email to