X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/6d0aa5eb12e458b11041b5bce3c80e9378dd34dc..a3006fa0392b8bc1464e9917b8b820554b8f4a35:/src/mao/display/display-attribute.lisp diff --git a/src/mao/display/display-attribute.lisp b/src/mao/display/display-attribute.lisp new file mode 100644 index 0000000..e9ea969 --- /dev/null +++ b/src/mao/display/display-attribute.lisp @@ -0,0 +1,34 @@ +(in-package :lisp-on-lines) + +(define-layered-class display-attribute (standard-attribute) + ((label + :layered-accessor attribute-label + :initarg :label + :initform nil + :layered t + :special t) + (label-formatter + :layered-accessor attribute-label-formatter + :initarg :label-formatter + :initform nil + :layered t + :special t) + (value-formatter + :layered-accessor attribute-value-formatter + :initarg :value-formatter + :initform nil + :layered t + :special t) + +)) + +(define-layered-method attribute-label-formatter :around (attribute) + (or (slot-value attribute 'label-formatter) + (attribute-value (find-attribute (attribute-description attribute) 'label-formatter)) + (error "No Formatter .. fool!"))) + +(define-layered-method attribute-value-formatter :around (attribute) + + (or (slot-value attribute 'value-formatter) + (attribute-value (find-attribute (attribute-description attribute) 'value-formatter)) + (error "No Formatter .. fool!"))) \ No newline at end of file