HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CH_EventManager.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: CH_EventManager.h ( Channel Library, C++)
7  *
8  * COMMENTS:
9  * CH_EventManager
10  * . this is the class that manages channel event handlers
11  * . there is one global channel manager
12  * CH_EventHandler
13  * . objects of this type handle events and do things such as:
14  * . keeping track of added channels
15  * . sending out events on destruction
16  * CH_AutoEventHandler
17  * . this class is provided for convenience
18  * . if constructed with a CH_EventHandler, it will register
19  * it with the event manager; when the AutoEventHandler object
20  * goes out of scope, it will unregerister and destroy the
21  * event handler.
22  */
23 
24 #ifndef __CH_EventManager__
25 #define __CH_EventManager__
26 
27 #include "CH_API.h"
28 #include <UT/UT_Map.h>
29 
30 class CH_Channel;
31 
32 /*
33  * the difference between CH_CHANNELS_MAJOR_CHANGE and CH_CHANNEL_CHANGED is that
34  * the former indicates a major change to the segments and will lead to an
35  * OP_PARM_ANIMATED event being sent out in OP_Channels, whereas the latter is
36  * not so major.
37  *
38  * order matters with these events
39  */
40 typedef enum {
41  CH_UNCHANGED, // used to dirty caches without sending extra
42  // events (see PRM_Parm::indirectChange())
43  CH_CHANNELS_DELETED, // one or more fewer channels (data: NULL)
44  CH_CHANNELS_ADDED, // new channel (singular?)
45  CH_CHANNELS_MAJOR_CHANGE, // segment pointers changed/added/removed, etc.
46  CH_CHANNEL_CHANGED, // key values changed, etc.
47  CH_CHANNEL_UICHANGED, // eg. expression mode
48  CH_PARM_ENABLE_CHANGED, // parm enable state changed
49  CH_PARM_VISIBLE_CHANGED, // parm visible state changed
50  CH_CHANNELS_MOVED, // time value(s) changed
51  CH_PERMISSION_CHANGED, // permission to this channel changed
52 
53  // These CH_GROUP* events are used by the CH_Manager only
54  CH_GROUP_CREATED, // must be first CH_GROUP item!
60  CH_GROUP_CHANGED, // must be last CH_GROUP item!
61 
66 
69 
70 CH_API extern const char * CHeventNames[CH_CHANGE_TYPE_COUNT];
71 
73 {
74 public:
76  virtual ~CH_EventHandler() {}
77  virtual void event( CH_CHANGE_TYPE, void * );
78 
80  {
81  return new CH_EventHandler;
82  }
83 };
84 
85 typedef CH_EventHandler *(*CH_EventHandlerCreator)();
86 
87 
88 class CH_Collection;
89 
91 {
92 public:
94  virtual ~CH_EventHandlerHash();
95  virtual void event( CH_CHANGE_TYPE, void * );
96 
98  {
99  return new CH_EventHandlerHash;
100  }
101 protected:
102  void removeReferencingEvents(void *data);
103 private:
105  bool myScopeChanged;
106  CH_Collection *myRootCollection;
107 };
108 
110 {
111 public:
112  CH_EventManager();
113  virtual ~CH_EventManager();
114 
115  void beginHandlingEvents( CH_EventHandlerCreator creator );
116  void endHandlingEvents();
117 
118  CH_EventHandler *getHandler();
119 
120  bool enabled() const;
121  void setEnabled(bool e);
122 
123 private:
124  CH_EventHandler *myDefaultHandler;
125  CH_EventHandler *myCurrentHandler;
126  int myLevels;
127  bool myEnabled;
128 };
129 
131 
132 // The following functions are provided for convenience:
133 CH_API void CHevent( CH_CHANGE_TYPE, void * );
134 
136 {
137 public:
139  {
141  }
142 
144  {
146  }
147 };
148 
149 #endif
static CH_EventHandler * newHandler()
CH_EventHandler *(* CH_EventHandlerCreator)()
CH_AutoEventHandler(CH_EventHandlerCreator creator)
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glcorearb.h:2538
struct _cl_event * event
Definition: glcorearb.h:2960
CH_API const char * CHeventNames[CH_CHANGE_TYPE_COUNT]
CH_CHANGE_TYPE
virtual ~CH_EventHandler()
static CH_EventHandler * newHandler()
void endHandlingEvents()
CH_API void CHevent(CH_CHANGE_TYPE, void *)
CH_API CH_EventManager * CHgetEventManager()
GLboolean * data
Definition: glcorearb.h:130
#define CH_API
Definition: CH_API.h:10
virtual void event(CH_CHANGE_TYPE, void *)
void beginHandlingEvents(CH_EventHandlerCreator creator)