1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0030352: DRAW - Extending interface of ViewerTest_EventManager to process mouse button event

(cherry picked from commit 41e01634af5fccd37fc86931dac6f5c5569a63da)
(cherry picked from commit 7660866377)
(cherry picked from commit a2cd3c1905a3a3c2fb96ceb8eaec1cc982a64c97)
This commit is contained in:
nds
2018-11-07 18:44:12 +03:00
parent 89d8a85dd8
commit 8688b82341
2 changed files with 41 additions and 1 deletions

View 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();

View File

@@ -3586,6 +3586,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())
@@ -3618,6 +3620,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 );
@@ -3636,6 +3640,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);
@@ -3762,6 +3768,8 @@ static LRESULT WINAPI ViewerWindowProc( HWND hwnd,
{
c[0] = '*';
}
ViewerTest::CurrentEventManager()->ProcessKeyPress (c);
VT_ProcessKeyPress (c);
}
break;