Commit 53054f09 authored by Clinton Stimpson's avatar Clinton Stimpson
Browse files

BUG: More tweaks for event handling to address user reported issues in bug 649.

parent c720fcb7
......@@ -34,6 +34,21 @@ BEGIN_MESSAGE_MAP(vtkMFCWindow, CWnd)
ON_WM_PAINT()
ON_WM_DESTROY()
ON_WM_ERASEBKGND()
ON_WM_LBUTTONDBLCLK()
ON_WM_LBUTTONDOWN()
ON_WM_MBUTTONDOWN()
ON_WM_RBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MBUTTONUP()
ON_WM_RBUTTONUP()
ON_WM_MOUSEMOVE()
ON_WM_MOUSEWHEEL()
ON_WM_CHAR()
ON_WM_KEYUP()
ON_WM_KEYDOWN()
ON_WM_TIMER()
END_MESSAGE_MAP()
#ifdef _DEBUG
......@@ -176,40 +191,89 @@ BOOL vtkMFCWindow::OnEraseBkgnd(CDC*)
return TRUE;
}
void vtkMFCWindow::OnLButtonDblClk(UINT nFlags, CPoint point)
{
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnLButtonDown(this->GetSafeHwnd(), nFlags, point.x, point.y, 1);
}
void vtkMFCWindow::OnLButtonDown(UINT nFlags, CPoint point)
{
this->SetFocus();
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnLButtonDown(this->GetSafeHwnd(), nFlags, point.x, point.y, 0);
}
void vtkMFCWindow::OnMButtonDown(UINT nFlags, CPoint point)
{
this->SetFocus();
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnMButtonDown(this->GetSafeHwnd(), nFlags, point.x, point.y, 0);
}
void vtkMFCWindow::OnRButtonDown(UINT nFlags, CPoint point)
{
this->SetFocus();
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnRButtonDown(this->GetSafeHwnd(), nFlags, point.x, point.y, 0);
}
void vtkMFCWindow::OnLButtonUp(UINT nFlags, CPoint point)
{
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnLButtonUp(this->GetSafeHwnd(), nFlags, point.x, point.y);
}
void vtkMFCWindow::OnMButtonUp(UINT nFlags, CPoint point)
{
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnMButtonUp(this->GetSafeHwnd(), nFlags, point.x, point.y);
}
LRESULT vtkMFCWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_LBUTTONDBLCLK:
case WM_MBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
// grab focus on mouse downs
this->SetFocus();
// follow through
case WM_MBUTTONUP:
case WM_RBUTTONUP:
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
case WM_MOUSEWHEEL:
case WM_CHAR:
case WM_KEYDOWN:
case WM_KEYUP:
case WM_TIMER:
if (this->GetInteractor()->GetInitialized())
{
return vtkHandleMessage2(this->m_hWnd, message, wParam, lParam,
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor()));
}
break;
}
return CWnd::WindowProc(message, wParam, lParam);
void vtkMFCWindow::OnRButtonUp(UINT nFlags, CPoint point)
{
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnRButtonUp(this->GetSafeHwnd(), nFlags, point.x, point.y);
}
void vtkMFCWindow::OnMouseMove(UINT nFlags, CPoint point)
{
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnMouseMove(this->GetSafeHwnd(), nFlags, point.x, point.y);
}
BOOL vtkMFCWindow::OnMouseWheel(UINT nFlags, short zDelta, CPoint point)
{
if(zDelta > 0)
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnMouseWheelForward(this->GetSafeHwnd(), nFlags, point.x, point.y);
else
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnMouseWheelBackward(this->GetSafeHwnd(), nFlags, point.x, point.y);
return TRUE;
}
void vtkMFCWindow::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnChar(this->GetSafeHwnd(), nChar, nRepCnt, nFlags);
}
void vtkMFCWindow::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnKeyUp(this->GetSafeHwnd(), nChar, nRepCnt, nFlags);
}
void vtkMFCWindow::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnKeyDown(this->GetSafeHwnd(), nChar, nRepCnt, nFlags);
}
void vtkMFCWindow::OnTimer(UINT nIDEvent)
{
static_cast<vtkWin32RenderWindowInteractor*>(this->GetInteractor())->
OnTimer(this->GetSafeHwnd(), nIDEvent);
}
......@@ -59,19 +59,29 @@ public:
protected:
//! windows procedure for this class
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//! handle size events
afx_msg void OnSize(UINT nType, int cx, int cy);
//! handle paint events
afx_msg void OnPaint();
//! handle destroy events
afx_msg void OnDestroy();
//! don't clear background
BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnTimer(UINT nIDEvent);
//! the vtk window
vtkWin32OpenGLRenderWindow* pvtkWin32OpenGLRW;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment