FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
PluginEventSink.h
1 /**********************************************************\
2 Original Author: Richard Bateman (taxilian)
3 
4 Created: Oct 19, 2009
5 License: Dual license model; choose one of two:
6  New BSD License
7  http://www.opensource.org/licenses/bsd-license.php
8  - or -
9  GNU Lesser General Public License, version 2.1
10  http://www.gnu.org/licenses/lgpl-2.1.html
11 
12 Copyright 2009 PacketPass, Inc and the Firebreath development team
13 \**********************************************************/
14 
15 #pragma once
16 #ifndef H_FB_PLUGINEVENTSINK
17 #define H_FB_PLUGINEVENTSINK
18 
19 #include "PluginEventSource.h"
20 #include <boost/enable_shared_from_this.hpp>
21 #include <boost/shared_ptr.hpp>
22 #include <boost/noncopyable.hpp>
23 #include <string>
24 
25 namespace FB {
26 
27  class PluginEvent;
28 
29  FB_FORWARD_PTR(PluginEventSink);
36  class PluginEventSink : public boost::enable_shared_from_this<PluginEventSink>, boost::noncopyable
37  {
38  public:
39  PluginEventSink() { };
40  virtual ~PluginEventSink() { };
41 
42  public:
43 
81  virtual bool HandleEvent(PluginEvent *event, PluginEventSource *source) = 0;
82  };
83 };
84 
97 #define BEGIN_PLUGIN_EVENT_MAP() virtual bool HandleEvent(FB::PluginEvent *evt, FB::PluginEventSource *src) { \
98  if (0) { }
99 
118 #define EVENTTYPE_CASE(eventType, methodName, srcType) else if (evt->validType<eventType>() && src->validType<srcType>()) { \
119  return methodName(evt->get<eventType>(), src->get_as<srcType>()); }
120 
121 #define PLUGIN_EVENT_MAP_CASCADE(super) else return super::HandleEvent(evt, src);
122 
131 #define END_PLUGIN_EVENT_MAP() return false; }
132 
133 #endif
134 
virtual bool HandleEvent(PluginEvent *event, PluginEventSource *source)=0
Called by the browser when a system event needs to be handled, such as a mouse event, a keyboard event, or a drawing event.
Plugin event sink; all objects that can receive PluginEvent s should inherit from this class...
Plugin event base class.
Definition: PluginEvent.h:36
Base class for any object, such as BrowserStream or PluginWindow, that needs to fire events to a Plug...