-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.h
More file actions
394 lines (321 loc) · 12.1 KB
/
Copy pathplugin.h
File metadata and controls
394 lines (321 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
/*
* This header is based on ceopener/include/ceopener_plugin.h
* and modified so we can use with cegcc
*/
#ifndef PLUGIN_H
#define PLUGIN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#ifndef _T
#ifdef UNICODE
#define _T(x) (L##x)
#else
#define _T(x) (x)
#endif
#endif
#define PLUGIN_TRAY_ITEM_TEXT 0
#define PLUGIN_TRAY_ITEM_ICON 1
#define PLUGIN_TRAY_ITEM_BITMAP 2
#define PLUGIN_DESKTOP_ITEM_NO_MOVE 1
#define PLUGIN_DESKTOP_ITEM_NO_RESIZE 2
#define PLUGIN_SUB_TOUCH_PRIORITY_LOWEST -1
#define PLUGIN_SUB_TOUCH_PRIORITY_NORMAL 0
#define PLUGIN_CALLBACK_TASK_SWITCHED 0
#define PLUGIN_CALLBACK_FOLDED 1
#define PLUGIN_CALLBACK_ED_CLOSED_OPENED 2
#define PLUGIN_CALLBACK_POWER_ON_OFF 3
#define PLUGIN_CALLBACK_SETTING_CHANGED 4
#define PLUGIN_ED_BEFORE_CLOSED 0
#define PLUGIN_ED_AFTER_CLOSED 1
#define PLUGIN_ED_BEFORE_OPENED 2
#define PLUGIN_ED_AFTER_OPENED 3
#define PLUGIN_POWER_OFF 1
#define PLUGIN_POWER_ON 2
struct PluginInfo {
};
typedef void (*PluginMenuShowCallback)(HWND hCont, HWND hMenu);
typedef void (*PluginMenuItemSelectedCallback)(HWND hCont, HWND hMenu, int id);
typedef void (*PluginTrayIconItemClickedCallback)(HWND hCont, int id);
typedef void (*PluginDesktopItemFocusCallback)(HWND hCont, int id);
typedef void (*PluginDesktopItemBlurCallback)(HWND hCont, int id);
typedef void (*PluginDesktopItemTapDownCallback)(HWND hCont, int id,
int x, int y, RECT *place);
typedef void (*PluginDesktopItemTapUpCallback)(HWND hCont, int id,
int x, int y, RECT *place);
typedef void (*PluginDesktopItemTapMoveCallback)(HWND hCont, int id,
int x, int y, RECT *place);
typedef void (*PluginDesktopItemTapDoubleCallback)(HWND hCont, int id,
int x, int y, RECT *place);
typedef void (*PluginDesktopItemTapHoldCallback)(HWND hCont, int id,
int x, int y, RECT *place);
typedef void (*PluginDesktopItemKeyDownCallback)(HWND hCont, int id, int keyCode);
typedef void (*PluginDesktopItemKeyUpCallback)(HWND hCont, int id, int keyCode);
typedef void (*PluginDesktopItemPaintCallback)(HWND hCont, int id, HDC hDC,
RECT *place, int focused);
typedef int (*PluginKeyBindingCallback)(HWND hCont, int id);
typedef int (*PluginHotKeyCallback)(HWND hCont, int id);
typedef void (*PluginSubTouchCallback)(HWND hCont, int id);
typedef void (*PluginSubTouchDicKeyDownCallback)(HWND hCont, int id, int dicKey);
typedef void (*PluginTimerCallback)(HWND hCont, int id);
typedef void (*PluginCallback)(HWND hCont, unsigned long params);
typedef struct _PluginFontInfo {
TCHAR faceName[LF_FACESIZE];
int pointSize;
int isBold;
int isItalic;
} PluginFontInfo;
typedef struct _PluginMenu {
PluginMenuShowCallback onShow;
} PluginMenu;
typedef struct _PluginMenuItem {
TCHAR caption[256];
PluginMenuItemSelectedCallback onItemSelected;
HWND hSubMenu;
} PluginMenuItem;
typedef struct _PluginTrayItem {
int type;
int width;
int height;
UINT uID;
} PluginTrayItem;
typedef struct _PluginTrayIconItem {
HICON hIcon;
PluginTrayIconItemClickedCallback onClicked;
UINT uID;
} PluginTrayIconItem;
typedef struct _PluginDesktopItem {
int isFocusable;
int left;
int top;
int width;
int height;
int zOrder;
PluginDesktopItemFocusCallback onFocus;
PluginDesktopItemBlurCallback onBlur;
PluginDesktopItemTapDownCallback onTapDown;
PluginDesktopItemTapUpCallback onTapUp;
PluginDesktopItemTapMoveCallback onTapMove;
PluginDesktopItemTapDoubleCallback onTapDouble;
PluginDesktopItemTapHoldCallback onTapHold;
PluginDesktopItemKeyDownCallback onKeyDown;
PluginDesktopItemKeyUpCallback onKeyUp;
PluginDesktopItemPaintCallback onPaint;
} PluginDesktopItem;
typedef struct _PluginSetDesktopItemPositionParams {
int flags;
int left;
int top;
int width;
int height;
} PluginSetDesktopItemPositionParams;
typedef struct _PluginSetMenuItemCaptionParams {
int id;
TCHAR caption[256];
} PluginSetMenuItemCaptionParams;
typedef struct _PluginKeyBinding {
TCHAR category[256];
TCHAR name[256];
int isEnabled;
int defaultFn;
int defaultKeyCode;
PluginKeyBindingCallback onKeyPress;
int isActive;
} PluginKeyBinding;
typedef struct _PluginSubTouch {
int priority;
bool isEnabled;
PluginSubTouchCallback onActive;
PluginSubTouchCallback onInactive;
PluginSubTouchDicKeyDownCallback onDicKeyDown;
} PluginSubTouch;
typedef struct _PluginCallbackTaskSwitchedParams {
HWND hWindowFrom;
HWND hWindowTo;
} PluginCallbackTaskSwitchedParams;
inline HWND pluginGetContainer() {
return FindWindow(_T("ceOpener"), NULL);
}
inline HWND pluginGetDesktopWindow() {
return FindWindow(_T("ceOpenerDesktop"), NULL);
}
inline void pluginGetFontInfo(HWND hCont, PluginFontInfo *info) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginGetFontInfo")), 0, (LPARAM)info);
}
inline COLORREF pluginGetColor(HWND hCont, const TCHAR *name) {
return SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginGetColor")), 0, (LPARAM)name);
}
inline int pluginAppendMenuItem(HWND hCont, HWND hMenu, PluginMenuItem *item) {
return SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginAppendMenuItem")), (WPARAM)hMenu, (LPARAM)item);
}
inline void pluginRemoveMenuItem(HWND hCont, HWND hMenu, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginRemoveMenuItem")), (WPARAM)hMenu, id);
}
inline HWND pluginCreateSubMenu(HWND hCont, PluginMenu *menu) {
return (HWND)SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginCreateSubMenu")), 0, (LPARAM)menu);
}
inline void pluginDestroySubMenu(HWND hCont, HWND hMenu) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginDestroySubMenu")), (WPARAM)hMenu, 0);
}
inline void pluginClearSubMenu(HWND hCont, HWND hMenu) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginClearSubMenu")), (WPARAM)hMenu, 0);
}
inline void pluginShowPopupMenu(HWND hCont, HWND hMenu, int x, int y) {
POINT pt = {x, y};
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginShowPopupMenu")), (WPARAM)hMenu, (LPARAM)&pt);
}
inline HWND pluginGetPluginMenu(HWND hCont) {
return (HWND)SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginGetPluginMenu")), 0, 0);
}
inline void pluginSetMenuItemCaption(HWND hCont, HWND hMenu, int id,
const TCHAR *caption) {
PluginSetMenuItemCaptionParams params;
params.id = id;
_tcsncpy(params.caption, caption, 256);
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginSetMenuItemCaption")), (WPARAM)hMenu, (LPARAM)¶ms);
}
inline HWND pluginRegisterTrayItem(HWND hCont, HMODULE hModule, PluginTrayItem *item) {
return (HWND)SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginRegisterTrayItem")), (WPARAM)hModule, (LPARAM)item);
}
inline int pluginRegisterTrayIconItem(HWND hCont, HMODULE hModule, PluginTrayIconItem *item) {
return SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginRegisterTrayIconItem")), (WPARAM)hModule, (LPARAM)item);
}
inline void pluginUnregisterTrayIconItem(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginUnregisterTrayIconItem")), id, 0);
}
inline HWND pluginGetTrayIconControl(HWND hCont, int id) {
return (HWND)SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginGetTrayIconControl")), id, 0);
}
inline void pluginSetTrayIcon(HWND hCont, int id, HICON hIcon) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginSetTrayIcon")), id, (LPARAM)hIcon);
}
inline HWND pluginGetDesktopMenu(HWND hCont) {
return (HWND)SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginGetDesktopMenu")), 0, 0);
}
inline void pluginDesktopToScreen(HWND hCont, POINT *pt) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginDesktopToScreen")), 0, (LPARAM)pt);
}
inline int pluginRegisterDesktopItem(HWND hCont, PluginDesktopItem *item) {
return SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginRegisterDesktopItem")), 0, (LPARAM)item);
}
inline void pluginUnregisterDesktopItem(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginUnregisterDesktopItem")), id, 0);
}
inline void pluginGetDesktopItemPlacement(HWND hCont, int id, RECT *place) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginGetDesktopItemPlacement")), id, (LPARAM)place);
}
inline void pluginSetDesktopItemPosition(HWND hCont, int id, int flags,
int left, int top, int width, int height) {
PluginSetDesktopItemPositionParams params;
params.flags = flags;
params.left = left;
params.top = top;
params.width = width;
params.height = height;
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginSetDesktopItemPosition")), id, (LPARAM)¶ms);
}
inline void pluginRedrawDesktopItem(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginRedrawDesktopItem")), id, 0);
}
inline void pluginFocusDesktopItem(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginFocusDesktopItem")), id, 0);
}
inline void pluginSetDesktopMouseCapture(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginSetDesktopMouseCapture")), id, 0);
}
inline void pluginReleaseDesktopMouseCapture(HWND hCont) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginReleaseDesktopMouseCapture")), 0, 0);
}
inline int pluginRegisterKeyBinding(HWND hCont, PluginKeyBinding *bind) {
return SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginRegisterKeyBinding")), 0, (LPARAM)bind);
}
inline void pluginUnregisterKeyBinding(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginUnregisterKeyBinding")), id, NULL);
}
inline void pluginActivateKeyBinding(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginActivateKeyBinding")), id, 1);
}
inline void pluginInactivateKeyBinding(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginActivateKeyBinding")), id, 0);
}
inline void pluginSuspendKeyBindings(HWND hCont) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginSuspendKeyBindings")), 0, 0);
}
inline void pluginResumeKeyBindings(HWND hCont) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginResumeKeyBindings")), 0, 0);
}
inline int pluginRegisterSubTouch(HWND hCont, PluginSubTouch *touch) {
return SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginRegisterSubTouch")), 0, (LPARAM)touch);
}
inline void pluginUnregisterSubTouch(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginUnregisterSubTouch")), id, 0);
}
inline void pluginEnableSubTouch(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginEnableSubTouch")), id, 1);
}
inline void pluginDisableSubTouch(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginEnableSubTouch")), id, 0);
}
inline int pluginHardKeyToDicKey(HWND hCont, int fn, int keyCode) {
return SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginHardKeyToDicKey")), MAKEWORD(keyCode, fn), 0);
}
inline int pluginRegisterTimer(HWND hCont, int interval,
PluginTimerCallback callback) {
return SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginRegisterTimer")), interval, (LPARAM)callback);
}
inline HWND pluginUnregisterTimer(HWND hCont, int id) {
SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginUnregisterTimer")), id, 0);
}
inline HWND pluginRegisterCallback(HWND hCont, int type,
PluginCallback callback) {
return (HWND)SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginRegisterCallback")), type, (LPARAM)callback);
}
inline HWND pluginUnregisterCallback(HWND hCont, int type,
PluginCallback callback) {
return (HWND)SendMessage(hCont, RegisterWindowMessage(
_T("OpenerPluginUnregisterCallback")), type, (LPARAM)callback);
}
#ifdef __cplusplus
}
#endif
#endif // PLUGIN_H