+(defun multiple-value-funcall->list (function &rest args)
+ "The function to be called by m-v-bf"
+ (multiple-value-call #'list (apply function args)))
+
+(defmacro multiple-value-bindf (vars form &body body)
+ "Like M-V-B, only it works in actions. form must be a function call"
+ `(destructuring-bind ,vars
+ (multiple-value-funcall->list #',(car form) ,@(cdr form))
+ ,@body))
+
+
+;;;; ** Textarea Slot Presentation
+
+(defslot-presentation text-slot-presentation ()
+ ((rows :initarg :rows :accessor rows :initform nil)
+ (columns :initarg :columns :accessor columns :initform nil)
+ (html-contentp :initarg :escape-html-p :accessor escape-html-p :initform nil))
+ (:type-name text))
+
+(defmethod present-slot ((slot text-slot-presentation) instance)
+ (if (editablep slot)
+ (<ucw:textarea :accessor (presentation-slot-value slot instance)
+ :rows (rows slot)
+ :cols (columns slot))
+ (if (escape-html-p slot)
+ (<:as-is (presentation-slot-value slot instance))
+ (<:as-html (presentation-slot-value slot instance)))))
+
+
+(defcomponent mewa-slot-presentation ()
+ ((slot-name :accessor slot-name
+ :initarg :slot-name
+ :documentation
+ "The name of the slot being accessed")
+ (fill-gaps-only-p :accessor fill-gaps-only-p
+ :initarg :fill-gaps-only-p
+ :initform nil
+ :documentation
+ "When nil, the instance is syncronised with the database.
+When T, only the default value for primary keys and the joins are updated.")
+ (show-label-p :accessor show-label-p :initarg :show-label-p :initform t))
+ (:documentation "The superclass of all Mewa slot presentations"))
+
+;;;; this has to be in the eval when i would think
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (defun generate-slot-presentation-definition-for-type (type)
+ (let* ((u-name (intern (format nil "~A-SLOT-PRESENTATION" type)))
+ (sp-name (intern (format nil "MEWA-~A" u-name)))
+ (t-name (intern (format nil "MEWA-~A" type))))
+ `(defslot-presentation ,sp-name (,u-name mewa-slot-presentation)
+ ()
+ (:type-name ,t-name)))))
+
+(defmacro define-base-mewa-presentations (&body types)
+ "Define the mewa-slot-presentations by subclassing the base UCW ones"
+ `(progn ,@(mapcar #'generate-slot-presentation-definition-for-type
+ types)))
+
+;;;then actually define the base presentations :
+(define-base-mewa-presentations
+ boolean
+ string
+ number
+ integer
+ currency)