[cells-devel] Cello: 'find-view-under: Semantics ?
Kenneth Tilton
kentilton at gmail.com
Fri Jul 24 15:48:12 UTC 2009
Frank Goenninger wrote:
> Hi again -
>
> thanks again for the fast response on my last request - hoping for
> another fast one here ;-)
>
> So, Cello (the original one) has this function:
>
> (defun find-ix-under (self os-pos &key (test #'true))
> (when (and (not (typep self 'tool-tip)) ;; <g>
> (visible self)
> (not (collapsed self)))
> (trc nil "find-ix-under" self os-pos (screen-box self))
> (let ((inself (point-in-box os-pos (screen-box self))))
> (or (when (or inself (not (clipped self)))
> (trc nil "inside self sbox" self os-pos (screen-box self))
> (dolistreversed (k (or (render-order self)(kids
> self))) ;; overlap goes to last kid displayed
> (unless (typep k 'window)
> (trc nil "fixunder kid!!!!!!!!" k)
> (bwhen (ix (find-ix-under k os-pos :test test))
> (return-from find-ix-under ix)))))
>
> (when (and inself
> (funcall test self)
> (not (ix-click-transparent self)))
> (trc nil self os-pos (screen-box self))
> self)))))
>
> which is used as follows:
>
> (defmd mouse-view-tracker ()
> (mouse-view :initarg :mouse-view :accessor mouse-view
> :initform (c? (let ((pos (mouse-pos .og.)))
> (trc nil "mouseview sees pos" .w. pos)
> (when pos
> (eko (nil "ix-togl mouseview >" self)
> (without-c-dependency
> (find-ix-under self pos)))))))
> (:documentation "Mixin to have mouse view tracked in a subtree of
> the window, mostly so other GUI layout can depend on
> the sub-tree layout without creating a cyclic dependency, as would
> happen iof the whole window were watched."))
>
> (defmd ix-togl (mouse-view-tracker #+not focuser ogl-lit-scene control
> ogl-shared-resource-tender togl ix-view)
> ...
>
> So, the togl widget is a sub-class of mouse-view-tracker. I understand
> this as "show me the control that is currently being pointed at by the
> mouse".
>
> Only thing is: When looking at the code for 'find-ix-under I can't see
> how this could possibly work? May I ask for a walk-through of find-ix-
> under ?
haha, no! Please walk me thru what you do not understand. The disabled
debug statements give you some hints: first I recursively check kids, if
that comes up empty I check myself to see if I am under the mouse and
want to be the result.
hth, kt
ps. Yes, it works. :) k
More information about the cells-devel
mailing list