2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #ifndef WINDOW_SYSTEM_WIN32_H
22 #define WINDOW_SYSTEM_WIN32_H
24 #include "windowing/WinSystem.h"
26 struct MONITOR_DETAILS
28 // Windows desktop info
36 char MonitorName[128];
39 int ScreenNumber; // XBMC POV, not Windows. Windows primary is XBMC #0, then each secondary is +1.
44 #define WM_GESTURE 0x0119
45 #define WM_GESTURENOTIFY 0x011A
47 // Gesture Information Flags
48 #define GF_BEGIN 0x00000001
49 #define GF_INERTIA 0x00000002
50 #define GF_END 0x00000004
58 #define GID_TWOFINGERTAP 6
59 #define GID_PRESSANDTAP 7
60 #define GID_ROLLOVER GID_PRESSANDTAP
62 #define GC_ALLGESTURES 0x00000001
64 // Zoom Gesture Confiration Flags
65 #define GC_ZOOM 0x00000001
67 // Pan Gesture Configuration Flags
68 #define GC_PAN 0x00000001
69 #define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002
70 #define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004
71 #define GC_PAN_WITH_GUTTER 0x00000008
72 #define GC_PAN_WITH_INERTIA 0x00000010
74 // Rotate Gesture Configuration Flags
75 #define GC_ROTATE 0x00000001
77 // Two finger tap configuration flags
78 #define GC_TWOFINGERTAP 0x00000001
80 // Press and tap Configuration Flags
81 #define GC_PRESSANDTAP 0x00000001
82 #define GC_ROLLOVER GC_PRESSANDTAP
84 typedef struct _GESTUREINFO {
92 ULONGLONG ullArguments;
94 }GESTUREINFO, *PGESTUREINFO;
96 // GESTURECONFIG struct defintion
97 typedef struct tagGESTURECONFIG {
98 DWORD dwID; // gesture ID
99 DWORD dwWant; // settings related to gesture ID that are to be turned on
100 DWORD dwBlock; // settings related to gesture ID that are to be turned off
101 } GESTURECONFIG, *PGESTURECONFIG;
104 * Gesture notification structure
105 * - The WM_GESTURENOTIFY message lParam contains a pointer to this structure.
106 * - The WM_GESTURENOTIFY message notifies a window that gesture recognition is
107 * in progress and a gesture will be generated if one is recognized under the
108 * current gesture settings.
110 typedef struct tagGESTURENOTIFYSTRUCT {
111 UINT cbSize; // size, in bytes, of this structure
112 DWORD dwFlags; // unused
113 HWND hwndTarget; // handle to window targeted by the gesture
114 POINTS ptsLocation; // starting location
115 DWORD dwInstanceID; // internally used
116 } GESTURENOTIFYSTRUCT, *PGESTURENOTIFYSTRUCT;
118 DECLARE_HANDLE(HGESTUREINFO);
122 class CWinSystemWin32 : public CWinSystemBase
126 virtual ~CWinSystemWin32();
129 virtual bool InitWindowSystem();
130 virtual bool DestroyWindowSystem();
131 virtual bool CreateNewWindow(const CStdString& name, bool fullScreen, RESOLUTION_INFO& res, PHANDLE_EVENT_FUNC userFunction);
132 virtual bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop);
133 virtual bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays);
134 virtual void UpdateResolutions();
135 virtual bool CenterWindow();
136 virtual void NotifyAppFocusChange(bool bGaining);
137 virtual int GetNumScreens() { return m_MonitorsInfo.size(); };
138 virtual int GetCurrentScreen();
139 virtual void ShowOSMouse(bool show);
140 virtual bool WindowedMode() { return true; }
141 virtual bool HasInertialGestures(){ return true; }//if win32 has touchscreen - it uses the win32 gesture api for inertial scrolling
143 virtual bool Minimize();
144 virtual bool Restore();
146 virtual bool Show(bool raise = true);
149 HWND GetHwnd() { return m_hWnd; }
150 bool IsAlteringWindow() { return m_IsAlteringWindow; }
152 // touchscreen support
153 typedef BOOL (WINAPI *pGetGestureInfo)(HGESTUREINFO, PGESTUREINFO);
154 typedef BOOL (WINAPI *pSetGestureConfig)(HWND, DWORD, UINT, PGESTURECONFIG, UINT);
155 typedef BOOL (WINAPI *pCloseGestureInfoHandle)(HGESTUREINFO);
156 pGetGestureInfo PtrGetGestureInfo;
157 pSetGestureConfig PtrSetGestureConfig;
158 pCloseGestureInfoHandle PtrCloseGestureInfoHandle;
161 bool ChangeResolution(RESOLUTION_INFO res);
162 virtual bool ResizeInternal(bool forceRefresh = false);
163 virtual bool UpdateResolutionsInternal();
164 virtual bool CreateBlankWindows();
165 virtual bool BlankNonActiveMonitors(bool bBlank);
166 const MONITOR_DETAILS &GetMonitor(int screen) const;
167 void RestoreDesktopResolution(int screen);
168 RECT ScreenRect(int screen);
170 \brief Adds a resolution to the list of resolutions if we don't already have it
171 \param res resolution to add.
173 void AddResolution(const RESOLUTION_INFO &res);
176 std::vector<HWND> m_hBlankWindows;
178 HINSTANCE m_hInstance;
180 std::vector<MONITOR_DETAILS> m_MonitorsInfo;
182 bool m_ValidWindowedPosition;
183 bool m_IsAlteringWindow;
188 #endif // WINDOW_SYSTEM_H