0032306: Draw Harness, ViewerTest - move window message processing to TKService
[occt.git] / src / ViewerTest / ViewerTest_EventManager.hxx
index 25f23db..4b54598 100644 (file)
@@ -26,7 +26,7 @@ class V3d_View;
 
 DEFINE_STANDARD_HANDLE(ViewerTest_EventManager, Standard_Transient)
 
-//! used to manage mouse event (move,select,shiftselect)
+//! used to manage mouse event (move,select)
 //! By default the events are transmitted to interactive context.
 class ViewerTest_EventManager : public Standard_Transient, public AIS_ViewController
 {
@@ -47,11 +47,17 @@ public:
     return Draw_ToExitOnCloseView;
   }
 
+  //! Use global camera animation object shared across all Views in ViewerTest.
+  Standard_EXPORT static const Handle(AIS_AnimationCamera)& GlobalViewAnimation();
+
 public:
 
   //! Main constructor.
   Standard_EXPORT ViewerTest_EventManager(const Handle(V3d_View)& aView, const Handle(AIS_InteractiveContext)& aCtx);
-  
+
+  //! Destructor.
+  Standard_EXPORT virtual ~ViewerTest_EventManager();
+
   //! Return interactive context.
   const Handle(AIS_InteractiveContext)& Context() const { return myCtx; }
 
@@ -75,26 +81,62 @@ public:
                                                    Aspect_VKeyFlags theModifiers,
                                                    bool theIsEmulated) Standard_OVERRIDE;
 
+  //! Release key.
+  Standard_EXPORT virtual void KeyDown (Aspect_VKey theKey,
+                                        double theTime,
+                                        double thePressure = 1.0) Standard_OVERRIDE;
+
   //! Release key.
   Standard_EXPORT virtual void KeyUp (Aspect_VKey theKey,
                                       double theTime) Standard_OVERRIDE;
 
   //! Redraw the View on an Expose Event
-  Standard_EXPORT virtual void ProcessExpose();
+  Standard_EXPORT virtual void ProcessExpose() Standard_OVERRIDE;
+
+  //! Handle redraw.
+  Standard_EXPORT virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
+                                                 const Handle(V3d_View)& theView) Standard_OVERRIDE;
 
   //! Resize View.
-  Standard_EXPORT virtual void ProcessConfigure();
+  Standard_EXPORT virtual void ProcessConfigure (bool theIsResized = true) Standard_OVERRIDE;
+
+  //! Handle window input event immediately (flush input buffer).
+  Standard_EXPORT virtual void ProcessInput() Standard_OVERRIDE;
 
   //! Handle KeyPress event.
   Standard_EXPORT void ProcessKeyPress (Aspect_VKey theKey);
 
+protected:
+
+  //! Register hot-keys for specified Action.
+  void addActionHotKeys (Aspect_VKey theAction,
+                         unsigned int theHotKey1 = 0,
+                         unsigned int theHotKey2 = 0,
+                         unsigned int theHotKey3 = 0,
+                         unsigned int theHotKey4 = 0,
+                         unsigned int theHotKey5 = 0)
+  {
+    if (theHotKey1 != 0) { myNavKeyMap.Bind (theHotKey1, theAction); }
+    if (theHotKey2 != 0) { myNavKeyMap.Bind (theHotKey2, theAction); }
+    if (theHotKey3 != 0) { myNavKeyMap.Bind (theHotKey3, theAction); }
+    if (theHotKey4 != 0) { myNavKeyMap.Bind (theHotKey4, theAction); }
+    if (theHotKey5 != 0) { myNavKeyMap.Bind (theHotKey5, theAction); }
+  }
+
+  //! Handle modifier key changes.
+  Standard_EXPORT bool navigationKeyModifierSwitch (unsigned int theModifOld,
+                                                    unsigned int theModifNew,
+                                                    double       theTimeStamp);
+
 private:
 
   Handle(AIS_InteractiveContext) myCtx;
   Handle(V3d_View) myView;
+  NCollection_DataMap<unsigned int, Aspect_VKey> myNavKeyMap; //!< map of Hot-Key (key+modifiers) to Action
 
   TCollection_AsciiString myPickPntArgVec[3];
   Standard_Boolean myToPickPnt;
+  Standard_Boolean myIsTmpContRedraw;
 
 };