1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 // TODO: Remove header when the latest changes to the Windows SDK have been integrated into MingW
24 //       For reference, the interface definitions here are imported the SDK headers and from the
25 //       EcWin7 project (https://code.google.com/p/dukto/)
26 
27 #ifndef BACKEND_WIN32_TASKBAR_MINGW_H
28 #define BACKEND_WIN32_TASKBAR_MINGW_H
29 
30 #if defined(WIN32)
31 #if defined(__GNUC__)
32 #ifdef __MINGW32__
33 
34 #ifdef _WIN32_WINNT
35 	#undef _WIN32_WINNT
36 #endif
37 #define _WIN32_WINNT 0x0501
38 #include <windows.h>
39 #include <commctrl.h>
40 #include <initguid.h>
41 #include <shlwapi.h>
42 #include <shlguid.h>
43 #define CMIC_MASK_ASYNCOK SEE_MASK_ASYNCOK
44 
45 extern const GUID CLSID_ShellLink;
46 
47 // Shard enumeration value
48 #define SHARD_LINK 0x00000006
49 
50 // Taskbar GUID definitions
51 DEFINE_GUID(CLSID_TaskbarList,0x56fdf344,0xfd6d,0x11d0,0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90);
52 DEFINE_GUID(IID_ITaskbarList3,0xea1afb91,0x9e28,0x4b86,0x90,0xE9,0x9e,0x9f,0x8a,0x5e,0xef,0xaf);
53 DEFINE_GUID(IID_IPropertyStore,0x886d8eeb,0x8cf2,0x4446,0x8d,0x02,0xcd,0xba,0x1d,0xbd,0xcf,0x99);
54 
55 // Property key
56 typedef struct _tagpropertykey {
57 	GUID fmtid;
58 	DWORD pid;
59 } PROPERTYKEY;
60 
61 #define REFPROPERTYKEY const PROPERTYKEY &
62 
63 typedef struct tagPROPVARIANT PROPVARIANT;
64 #define REFPROPVARIANT const PROPVARIANT &
65 
66 // Property store
DECLARE_INTERFACE_(IPropertyStore,IUnknown)67 DECLARE_INTERFACE_(IPropertyStore, IUnknown) {
68 	STDMETHOD (GetCount) (DWORD *cProps) PURE;
69 	STDMETHOD (GetAt) (DWORD iProp, PROPERTYKEY *pkey) PURE;
70 	STDMETHOD (GetValue) (REFPROPERTYKEY key, PROPVARIANT *pv) PURE;
71 	STDMETHOD (SetValue) (REFPROPERTYKEY key, REFPROPVARIANT propvar) PURE;
72 	STDMETHOD (Commit) (void) PURE;
73 
74 private:
75 	~IPropertyStore();
76 };
77 typedef IPropertyStore *LPIPropertyStore;
78 
79 // Mingw-specific defines for taskbar integration
80 typedef enum THUMBBUTTONMASK {
81 	THB_BITMAP = 0x1,
82 	THB_ICON = 0x2,
83 	THB_TOOLTIP = 0x4,
84 	THB_FLAGS = 0x8
85 } THUMBBUTTONMASK;
86 
87 typedef enum THUMBBUTTONFLAGS {
88 	THBF_ENABLED = 0,
89 	THBF_DISABLED = 0x1,
90 	THBF_DISMISSONCLICK = 0x2,
91 	THBF_NOBACKGROUND = 0x4,
92 	THBF_HIDDEN = 0x8,
93 	THBF_NONINTERACTIVE = 0x10
94 } THUMBBUTTONFLAGS;
95 
96 typedef struct THUMBBUTTON {
97 	THUMBBUTTONMASK dwMask;
98 	UINT iId;
99 	UINT iBitmap;
100 	HICON hIcon;
101 	WCHAR szTip[260];
102 	THUMBBUTTONFLAGS dwFlags;
103 } THUMBBUTTON;
104 typedef struct THUMBBUTTON *LPTHUMBBUTTON;
105 
106 typedef enum TBPFLAG {
107 	TBPF_NOPROGRESS = 0,
108 	TBPF_INDETERMINATE = 0x1,
109 	TBPF_NORMAL = 0x2,
110 	TBPF_ERROR = 0x4,
111 	TBPF_PAUSED = 0x8
112 } TBPFLAG;
113 
114 // Taskbar interface
DECLARE_INTERFACE_(ITaskbarList3,IUnknown)115 DECLARE_INTERFACE_(ITaskbarList3, IUnknown) {
116 	// IUnknown
117 	STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
118 	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
119 	STDMETHOD_(ULONG,Release) (THIS) PURE;
120 	// ITaskbarList
121 	STDMETHOD(HrInit) (THIS) PURE;
122 	STDMETHOD(AddTab) (THIS_ HWND hwnd) PURE;
123 	STDMETHOD(DeleteTab) (THIS_ HWND hwnd) PURE;
124 	STDMETHOD(ActivateTab) (THIS_ HWND hwnd) PURE;
125 	STDMETHOD(SetActiveAlt) (THIS_ HWND hwnd) PURE;
126 	STDMETHOD (MarkFullscreenWindow) (THIS_ HWND hwnd, int fFullscreen) PURE;
127 	// ITaskbarList3
128 	STDMETHOD (SetProgressValue) (THIS_ HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) PURE;
129 	STDMETHOD (SetProgressState) (THIS_ HWND hwnd, TBPFLAG tbpFlags) PURE;
130 	STDMETHOD (RegisterTab) (THIS_ HWND hwndTab, HWND hwndMDI) PURE;
131 	STDMETHOD (UnregisterTab) (THIS_ HWND hwndTab) PURE;
132 	STDMETHOD (SetTabOrder) (THIS_ HWND hwndTab, HWND hwndInsertBefore) PURE;
133 	STDMETHOD (SetTabActive) (THIS_ HWND hwndTab, HWND hwndMDI, DWORD dwReserved) PURE;
134 	STDMETHOD (ThumbBarAddButtons) (THIS_ HWND hwnd, UINT cButtons, LPTHUMBBUTTON pButton) PURE;
135 	STDMETHOD (ThumbBarUpdateButtons) (THIS_ HWND hwnd, UINT cButtons, LPTHUMBBUTTON pButton) PURE;
136 	STDMETHOD (ThumbBarSetImageList) (THIS_ HWND hwnd, HIMAGELIST himl) PURE;
137 	STDMETHOD (SetOverlayIcon) (THIS_ HWND hwnd, HICON hIcon, LPCWSTR pszDescription) PURE;
138 	STDMETHOD (SetThumbnailTooltip) (THIS_ HWND hwnd, LPCWSTR pszTip) PURE;
139 	STDMETHOD (SetThumbnailClip) (THIS_ HWND hwnd, RECT *prcClip) PURE;
140 
141 private:
142 	~ITaskbarList3();
143 };
144 
145 typedef ITaskbarList3 *LPITaskbarList3;
146 
147 #endif // __MINGW32__
148 #endif // __GNUC__
149 #endif // WIN32
150 
151 #endif // BACKEND_WIN32_TASKBAR_MINGW_H
152