(defmacro make-scroll-button ((&rest osd-button-keyargs) format-text variable-place &key (update-p t) (wheel-delta-form 0.1) minimum maximum) `(let ((numeric-writer #'(lambda (new-value) (if ,update-p (setf ,variable-place ,(cond ((and minimum maximum) `(max ,minimum (min ,maximum new-value))) (minimum `(max ,minimum new-value)) (maximum `(min ,maximum new-value)) (t 'new-value))) ,variable-place)))) (make-instance 'osd-numeric-input ,@osd-button-keyargs :text (if ,update-p (format nil ,format-text ,variable-place) "-") :writer numeric-writer :text-updater #'(lambda () (if ,update-p (format nil ,format-text ,variable-place) "-")) :middle-click (lambda (self) (unwind-protect (setf (text-of self) (format nil ,format-text (funcall numeric-writer (+ ,variable-place (* ,wheel-delta-form 0.1))))) (signal 'mouse-handled))) :right-click (lambda (self) (unwind-protect (setf (text-of self) (format nil ,format-text (funcall numeric-writer (- ,variable-place (* ,wheel-delta-form 0.1))))) (signal 'mouse-handled))) :wheel (lambda (self zrel) (unwind-protect (setf (text-of self) (format nil ,format-text (funcall numeric-writer (+ ,variable-place (* zrel ,wheel-delta-form))))) (signal 'mouse-handled))) ,@(osd-style :button) :name ',(gensym "OSD-CLAMPF-BUTTON-") ; have to give it a name so it sits in the hash table )))