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