HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UI_OHEventHandler.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: UI_OHEventHandler.h ( UI 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 __UI_EventHandler__
18 #define __UI_EventHandler__
19 
20 #include "UI_API.h"
21 #include "UI_Object.h"
22 class UI_Value;
23 
24 #include "UI_OHTriggerObject.h"
25 
27 {
28 public:
30  virtual ~UI_OHEventHandler();
31  virtual const char *ohClassName() const { return "UI_OHEventHandler"; }
32 
33  // You call ohRequestDeferredUpdate in response to an event that
34  // should cause an Update. When the time is right, UI will call
35  // ohHandleDeferredUpdate for you. You should override
36  // ohHandleDeferredUpdate to do the "Update" computation. If you
37  // think that the "Update" should cause you gadget to Redraw, then
38  // call ohRequestDeferredRedraw. That in turn, will call
39  // ohHandleDeferredRedraw.
40  //
41  // Note: OH_OpEventHandler overrides ohHandleDeferredUpdate already
42  // and calls ohHandleDeferredNodeUpdate that can be overridden.
43 
44  virtual void ohRequestDeferredUpdate();
45  virtual void ohHandleDeferredUpdate();
46  virtual void ohRequestDeferredRedraw();
47  virtual void ohHandleDeferredRedraw();
48 
49  // These two should only called by UI_TriggerObject. You should typically
50  // only override ohHandleTimeChange, and then only if you've called
51  // ohAddTimeInterest.
52  virtual void ohHandleTrigger();
53  virtual void ohHandleTimeChange(UI_Event *);
54 
55  // The following Time functions are provided purely for convenience.
56  // Their functioning is completely independent of the rest of this
57  // class.
59  { myOHtriggerObject.addTimeInterest(); }
61  { myOHtriggerObject.removeTimeInterest(); }
62 
63  // ohGetTimeValue returns nullptr if you haven't set a time interest
65  { return myOHtriggerObject.getTimeValue(); }
66 
67  // ohGetTime returns 0 if you haven't set a time interest
68  fpreal ohGetTime() const
69  { return myOHtriggerObject.getTime(); }
70 
71  void ohAllowNestedRedraws() { myOHAllowNestedRedraws=true; }
72 
73 protected:
74  virtual void ohRequestTrigger();
75 
76  bool ohUpdatePending() const { return myOHupdatePending; }
77 
78 private:
79  UI_OHTriggerObject &myOHtriggerObject;
80 
81  bool myOHtriggerPending;
82  bool myOHupdatePending;
83  bool myOHredrawPending;
84  bool myOHAllowNestedRedraws;
85 };
86 
87 #endif
88 
virtual const char * ohClassName() const
fpreal ohGetTime() const
fpreal64 fpreal
Definition: SYS_Types.h:277
UI_Value * ohGetTimeValue()
#define UI_API
Definition: UI_API.h:10
bool ohUpdatePending() const