FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
bool FB::PluginEventSink::HandleEvent ( PluginEvent event,
PluginEventSource source 
pure virtual

Called by the browser when a system event needs to be handled, such as a mouse event, a keyboard event, or a drawing event.

The recommended way to implement HandleEvent is with the PLUGINEVENT_TYPE macros, like so:

EVENTTYPE_CASE(FB::MouseDownEvent, onMouseDown, FB::PluginWindow)
EVENTTYPE_CASE(FB::MouseUpEvent, onMouseUp, FB::PluginWindow)
EVENTTYPE_CASE(FB::MouseMoveEvent, onMouseMove, FB::PluginWindow)
  • BEGIN_PLUGIN_EVENT_MAP() will open the HandleEvent function
  • END_PLUGIN_EVENT_MAP() will close the HandleEvent function
  • EVENTTYPE_CASE(eventType, function, eventSourceType) dispatches events of type "eventType" and calls "function" on the current object. The EventSource is casted as "eventSourceType".

If you use these macros, you must also create the matching methods in your class. For example, the methods needed for the map above are:

virtual bool onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow*);
virtual bool onMouseUp(FB::MouseUpEvent *evt, FB::PluginWindow*);
virtual bool onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow*);
Richard Bateman
eventPluginEvent to handle
sourceThe PluginEventSource that the event originated from
true if the event was handled, false if not.

Definition at line 40 of file PluginEventSink.h.