Main Page | Namespace List | Class Hierarchy | Data Structures | File List | Data Fields | Globals

eventfilter.h

Go to the documentation of this file.
00001 //--- < EVENTFILTER.H > ---------| ViewGraph - A Flexible Graph view Framework |
00002 //
00003 // Event filters do not let specific events
00004 // to pass further down. 
00005 // Use these when efficiency is critical or
00006 // when you want to restrict certain nodes 
00007 // from some activity. Can be useful when 
00008 // placed above groups.
00009 // 
00010 // $Author: botik32 $
00011 // $Revision: 1.1.1.1 $
00012 // $Date: 2004/03/26 10:50:26 $
00013 //-----------------------------------------------------------------------------/
00014 
00015 #ifndef EVENTFILTER_H
00016 #define EVENTFILTER_H
00017 
00018 #include <map>
00019 #include <cZUI/event.h>
00020 #include <cZUI/scenenode.h>
00021 
00022 using namespace std;
00023 
00024 class EventFilter : public SceneNode
00025 {
00026 protected:
00027         map<const char*, int> events;
00028         virtual bool filter( Event * )=0;
00029 public:
00030         void add_event( const char* );
00031         void delete_event( const char* );
00032 
00033         bool handle_event( Event * );
00034         EventFilter( BaseSceneNode * );
00035 };
00036 
00037 // Message filter with default ALLOW policy.
00038 // (i.e. all messages are allowed except the
00039 // ones registered with the filter)
00040 class AllowEventFilter : public EventFilter
00041 {
00042 protected:
00043         bool filter( Event * );
00044 public:
00045         AllowEventFilter( BaseSceneNode * );
00046 };
00047 
00048 // Message filter with default DENY policy.
00049 // (i.e. all messages are forbidden except the
00050 // ones registered with the filter)
00051 class DenyEventFilter : public EventFilter
00052 {
00053 protected:
00054         bool filter( Event * );
00055 public:
00056         DenyEventFilter( BaseSceneNode * );
00057 };
00058 
00059 // AreaFilters disallow all events in some area.
00060 // These are of little use usually; however,
00061 // they can be inherited from together with 
00062 // one of the event filters, to provide 
00063 // area-specific event filtering.
00064 class AreaFilter : public SceneNode
00065 {
00066 protected:
00067         double x1, y1, x2, y2;
00068         virtual bool filter( Event * );
00069 public:
00070         AreaFilter( BaseSceneNode *, 
00071                 double, double, double, double );
00072         bool handle_event( Event * );
00073 };
00074 
00075 // Message filter with default ALLOW policy.
00076 // (i.e. all messages are allowed except the
00077 // ones registered with the filter).
00078 // Restricted to a certain area.
00079 class AllowAreaFilter : public AllowEventFilter, 
00080         public AreaFilter
00081 {
00082 protected:
00083         bool filter( Event * );
00084 public:
00085         AllowAreaFilter( BaseSceneNode* ,
00086                 double, double, double, double );
00087 };
00088 
00089 // Message filter with default DENY policy.
00090 // (i.e. all messages are forbidden except the
00091 // ones registered with the filter)
00092 // Restricted to a certain area.
00093 class DenyAreaFilter : public DenyEventFilter, 
00094         public AreaFilter
00095 {
00096 protected:
00097         bool filter( Event * );
00098 public:
00099         DenyAreaFilter( BaseSceneNode* ,
00100                 double, double, double, double );
00101 };
00102 
00103 #endif
00104 

Generated on Wed Jun 23 18:47:21 2004 for cZUI by doxygen 1.3.5