ViSP  2.8.0
vpWin32Window.h
1 /****************************************************************************
2  *
3  * $Id: vpWin32Window.h 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Windows 32 display's window class
36  *
37  * Authors:
38  * Bruno Renier
39  * Anthony Saunier
40  *
41  *****************************************************************************/
42 
43 #include <visp/vpConfig.h>
44 
45 #if ( defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9) )
46 #ifndef vpWin32Window_HH
47 #define vpWin32Window_HH
48 
49 
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51 
52 #include <windows.h>
53 #include <visp/vpWin32Renderer.h>
54 #include <visp/vpGDIRenderer.h>
55 #include <visp/vpDisplay.h>
56 #include <visp/vpDisplayException.h>
57 
58 
59 //ViSP-defined messages for window's callback function
60 #define vpWM_GETCLICK WM_USER+1
61 #define vpWM_DISPLAY WM_USER+2
62 #define vpWM_GETCLICKUP WM_USER+3
63 #define vpWM_CLOSEDISPLAY WM_USER+4
64 #define vpWM_GETPOINTERMOTIONEVENT WM_USER+5
65 #define vpWM_DISPLAY_ROI WM_USER+6
66 
67 //No specific mouse button query
68 #define vpNO_BUTTON_QUERY -1
69 
70 class vpDisplayWin32;
71 
72 class VISP_EXPORT vpWin32Window
73 {
74 private :
75 
76  HINSTANCE hInst;
77 
79  HWND hWnd;
80 
82  bool initialized;
84  HANDLE semaInit;
85 
87  HANDLE semaClick;
89  HANDLE semaClickUp;
91  HANDLE semaKey;
93  HANDLE semaMove;
94 
96  int clickX;
97  int clickXUp;
99  int clickY;
100  int clickYUp;
102  int coordX;
104  int coordY;
105  // Keyboard key
106  char lpString[10];
109  vpMouseButton::vpMouseButtonType clickButtonUp;
110 
112  static bool registered;
113 
115  vpWin32Renderer * renderer;
116 
117 
118  public:
119 
120  vpWin32Window(vpWin32Renderer * rend = NULL);
121  virtual ~vpWin32Window();
122 
124  unsigned int getImageWidth(){ return renderer->getImageWidth(); }
126  unsigned int getImageHeight(){ return renderer->getImageHeight(); }
128  HWND getHWnd(){ return hWnd;}
129 
131  bool isInitialized(){ return initialized; }
132 
134  void initWindow(const char* title, int posx, int posy, unsigned int w, unsigned int h);
135 
136  // Friend classes
137  friend class vpDisplayWin32;
138  friend class vpDisplayD3D;
139  friend class vpDisplayGDI;
140 
142  friend LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
143  WPARAM wParam, LPARAM lParam);
144 };
145 
146 #endif
147 #endif
148 #endif
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:133
Display for windows using Direct3D.
Definition: vpDisplayD3D.h:109
Base abstract class for Windows 32 displays. Implements the window creation in a separate thread and ...