]> 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>
Tue, 30 Apr 2019 11:58:15 +0000 (14:58 +0300)
(cherry picked from commit 41e01634af5fccd37fc86931dac6f5c5569a63da)
(cherry picked from commit 7660866377b29c3cf6ca6aedde23ca57feb5158f)

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 5ce04f23d7b7d43677f88b905382c1c42f8b1acc..9cf474884c0898ef93413c47765d8817b64e8d0f 100644 (file)
@@ -3380,6 +3380,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())
@@ -3412,6 +3414,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 );
@@ -3430,6 +3434,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);
@@ -3556,6 +3562,8 @@ static LRESULT WINAPI ViewerWindowProc( HWND hwnd,
         {
           c[0] = '*';
         }
+        ViewerTest::CurrentEventManager()->ProcessKeyPress (c);
+
         VT_ProcessKeyPress (c);
       }
       break;