[vtk-developers] Re: GUISupport directory ?
de Boer Ingo
I.deBoer at polytec.de
Wed Feb 9 11:16:47 EST 2005
Hi,
Mathieu asked me to join in this conversation.
First of all, I have submitted some new MFC samples in the
bug tracker some time ago. You can find them at:
http://www.vtk.org/Bug/bug.php?op=show&bugid=649&pos=0
Now, when you want to use a CWnd with VTK you have to
handle some CWnd functions, like (pseudo code):
OnCreate(LPCREATESTRUCT lpCreateStruct)
{
this->pvtkWin32OpenGLRW->AddRenderer(this->pvtkRenderer);
this->pvtkWin32OpenGLRW->SetParentId(this->GetParent()->GetSafeHwnd());
this->pvtkWin32OpenGLRW->SetWindowId(this->GetSafeHwnd());
this->pvtkWin32RenderWI->SetRenderWindow(this->pvtkWin32OpenGLRW);
if ( !this->pvtkWin32RenderWI->GetInitialized() )
this->pvtkWin32RenderWI->Initialize();
}
OnSize(UINT nType, int cx, int cy)
{
CRect cRect;
this->GetWindowRect(cRect);
if (this->pvtkWin32RenderWI->GetInitialized())
this->pvtkWin32RenderWI->UpdateSize(cRect.Width(), cRect.Height());
}
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MOUSEMOVE:
case WM_CHAR:
case WM_TIMER:
if (this->pvtkWin32RenderWI->GetInitialized())
{
return vtkHandleMessage2(this->GetSafeHwnd(), message, wParam, lParam, this->pvtkWin32RenderWI);
}
break;
}
}
OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
The more detailed version can be found in the view classes of the samples.
greets
Ingo
---
Dr.-Ing. Ingo H. de Boer
Polytec GmbH
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax : ++49 7243 604 255
More information about the vtk-developers
mailing list