CLIM mail archive
[Prev][Next][Index][Thread]
presentation actions
We were suprised to find that CLIM 0.9 did not have
define-presentation-action, so Jeff Morrill wrote one:
(defmacro define-action
(name
(from-type to-type &key command-table gesture tester documentation (menu t))
arglist
&body body)
;; This is similar to define-presentation-translator, except that the body of the
;; action is not intended to return a value, but should instead side-effect some
;; sort of application state.
(progn
(pushnew 'window arglist)
(pushnew 'gesture arglist)
;; To prevent the body from getting evaluated in the process of testing the
;; applicability of the translator, the tester should return T as the second
;; value.
(cond ((not tester)
(setq tester `((presentation)
(values (ci::presentation-matches-type-p presentation ',from-type)
t))))
(t (setq tester `(,(first tester) (values (progn ,@(rest tester)) t)))))
(when (and command-table (eql to-type 'command))
(setq to-type `(command :command-table ,(eval command-table))))
`(clim:define-presentation-translator
,name
(,from-type ,to-type :tester ,tester :gesture ,gesture
:menu ,menu
:documentation ((stream) (format stream "~A" ,documentation)))
,arglist
(when (not (eq gesture :for-menu))
,@body
;; pretty big hammer, but we need to get blips etc out of the input buffer.
(clim:stream-clear-input window)
'(ignore)))))
0,,
Main Index |
Thread Index