Visual Servoing Platform version 3.5.0
vpWin32Window.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5 *
6 * This software is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * See the file LICENSE.txt at the root directory of this source
11 * distribution for additional information about the GNU GPL.
12 *
13 * For using ViSP with software that can not be combined with the GNU
14 * GPL, please contact Inria about acquiring a ViSP Professional
15 * Edition License.
16 *
17 * See http://visp.inria.fr for more information.
18 *
19 * This software was developed at:
20 * Inria Rennes - Bretagne Atlantique
21 * Campus Universitaire de Beaulieu
22 * 35042 Rennes Cedex
23 * France
24 *
25 * If you have questions regarding the use of this file, please contact
26 * Inria at visp@inria.fr
27 *
28 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30 *
31 * Description:
32 * Windows 32 display's window class
33 *
34 * Authors:
35 * Bruno Renier
36 * Anthony Saunier
37 *
38 *****************************************************************************/
39
40#include <visp3/core/vpConfig.h>
41
42#if (defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9))
43#ifndef vpWin32Window_HH
44#define vpWin32Window_HH
45
46#ifndef DOXYGEN_SHOULD_SKIP_THIS
47
48// Include WinSock2.h before windows.h to ensure that winsock.h is not
49// included by windows.h since winsock.h and winsock2.h are incompatible
50#include <WinSock2.h>
51#include <visp3/core/vpDisplay.h>
52#include <visp3/core/vpDisplayException.h>
53#include <visp3/gui/vpGDIRenderer.h>
54#include <visp3/gui/vpWin32Renderer.h>
55#include <windows.h>
56
57// ViSP-defined messages for window's callback function
58#define vpWM_GETCLICK WM_USER + 1
59#define vpWM_DISPLAY WM_USER + 2
60#define vpWM_GETCLICKUP WM_USER + 3
61#define vpWM_CLOSEDISPLAY WM_USER + 4
62#define vpWM_GETPOINTERMOTIONEVENT WM_USER + 5
63#define vpWM_DISPLAY_ROI WM_USER + 6
64
65// No specific mouse button query
66#define vpNO_BUTTON_QUERY -1
67
68class vpDisplayWin32;
69
70class VISP_EXPORT vpWin32Window
71{
72private:
73 HINSTANCE hInst;
74
76 HWND hWnd;
77
79 bool initialized;
81 HANDLE semaInit;
82
84 HANDLE semaClick;
86 HANDLE semaClickUp;
88 HANDLE semaKey;
90 HANDLE semaMove;
91
93 int clickX;
94 int clickXUp;
96 int clickY;
97 int clickYUp;
99 int coordX;
101 int coordY;
102 // Keyboard key
103 char lpString[10];
107
109 static bool registered;
110
112 vpWin32Renderer *renderer;
113
114public:
115 explicit 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, WPARAM wParam, LPARAM lParam);
135};
136
137#endif
138#endif
139#endif
Display for windows using Direct3D 3rd party. Thus to enable this class Direct3D should be installed....
Definition: vpDisplayD3D.h:107
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:129
Base abstract class for Windows 32 displays. Implements the window creation in a separate thread and ...