HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OH_EventHandler.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: OH_EventHandler.h ( Op Handler Library, C++)
7  *
8  * COMMENTS:
9  * This is the base class for the various types of event
10  * handlers. Typically gadgets will derive from this
11  * (or some subclass of this class) and redefine how
12  * its virtual methods work.
13  *
14  * For full documentation, please refer to DOCS/index.html
15  */
16 
17 #ifndef __OH_EventHandler__
18 #define __OH_EventHandler__
19 
20 #include "OH_API.h"
21 #include <UI/UI_Object.h>
22 #include <OP/OP_Value.h>
23 class OP_Node;
24 class UI_Value;
25 
26 #include "OH_TriggerObject.h"
27 
29 {
30 public:
32  virtual ~OH_EventHandler();
33  virtual const char *ohClassName() const { return "OH_EventHandler"; }
34 
35  // You call ohRequestDeferredUpdate in response to an event that
36  // should cause an Update. When the time is right, OH will call
37  // ohHandleDeferredUpdate for you. You should override
38  // ohHandleDeferredUpdate to do the "Update" computation. If you
39  // think that the "Update" should cause you gadget to Redraw, then
40  // call ohRequestDeferredRedraw. That in turn, will call
41  // ohHandleDeferredRedraw.
42  //
43  // Note: OH_OpEventHandler overrides ohHandleDeferredUpdate already
44  // and calls ohHandleDeferredNodeUpdate that can be overridden.
45 
46  virtual void ohRequestDeferredUpdate();
47  virtual void ohHandleDeferredUpdate();
48  virtual void ohRequestDeferredRedraw();
49  virtual void ohHandleDeferredRedraw();
50 
51  // These two should only called by OH_TriggerObject. You should typically
52  // only override ohHandleTimeChange, and then only if you've called
53  // ohAddTimeInterest.
54  virtual void ohHandleTrigger();
55  virtual void ohHandleTimeChange(UI_Event *);
56 
57  // The following Time functions are provided purely for convenience.
58  // Their functioning is completely independent of the rest of this
59  // class.
61  { myOHtriggerObject.addTimeInterest(); }
63  { myOHtriggerObject.removeTimeInterest(); }
64 
65  // ohGetTimeValue returns NULL if you haven't set a time interest
67  { return myOHtriggerObject.getTimeValue(); }
68 
69  // ohGetTime returns 0 if you haven't set a time interest
70  fpreal ohGetTime() const
71  { return myOHtriggerObject.getTime(); }
72 
73 protected:
74  virtual void ohRequestTrigger();
75 
76  bool ohUpdatePending() const { return myOHupdatePending; }
77 
78 private:
79  OH_TriggerObject &myOHtriggerObject;
80 
81  bool myOHtriggerPending;
82  bool myOHupdatePending;
83  bool myOHredrawPending;
84 };
85 
86 #endif
void ohAddTimeInterest()
void ohRemoveTimeInterest()
#define OH_API
Definition: OH_API.h:10
fpreal ohGetTime() const
UI_Value * ohGetTimeValue()
virtual const char * ohClassName() const
bool ohUpdatePending() const
double fpreal
Definition: SYS_Types.h:263