CLIM mail archive

[Prev][Next][Index][Thread]

bucky keys on cmd-menu items



   Date: Mon, 2 Nov 92 13:18:49 EST
   From: Clinton Hyde <chyde@chesapeake.ads.com>

   I'd like to use other keys, (shift, control, meta...) on normal
   command-menu items. they seem to get born with :left and :right
   pres-translators; what do I need to do to get a :middle or a
   :shift-left attached to one?

Here is the source for the presentation-to-command translator for
command menu items.  I don't have time to test this, but you should be
able to modify it to add specialized translators for the gesture(s) of
your choice.

(in-package :clim)

(define-presentation-translator command-menu-element-to-command
    (command-menu-element command global-command-table
     :tester
       ((object event)
	(let* ((menu-item (third object))
	       (type (command-menu-item-type menu-item)))
	  (and (or (eql type ':command)
		   (eql type ':function))
	       (command-enabled-p
		 (command-name (extract-command-menu-item-value menu-item event))
		 *application-frame*))))
     :tester-definitive t
     ;; The pointer-documentation uses this, too
     :documentation
       ((object presentation context-type frame event window x y stream)
	(let ((documentation (getf (command-menu-item-options (third object)) :documentation)))
	  (if documentation
	      (write-string documentation stream)
	      (document-presentation-to-command-translator
		(find-presentation-translator 'command-menu-element-to-command
					      'global-command-table)
		presentation context-type frame event
		window x y stream)))))
    (object event)
  (extract-command-menu-item-value (third object) event))

0,,

References:

Main Index | Thread Index