42 using namespace vlMFC;
79 cs.dwExStyle |= WS_EX_ACCEPTFILES;
80 cs.style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
81 return CView::PreCreateWindow(cs);
84 MDIWindow::~MDIWindow()
86 dispatchDestroyEvent();
89 void MDIWindow::destroyGLContext()
96 if ( wglDeleteContext(mHGLRC) == FALSE )
98 MessageBox( L
"OpenGL context creation failed.\n" 99 L
"The handle either doesn't specify a valid context or the context is being used by another thread.", L
" MDIWindow::destroyGLContext() error!", MB_OK);
112 void MDIWindow::OnDestroy()
114 dispatchDestroyEvent();
118 void MDIWindow::OnPaint()
120 if (hwnd() && hdc() && hglrc())
121 dispatchUpdateEvent();
137 void MDIWindow::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
139 unsigned short unicode_out = 0;
142 dispatchKeyPressEvent(unicode_out, key_out);
145 void MDIWindow::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
147 unsigned short unicode_out = 0;
150 dispatchKeyReleaseEvent(unicode_out, key_out);
153 void MDIWindow::countAndCapture()
156 if (mMouseDownCount == 1)
157 ::SetCapture(hwnd());
160 void MDIWindow::countAndRelease()
163 if (mMouseDownCount <= 0)
170 void MDIWindow::OnLButtonDblClk(UINT nFlags, CPoint point)
173 dispatchMouseDownEvent(
LeftButton, point.x, point.y );
176 void MDIWindow::OnLButtonDown(UINT nFlags, CPoint point)
179 dispatchMouseDownEvent(
LeftButton, point.x, point.y );
182 void MDIWindow::OnLButtonUp(UINT nFlags, CPoint point)
185 dispatchMouseUpEvent(
LeftButton, point.x, point.y );
188 void MDIWindow::OnMButtonDblClk(UINT nFlags, CPoint point)
191 dispatchMouseDownEvent(
MiddleButton, point.x, point.y );
194 void MDIWindow::OnMButtonDown(UINT nFlags, CPoint point)
197 dispatchMouseDownEvent(
MiddleButton, point.x, point.y );
200 void MDIWindow::OnMButtonUp(UINT nFlags, CPoint point)
206 void MDIWindow::OnMouseMove(UINT nFlags, CPoint point)
208 dispatchMouseMoveEvent( point.x, point.y );
211 BOOL MDIWindow::OnMouseWheel(UINT nFlags,
short zDelta, CPoint pt)
213 dispatchMouseWheelEvent (zDelta/120);
217 void MDIWindow::OnRButtonDblClk(UINT nFlags, CPoint point)
220 dispatchMouseDownEvent(
RightButton, point.x, point.y );
223 void MDIWindow::OnRButtonDown(UINT nFlags, CPoint point)
226 dispatchMouseDownEvent(
RightButton, point.x, point.y );
229 void MDIWindow::OnRButtonUp(UINT nFlags, CPoint point)
232 dispatchMouseUpEvent(
RightButton, point.x, point.y );
235 void MDIWindow::OnDropFiles(HDROP hDrop)
237 int count = DragQueryFile(hDrop, 0xFFFFFFFF, 0, 0);
238 const int char_count = 1024;
239 std::vector<String> files;
240 for(
int i=0; i<count; ++i)
242 wchar_t file_path[char_count];
243 memset(file_path, 0, char_count);
244 DragQueryFile(hDrop,i,file_path,char_count);
245 files.push_back(file_path);
247 dispatchFileDroppedEvent(files);
250 void MDIWindow::OnSize (UINT nType,
int cx,
int cy)
252 CWnd::OnSize(nType, cx, cy);
254 if (0 >= cx || 0 >= cy || nType == SIZE_MINIMIZED)
257 framebuffer()->setWidth(cx);
258 framebuffer()->setHeight(cy);
259 dispatchResizeEvent(cx, cy);
Visualization Library main namespace.
VLWIN32_EXPORT void translateKeyEvent(WPARAM wParam, LPARAM lParam, unsigned short &unicode_out, vl::EKey &key_out)
The MFC bindings namespace.
The MDIWindow class is an MFC CView with the functionalities of a Win32Context (experimental).