]> OCCT Git - occt-copy.git/commitdiff
0030352: DRAW - Extending interface of ViewerTest_EventManager to process mouse butto...
authornds <nds@opencascade.com>
Wed, 7 Nov 2018 15:44:12 +0000 (18:44 +0300)
committernds <nds@opencascade.com>
Wed, 7 Nov 2018 16:39:40 +0000 (19:39 +0300)
(cherry picked from commit 41e01634af5fccd37fc86931dac6f5c5569a63da)

src/ViewerTest/ViewerTest_EventManager.hxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx

index 05352ce6080dc448626174da478ddc4030914a1d..fcceda9139b26a3b72c9888f4952a733a0a5564b 100644 (file)
@@ -31,7 +31,7 @@ class V3d_View;
 class ViewerTest_EventManager;
 DEFINE_STANDARD_HANDLE(ViewerTest_EventManager, Standard_Transient)
 
-//! used to manage mouse event (move,select,shiftselect)
+//! used to manage mouse event (move,press,release). There is an interface to select, shiftselect in view.
 //! By default the events are transmitted to interactive context.
 class ViewerTest_EventManager : public Standard_Transient
 {
@@ -41,6 +41,38 @@ public:
   
   Standard_EXPORT ViewerTest_EventManager(const Handle(V3d_View)& aView, const Handle(AIS_InteractiveContext)& aCtx);
   
+  //! Processing key button pressed
+  //! \param buf_ret key button symbol
+  //! \return true if processed
+  Standard_EXPORT virtual Standard_Boolean ProcessKeyPress (const char* buf_ret) { (void)buf_ret; return Standard_False; }
+
+  //! Processing mouse button pressed
+  //! \param theXPressed X pixel coordinate
+  //! \param theXPressed Y pixel coordinate
+  //! \param theIsShift state if the SHIFT key modifier is ON
+  //! \return true if processed
+  Standard_EXPORT virtual Standard_Boolean ProcessButton1Press (const Standard_Integer theXPressed,
+                                                                const Standard_Integer theYPressed,
+                                                                Standard_Boolean theIsShift)
+  { (void)theXPressed; (void)theYPressed; (void)theIsShift; return Standard_False; }
+
+  //! Processing mouse button released
+  //! \param theXPressed X pixel coordinate
+  //! \param theXPressed Y pixel coordinate
+  //! \param theIsShift state if the SHIFT key modifier is ON
+  //! \return true if processed
+  Standard_EXPORT virtual Standard_Boolean ProcessButton1Release (const Standard_Integer theXPressed,
+                                                                  const Standard_Integer theYPressed,
+                                                                  Standard_Boolean theIsShift)
+  { (void)theXPressed; (void)theYPressed; (void)theIsShift; return Standard_False; }
+
+  //! Processing mouse move over the viewer
+  //! \param theXPressed X pixel coordinate
+  //! \param theXPressed Y pixel coordinate
+  Standard_EXPORT virtual Standard_Boolean ProcessMouseMove (const Standard_Integer theXPressed,
+                                                             const Standard_Integer theYPressed)
+  { (void)theXPressed; (void)theYPressed; return Standard_False; }
+
   Standard_EXPORT virtual void MoveTo (const Standard_Integer xpix, const Standard_Integer ypix);
   
   Standard_EXPORT virtual void Select();
index 21c7ae84a00df9cb9950cd879289701d5ff01989..3c2750f99effcbebab690054772d34cd25002022 100644 (file)
@@ -2218,6 +2218,8 @@ static LRESULT WINAPI AdvViewerWindowProc( HWND hwnd,
       break;
 
     case WM_LBUTTONUP:
+      ViewerTest::CurrentEventManager()->ProcessButton1Release (X_Motion, Y_Motion, (fwKeys & MK_SHIFT) != 0);
+
       if (IsDragged && !DragFirst)
       {
         if (!GetActiveAISManipulator().IsNull())
@@ -2250,6 +2252,8 @@ static LRESULT WINAPI AdvViewerWindowProc( HWND hwnd,
       return ViewerWindowProc (hwnd, Msg, wParam, lParam);
 
     case WM_LBUTTONDOWN:
+      ViewerTest::CurrentEventManager()->ProcessButton1Press (LOWORD(lParam), HIWORD(lParam), (fwKeys & MK_SHIFT) != 0);
+
       if (!GetActiveAISManipulator().IsNull())
       {
         IsDragged = ( fwKeys == MK_LBUTTON );
@@ -2268,6 +2272,8 @@ static LRESULT WINAPI AdvViewerWindowProc( HWND hwnd,
       return ViewerWindowProc( hwnd, Msg, wParam, lParam );
 
     case WM_MOUSEMOVE:
+      ViewerTest::CurrentEventManager()->ProcessMouseMove (LOWORD (lParam), HIWORD (lParam));
+
       if (IsDragged)
       {
         X_Motion = LOWORD (lParam);
@@ -2394,6 +2400,8 @@ static LRESULT WINAPI ViewerWindowProc( HWND hwnd,
         {
           c[0] = '*';
         }
+        ViewerTest::CurrentEventManager()->ProcessKeyPress (c);
+
         VT_ProcessKeyPress (c);
       }
       break;