Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Win32Window.cpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #include <vlWin32/Win32Window.hpp>
33 #include <vlCore/Time.hpp>
34 #include <shellapi.h>
35 
36 using namespace vl;
37 using namespace vlWin32;
38 
39 //-----------------------------------------------------------------------------
40 namespace vlWin32
41 {
42  const wchar_t* gWin32WindowClassName = L"VisualizationLibraryWindowClass";
43 
45  {
46  static bool class_already_registered = false;
47  if (!class_already_registered)
48  {
49  WNDCLASS wc;
50  memset(&wc, 0, sizeof(wc));
51  /* only register the window class once. */
52  wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
53  wc.lpfnWndProc = (WNDPROC)Win32Window::WindowProc;
54  wc.cbClsExtra = 0;
55  wc.cbWndExtra = 0;
56  wc.hInstance = GetModuleHandle(NULL);
57  wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
58  wc.hCursor = LoadCursor(NULL, IDC_ARROW);
59  wc.hbrBackground = NULL;
60  wc.lpszMenuName = NULL;
61  wc.lpszClassName = gWin32WindowClassName;
62 
63  if (!RegisterClass(&wc))
64  MessageBox(NULL, L"Class registration failed.", L"Visualization Library Error", MB_OK);
65  else
66  class_already_registered = true;
67  }
68  return class_already_registered;
69  }
70 
71  #if 0
72  // used for debugging purposes
73  void win32PrintError(LPTSTR lpszFunction)
74  {
75  TCHAR szBuf[80];
76  LPVOID lpMsgBuf;
77  DWORD dw = GetLastError();
78 
79  FormatMessage(
80  FORMAT_MESSAGE_ALLOCATE_BUFFER |
81  FORMAT_MESSAGE_FROM_SYSTEM,
82  NULL,
83  dw,
84  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
85  (LPTSTR) &lpMsgBuf,
86  0, NULL );
87 
88  wsprintf(szBuf,
89  L"%s failed with error %d: %s",
90  lpszFunction, dw, lpMsgBuf);
91 
92  MessageBox(NULL, szBuf, L"Visualization Library Error", MB_OK);
93 
94  LocalFree(lpMsgBuf);
95  }
96  #endif
97 }
98 //-----------------------------------------------------------------------------
99 std::map< HWND, Win32Window* > Win32Window::mWinMap;
100 //-----------------------------------------------------------------------------
101 LONG WINAPI Win32Window::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
102 {
103  Win32Window* win = Win32Window::getWindow(hWnd);
104  if (!win)
105  return (LONG)DefWindowProc(hWnd, uMsg, wParam, lParam);
106 
107  switch(uMsg)
108  {
109  case WM_PAINT:
110  {
111  // handle event and then dispatch: solves MessageBox dialog problem.
112  LONG val = (LONG)DefWindowProc(hWnd, uMsg, wParam, lParam);
113  if (win->hglrc() && win->hdc() && win->hwnd())
114  win->dispatchUpdateEvent();
115  return val;
116  }
117 
118  case WM_SIZE:
119  {
120  win->framebuffer()->setWidth( LOWORD(lParam) );
121  win->framebuffer()->setHeight( HIWORD(lParam) );
122  win->dispatchResizeEvent( LOWORD(lParam), HIWORD(lParam) );
123  break;
124  }
125 
126  case WM_MOUSEMOVE:
127  {
128  POINTS pt = MAKEPOINTS(lParam);
129  win->dispatchMouseMoveEvent( pt.x, pt.y );
130  break;
131  }
132 
133  case WM_LBUTTONDBLCLK:
134  case WM_LBUTTONDOWN:
135  case WM_MBUTTONDBLCLK:
136  case WM_MBUTTONDOWN:
137  case WM_RBUTTONDBLCLK:
138  case WM_RBUTTONDOWN:
139  {
140  win->mMouseDownCount++;
141  if (win->mMouseDownCount == 1)
142  SetCapture(win->hwnd());
143  EMouseButton button = UnknownButton;
144  if (uMsg == WM_LBUTTONDBLCLK || uMsg == WM_LBUTTONDOWN)
145  button = LeftButton;
146  else if (uMsg == WM_MBUTTONDBLCLK || uMsg == WM_MBUTTONDOWN)
147  button = MiddleButton;
148  else if (uMsg == WM_RBUTTONDBLCLK || uMsg == WM_RBUTTONDOWN)
149  button = RightButton;
150  POINTS pt = MAKEPOINTS(lParam);
151  win->dispatchMouseDownEvent( button, pt.x, pt.y );
152  break;
153  }
154 
155  case WM_LBUTTONUP:
156  case WM_RBUTTONUP:
157  case WM_MBUTTONUP:
158  {
159  win->mMouseDownCount--;
160  if (win->mMouseDownCount <= 0)
161  {
162  ReleaseCapture();
163  win->mMouseDownCount = 0;
164  }
165  EMouseButton button = UnknownButton;
166  if (uMsg == WM_LBUTTONUP)
167  button = LeftButton;
168  else if (uMsg == WM_MBUTTONUP)
169  button = MiddleButton;
170  else if (uMsg == WM_RBUTTONUP)
171  button = RightButton;
172  POINTS pt = MAKEPOINTS(lParam);
173  win->dispatchMouseUpEvent( button, pt.x, pt.y );
174  break;
175  }
176 
177  // If you get a compilation error here:
178  // 1 - you didn't define _WIN32_WINNT as 0x0400 or above.
179  // 2 - you are trying to compile VL with a VERY old (unsupported) Visual Studio / Platform SDK.
180  case WM_MOUSEWHEEL:
181  {
182  win->dispatchMouseWheelEvent( GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA );
183  break;
184  }
185 
186  /*case WM_CLOSE:
187  {
188  win->dispatchDestroyEvent();
189  win->destroyWin32GLWindow();
190  break;
191  }*/
192 
193  case WM_DESTROY:
194  {
195  Win32Window::mWinMap.erase(hWnd);
196  win->dispatchDestroyEvent();
197  win->destroyWin32GLWindow();
198  break;
199  }
200 
201  case WM_KEYDOWN:
202  {
203  unsigned short unicode_out = 0;
204  vl::EKey key_out = Key_None;
205  translateKeyEvent(wParam, lParam, unicode_out, key_out);
206  win->dispatchKeyPressEvent(unicode_out, key_out);
207  break;
208  }
209 
210  case WM_KEYUP:
211  {
212  unsigned short unicode_out = 0;
213  vl::EKey key_out = Key_None;
214  translateKeyEvent(wParam, lParam, unicode_out, key_out);
215  win->dispatchKeyReleaseEvent(unicode_out, key_out);
216  break;
217  }
218 
219  case WM_DROPFILES:
220  {
221  HDROP hDrop = (HDROP)wParam;
222  int count = DragQueryFile(hDrop, 0xFFFFFFFF, 0, 0);
223  const int char_count = 1024;
224  std::vector<String> files;
225  for(int i=0; i<count; ++i)
226  {
227  wchar_t file_path[char_count];
228  memset(file_path, 0, char_count);
229  DragQueryFile(hDrop,i,file_path,char_count);
230  files.push_back(file_path);
231  }
232  win->dispatchFileDroppedEvent(files);
233  break;
234  }
235 
236  // WM_SYSKEYDOWN
237  // WM_SYSKEYUP
238  // WM_GETICON
239  // WM_SETCURSOR
240  // WM_SETICON
241  // WM_CAPTURECHANGED
242  // WM_MOUSEFIRST
243  }
244 
245  return (LONG)DefWindowProc(hWnd, uMsg, wParam, lParam);
246 }
247 //-----------------------------------------------------------------------------
248 // Win32Window
249 //-----------------------------------------------------------------------------
250 Win32Window::Win32Window()
251 {
252  mHWND = NULL;
253  mHDC = NULL;
254  mHGLRC = NULL;
255  mMouseDownCount = 0;
256 
257  mStyle = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
258  mExStyle = WS_EX_APPWINDOW | WS_EX_ACCEPTFILES;
259  mWindowClassName = gWin32WindowClassName;
260 }
261 //-----------------------------------------------------------------------------
262 Win32Window::~Win32Window()
263 {
264  destroyWin32GLWindow();
265 }
266 //-----------------------------------------------------------------------------
267 bool Win32Window::initWin32GLWindow(HWND parent, HGLRC share_context, const vl::String& title, const vl::OpenGLContextFormat& fmt, int x, int y, int width, int height)
268 {
269  destroyWin32GLWindow();
270 
271  if (!registerClass())
272  return false;
273 
274  unsigned style = mStyle & ~(WS_CHILD|WS_OVERLAPPEDWINDOW);;
275  style |= parent?WS_CHILD:WS_OVERLAPPEDWINDOW;
276 
277  mHWND = CreateWindowEx(
278  mExStyle,
279  mWindowClassName,
280  L"Visualization Library Win32",
281  style,
282  x, y, width, height,
283  parent, NULL, GetModuleHandle(NULL), NULL);
284 
285  if (initWin32GLContext(share_context, title, fmt, x, y, width, height))
286  {
287  mWinMap[mHWND] = this;
288  return true;
289  }
290  else
291  return false;
292 }
293 //-----------------------------------------------------------------------------
294 Win32Window* Win32Window::getWindow(HWND hWnd)
295 {
296  std::map< HWND, Win32Window* >::const_iterator it = mWinMap.find(hWnd);
297  if (it != mWinMap.end())
298  return it->second;
299  else
300  return NULL;
301 }
302 //-----------------------------------------------------------------------------
303 void Win32Window::destroyWin32GLWindow()
304 {
305  // wglMakeCurrent(NULL, NULL) not needed
306 
307  if (hwnd())
308  {
309  bool destroy_win = mWinMap.find(mHWND) != mWinMap.end();
310 
311  // WM_DESTROY must be dispatched while the OpenGL context is still available!
312  if (destroy_win)
313  {
314  DestroyWindow(mHWND);
315  mHWND = NULL;
316  }
317  if (mHGLRC)
318  {
319  if ( wglDeleteContext(mHGLRC) == FALSE )
320  {
321  MessageBox(NULL, L"OpenGL context creation failed.\n"
322  L"The handle either doesn't specify a valid context or the context is being used by another thread.", L"Visualization Library Error", MB_OK);
323  }
324  mHGLRC = NULL;
325  }
326  if (mHDC)
327  {
328  DeleteDC(mHDC);
329  mHDC = NULL;
330  }
331  }
332 }
333 //-----------------------------------------------------------------------------
335 {
336  // iterate over all opengl contexts
337  std::map< HWND, Win32Window* > wins = Win32Window::winMap();
338  for( std::map< HWND, Win32Window* >::iterator it = wins.begin();
339  it != wins.end();
340  ++it )
341  {
342  Win32Window* win = it->second;
343  if ( win->continuousUpdate() )
344  win->update();
345  else
346  Sleep(10);
347  }
348 }
349 //-----------------------------------------------------------------------------
350 void vlWin32::peekMessage(MSG& msg)
351 {
352  if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
353  {
354  if (msg.message != WM_QUIT)
355  {
356  TranslateMessage(&msg);
357  DispatchMessage(&msg);
358  }
359  }
360  else
361  dispatchUpdate();
362 }
363 //-----------------------------------------------------------------------------
365 {
366  while(!Win32Window::winMap().empty())
367  {
368  MSG msg = {0,0,0,0,0,0,0};
369  peekMessage(msg);
370  if (msg.message == WM_QUIT)
371  return (int)msg.wParam;
372  }
373  return 0; /* never reached */
374 }
375 //-----------------------------------------------------------------------------
376 void vlWin32::translateKeyEvent(WPARAM wParam, LPARAM lParam, unsigned short& unicode_out, vl::EKey& key_out)
377 {
378  // translate non unicode characters
379  key_out = Key_None;
380  unicode_out = 0;
381 
382  switch(wParam)
383  {
384  case VK_CLEAR: key_out = Key_Clear; break;
385  case VK_CONTROL: key_out = Key_Ctrl; break;
386  case VK_LCONTROL: key_out = Key_LeftCtrl; break;
387  case VK_RCONTROL: key_out = Key_RightCtrl; break;
388  case VK_MENU: key_out = Key_Alt; break;
389  case VK_LMENU: key_out = Key_LeftAlt; break;
390  case VK_RMENU: key_out = Key_RightAlt; break;
391  case VK_SHIFT: key_out = Key_Shift; break;
392  case VK_LSHIFT: key_out = Key_LeftShift; break;
393  case VK_RSHIFT: key_out = Key_RightShift; break;
394  case VK_INSERT: key_out = Key_Insert; break;
395  case VK_DELETE: key_out = Key_Delete; break;
396  case VK_HOME: key_out = Key_Home; break;
397  case VK_END: key_out = Key_End; break;
398  case VK_PRINT: key_out = Key_Print; break;
399  case VK_PAUSE: key_out = Key_Pause; break;
400  case VK_PRIOR: key_out = Key_PageUp; break;
401  case VK_NEXT: key_out = Key_PageDown; break;
402  case VK_LEFT: key_out = Key_Left; break;
403  case VK_RIGHT: key_out = Key_Right; break;
404  case VK_UP: key_out = Key_Up; break;
405  case VK_DOWN: key_out = Key_Down; break;
406  case VK_F1: key_out = Key_F1; break;
407  case VK_F2: key_out = Key_F2; break;
408  case VK_F3: key_out = Key_F3; break;
409  case VK_F4: key_out = Key_F4; break;
410  case VK_F5: key_out = Key_F5; break;
411  case VK_F6: key_out = Key_F6; break;
412  case VK_F7: key_out = Key_F7; break;
413  case VK_F8: key_out = Key_F8; break;
414  case VK_F9: key_out = Key_F9; break;
415  case VK_F10: key_out = Key_F10; break;
416  case VK_F11: key_out = Key_F11; break;
417  case VK_F12: key_out = Key_F12; break;
418 
419  /*
420  * VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
421  * 0x40 : is unassigned
422  * VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
423  */
424 
425  case L'0': key_out = Key_0; break;
426  case L'1': key_out = Key_1; break;
427  case L'2': key_out = Key_2; break;
428  case L'3': key_out = Key_3; break;
429  case L'4': key_out = Key_4; break;
430  case L'5': key_out = Key_5; break;
431  case L'6': key_out = Key_6; break;
432  case L'7': key_out = Key_7; break;
433  case L'8': key_out = Key_8; break;
434  case L'9': key_out = Key_9; break;
435 
436  case L'A': key_out = Key_A; break;
437  case L'B': key_out = Key_B; break;
438  case L'C': key_out = Key_C; break;
439  case L'D': key_out = Key_D; break;
440  case L'E': key_out = Key_E; break;
441  case L'F': key_out = Key_F; break;
442  case L'G': key_out = Key_G; break;
443  case L'H': key_out = Key_H; break;
444  case L'I': key_out = Key_I; break;
445  case L'J': key_out = Key_J; break;
446  case L'K': key_out = Key_K; break;
447  case L'L': key_out = Key_L; break;
448  case L'M': key_out = Key_M; break;
449  case L'N': key_out = Key_N; break;
450  case L'O': key_out = Key_O; break;
451  case L'P': key_out = Key_P; break;
452  case L'Q': key_out = Key_Q; break;
453  case L'R': key_out = Key_R; break;
454  case L'S': key_out = Key_S; break;
455  case L'T': key_out = Key_T; break;
456  case L'U': key_out = Key_U; break;
457  case L'V': key_out = Key_V; break;
458  case L'W': key_out = Key_W; break;
459  case L'X': key_out = Key_X; break;
460  case L'Y': key_out = Key_Y; break;
461  case L'Z': key_out = Key_Z; break;
462  }
463 
464  // fill unicode
465  BYTE mskeys[256];
466  memset( mskeys, 0, sizeof(BYTE)*256 );
467  WCHAR unicode[4] = { 0, 0 };
468  if ( ToUnicode( (UINT)wParam, (UINT)((lParam >> 16) & 0xFF), mskeys, unicode, 4, 0 ) == 1 )
469  {
470  unicode_out = unicode[0];
471 
472  // fill key
473  switch(unicode_out)
474  {
475  case L'0': key_out = Key_0; break;
476  case L'1': key_out = Key_1; break;
477  case L'2': key_out = Key_2; break;
478  case L'3': key_out = Key_3; break;
479  case L'4': key_out = Key_4; break;
480  case L'5': key_out = Key_5; break;
481  case L'6': key_out = Key_6; break;
482  case L'7': key_out = Key_7; break;
483  case L'8': key_out = Key_8; break;
484  case L'9': key_out = Key_9; break;
485 
486  case L'A': key_out = Key_A; break;
487  case L'B': key_out = Key_B; break;
488  case L'C': key_out = Key_C; break;
489  case L'D': key_out = Key_D; break;
490  case L'E': key_out = Key_E; break;
491  case L'F': key_out = Key_F; break;
492  case L'G': key_out = Key_G; break;
493  case L'H': key_out = Key_H; break;
494  case L'I': key_out = Key_I; break;
495  case L'J': key_out = Key_J; break;
496  case L'K': key_out = Key_K; break;
497  case L'L': key_out = Key_L; break;
498  case L'M': key_out = Key_M; break;
499  case L'N': key_out = Key_N; break;
500  case L'O': key_out = Key_O; break;
501  case L'P': key_out = Key_P; break;
502  case L'Q': key_out = Key_Q; break;
503  case L'R': key_out = Key_R; break;
504  case L'S': key_out = Key_S; break;
505  case L'T': key_out = Key_T; break;
506  case L'U': key_out = Key_U; break;
507  case L'V': key_out = Key_V; break;
508  case L'W': key_out = Key_W; break;
509  case L'X': key_out = Key_X; break;
510  case L'Y': key_out = Key_Y; break;
511  case L'Z': key_out = Key_Z; break;
512 
513  case L'a': key_out = Key_A; break;
514  case L'b': key_out = Key_B; break;
515  case L'c': key_out = Key_C; break;
516  case L'd': key_out = Key_D; break;
517  case L'e': key_out = Key_E; break;
518  case L'f': key_out = Key_F; break;
519  case L'g': key_out = Key_G; break;
520  case L'h': key_out = Key_H; break;
521  case L'i': key_out = Key_I; break;
522  case L'j': key_out = Key_J; break;
523  case L'k': key_out = Key_K; break;
524  case L'l': key_out = Key_L; break;
525  case L'm': key_out = Key_M; break;
526  case L'n': key_out = Key_N; break;
527  case L'o': key_out = Key_O; break;
528  case L'p': key_out = Key_P; break;
529  case L'q': key_out = Key_Q; break;
530  case L'r': key_out = Key_R; break;
531  case L's': key_out = Key_S; break;
532  case L't': key_out = Key_T; break;
533  case L'u': key_out = Key_U; break;
534  case L'v': key_out = Key_V; break;
535  case L'w': key_out = Key_W; break;
536  case L'x': key_out = Key_X; break;
537  case L'y': key_out = Key_Y; break;
538  case L'z': key_out = Key_Z; break;
539 
540  case 13: key_out = Key_Return; break;
541  case 8: key_out = Key_BackSpace; break;
542  case 9: key_out = Key_Tab; break;
543  case L' ': key_out = Key_Space; break;
544 
545  case 27: key_out = Key_Escape; break;
546  case L'!': key_out = Key_Exclam; break;
547  case L'"': key_out = Key_QuoteDbl; break;
548  case L'#': key_out = Key_Hash; break;
549  case L'$': key_out = Key_Dollar; break;
550  case L'&': key_out = Key_Ampersand; break;
551  case L'\'': key_out = Key_Quote; break;
552  case L'(': key_out = Key_LeftParen; break;
553  case L')': key_out = Key_RightParen; break;
554  case L'*': key_out = Key_Asterisk; break;
555  case L'+': key_out = Key_Plus; break;
556  case L',': key_out = Key_Comma; break;
557  case L'-': key_out = Key_Minus; break;
558  case L'.': key_out = Key_Period; break;
559  case L'\\': key_out = Key_Slash; break;
560  case L':': key_out = Key_Colon; break;
561  case L';': key_out = Key_Semicolon; break;
562  case L'<': key_out = Key_Less; break;
563  case L'=': key_out = Key_Equal; break;
564  case L'>': key_out = Key_Greater; break;
565  case L'?': key_out = Key_Question; break;
566  case L'@': key_out = Key_At; break;
567  case L'[': key_out = Key_LeftBracket; break;
568  case L'/': key_out = Key_BackSlash; break;
569  case L']': key_out = Key_RightBracket; break;
570  case L'|': key_out = Key_Caret; break;
571  case L'_': key_out = Key_Underscore; break;
572  case L'`': key_out = Key_QuoteLeft; break;
573  }
574  }
575 }
576 //-----------------------------------------------------------------------------
VLWIN32_EXPORT void peekMessage(MSG &msg)
void dispatchKeyReleaseEvent(unsigned short unicode_ch, EKey key)
Dispatches the UIEventListener::keyReleaseEvent() notification to the subscribed UIEventListener obje...
The Win32Window class is a Win32Context that can be used as a top or child window.
Definition: Win32Window.hpp:51
void setWidth(int width)
The width of a render target.
Definition: Framebuffer.hpp:78
void dispatchMouseDownEvent(EMouseButton button, int x, int y)
Dispatches the UIEventListener::mouseDownEvent() notification to the subscribed UIEventListener objec...
void update()
If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent()...
Framebuffer * framebuffer()
The default render target (always returns leftFramebuffer()).
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
Definition: String.hpp:62
void destroyWin32GLWindow()
Destroys the window and the OpenGL rendering context.
void dispatchKeyPressEvent(unsigned short unicode_ch, EKey key)
Dispatches the UIEventListener::keyPressEvent() notification to the subscribed UIEventListener object...
void dispatchResizeEvent(int w, int h)
Dispatches the UIEventListener::resizeEvent() notification to the subscribed UIEventListener objects...
Visualization Library main namespace.
VLEGL_EXPORT void peekMessage(MSG &msg)
Definition: EGLWindow.cpp:558
bool continuousUpdate() const
If the OpenGL context is a widget this function returns whether its area is continuously updated at e...
void dispatchUpdateEvent()
Dispatches the UIEventListener::updateEvent() notification to the subscribed UIEventListener objects...
The OpenGLContextFormat class encapsulates the settings of an OpenGL rendering context.
VLWIN32_EXPORT int messageLoop()
VLWIN32_EXPORT void dispatchUpdate()
EMouseButton
void dispatchMouseWheelEvent(int n)
Dispatches the UIEventListener::mouseWheelEvent() notification to the subscribed UIEventListener obje...
#define NULL
Definition: OpenGLDefs.hpp:81
VLEGL_EXPORT void translateKeyEvent(WPARAM wParam, LPARAM lParam, unsigned short &unicode_out, vl::EKey &key_out)
Definition: EGLWindow.cpp:584
bool registerClass()
Definition: Win32Window.cpp:44
void dispatchDestroyEvent()
Dispatches the UIEventListener::destroyEvent() notification to the subscribed UIEventListener(s), calls destroyAllOpenGLResources() and eraseAllEventListeners() This event must be issued just before the actual GL context is destroyed.
void dispatchFileDroppedEvent(const std::vector< String > &files)
Dispatches the UIEventListener::fileDroppedEvent() notification to the subscribed UIEventListener obj...
VLWIN32_EXPORT void translateKeyEvent(WPARAM wParam, LPARAM lParam, unsigned short &unicode_out, vl::EKey &key_out)
void dispatchMouseMoveEvent(int x, int y)
Dispatches the UIEventListener::mouseMoveEvent() notification to the subscribed UIEventListener objec...
void setHeight(int height)
The height of a render target.
Definition: Framebuffer.hpp:81
The Win32 bindings namespace.
const wchar_t * gWin32WindowClassName
Definition: Win32Window.cpp:42
void dispatchMouseUpEvent(EMouseButton button, int x, int y)
Dispatches the UIEventListener::mouseUpEvent() notification to the subscribed UIEventListener objects...
VLEGL_EXPORT void dispatchUpdate()
Definition: EGLWindow.cpp:542