Update of /project/mcclim/cvsroot/mcclim/Examples In directory clnet:/tmp/cvs-serv17453/Examples
Modified Files: demodemo.lisp Log Message:
As an extension, recognize an initarg :PRESENTATION-TYPE-KEY to the list pane. Like :VALUE-KEY and :NAME-KEY, it can specify a function to be called for each list item. The presentation type key can return NIL, or a presentation type to be used for the item.
If such a type is returned, selection of the item will throw a presentation of that type before the value-change callback is called.
In addition, right click will be recognized on the list pane and open a presentation menu.
* gadgets.lisp (META-LIST-PANE): New slot presentation-type-key. ((VALUE-CHANGED-CALLBACK :BEFORE META-LIST-PANE)): Optionally throw a presentation. (AD-HOC-PRESENTATION, OUTPUT-RECORD-HIT-DETECTION-RECTANGLE*): New class and method. (GENERIC-LIST-PANE-HANDLE-RIGHT-CLICK, META-LIST-PANE-CALL-PRESENTATION-MENU): New functions. ((HANDLE-EVENT GENERIC-LIST-PANE)): Handle right clicks. * Examples/demodemo.lisp (list-pane-test): Modified to demonstrate presentation-type-key. * Backends/gtkairo/event.lisp (HANDLE-EVENT-P): New generic function. (BUTTON-HANDLER): Trap the event only if handle-event-p returns true. * Backends/gtkairo/gadgets.lisp ((HANDLE-EVENT-P GTK-LIST), (CONNECT-NATIVE-SIGNALS GTK-LIST)): Handle right clicks. (GTK-LIST-ONE-VALUE): New function. ((HANDLE-EVENT GTK-LIST)): Call meta-list-pane-call-presentation-menu.
--- /project/mcclim/cvsroot/mcclim/Examples/demodemo.lisp 2006/12/24 14:27:48 1.16 +++ /project/mcclim/cvsroot/mcclim/Examples/demodemo.lisp 2006/12/27 14:47:24 1.17 @@ -218,7 +218,9 @@ (make-pane 'list-pane :value 'clim:region-intersection :items (apropos-list "INTER" :clim t) - :name-key (lambda (x) (format nil "~(~S~)" x))))) + :presentation-type-key (constantly 'list-test-symbol) + :name-key (lambda (x) (format nil "~(~S~)" x)))) + (interactor :interactor :height 200)) (:layouts (defaults (labelling (:label "Matching symbols" @@ -230,7 +232,17 @@ substring (make-pane 'push-button :label "Update" - :activate-callback 'update-list-test))))))) + :activate-callback 'update-list-test)) + interactor))))) + +(define-presentation-type list-test-symbol ()) + +(define-list-test-command com-describe-symbol + ((sym 'list-test-symbol :gesture :select)) + ;; Let's print only three lines, we don't have space for more. + (with-input-from-string (s (with-output-to-string (s) (describe sym s))) + (dotimes (x 3) + (write-line (read-line s nil "") *standard-input*))))
(defun update-list-test (pane) (declare (ignore pane))