On Wed, 2011-07-27 at 19:17 +0200, Daniel Cámpora wrote:
> Hello again, Jeremy,
> 
> I'm digging into this topic of the EventHandlers for the Widgets. Before 
> implementing my own EventHandler for what I'm trying to do, I'm looking at 
> how does MouseHandler works to see if I can use it.
> 
> In an effort to track down what happens when the MouseHandler enters into 
> action after a mouse action, I can see the responsibility is passed to the 
> WindowManager. For instance, by looking at _handleMouseReleased:
> 
> 
> Code:
> bool WindowManager::_handleMouseReleased(float x, float y, bool& down) {
>     down = false;
>     if(!_lastPush) return false;
>     Event ev(this, EVENT_MOUSE_RELEASE);
>     setEventFromInterface(ev, _lastPush);
>     bool handled = _lastPush->callMethodAndCallbacks(ev);
>     _lastPush = 0;
>     return handled;
> }
> 
> 
> 
> An object of type EventInterface is in charge of executing 
> callMethodAndCallbacks, which at last calls a virtual method mouseRelease, 
> that can be overriden.
> 
> I'm confused about the use of the term "callback" in the EventInterface. Is 
> this a callback or an event triggered from the event handler? Or maybe it's 
> used for both?

All are possible. You can either create a standalone callback object
totally independent of any Window or Widget, you can use a special
overridden method, or you can combine the two. This is what I meant when
I said earlier I tried to support too much at once. :) The method is
always called first, then all callbacks (until one returns true, at
which point they stop).

There are examples of both kinds of event handling in the source.

> I want to develop an EventHandler separate from the widget itself. Can I 
> extend your code in some manner to achieve this, or should I go for a totally 
> custom EventHandler?
>
> Thank you!
> 
> Daniel
> 
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=41671#41671
> 
> 
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to