1 |
|
---|
2 | /*
|
---|
3 | *@@sourcefile xsystray.h:
|
---|
4 | * Extended system tray widget for XCenter/eCenter.
|
---|
5 | *
|
---|
6 | * Private declarations.
|
---|
7 | *
|
---|
8 | * Copyright (C) 2009 Dmitry A. Kuminov
|
---|
9 | *
|
---|
10 | * This file is part of the Extended system tray widget source package.
|
---|
11 | * Extended system tray widget is free software; you can redistribute it
|
---|
12 | * and/or modify it under the terms of the GNU General Public License as
|
---|
13 | * published by the Free Software Foundation, in version 2 as it comes in
|
---|
14 | * the "COPYING" file of the Extended system tray widget distribution. This
|
---|
15 | * program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
---|
17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
---|
18 | * more details.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef XSYSTRAY_HEADER_INCLUDED
|
---|
22 | #define XSYSTRAY_HEADER_INCLUDED
|
---|
23 |
|
---|
24 | #include "xsystray_api.h"
|
---|
25 |
|
---|
26 | #include <sys/builtin.h> // atomics
|
---|
27 |
|
---|
28 | #define XSYSTRAY_VERSION_MAJOR 0
|
---|
29 | #define XSYSTRAY_VERSION_MINOR 1
|
---|
30 | #define XSYSTRAY_VERSION_REVISION 0
|
---|
31 |
|
---|
32 | #define WNDCLASS_WIDGET_XSYSTRAY_SERVER "XWPCenterExtendedSysTrayServer"
|
---|
33 |
|
---|
34 | #define WNDCLASS_WIDGET_XSYSTRAY "XWPCenterExtendedSysTray"
|
---|
35 | #define INTCLASS_WIDGET_XSYSTRAY "ExtendedSysTray"
|
---|
36 | #define HUMANSTR_WIDGET_XSYSTRAY "Extended system tray"
|
---|
37 |
|
---|
38 | #define WM_XST_CREATED_ATOM "ExtendedSysTray.WM_XST_CREATED"
|
---|
39 | #define WM_XST_NOTIFY_ATOM "ExtendedSysTray.WM_XST_NOTIFY"
|
---|
40 |
|
---|
41 | #define WM_XST_CONTROL (WM_USER + 0)
|
---|
42 | // message sent to the system tray server to request an action
|
---|
43 |
|
---|
44 | // server action commands
|
---|
45 | typedef enum
|
---|
46 | {
|
---|
47 | SYSTRAYCMD_GETVERSION,
|
---|
48 | SYSTRAYCMD_ADDICON,
|
---|
49 | SYSTRAYCMD_REPLACEICON,
|
---|
50 | SYSTRAYCMD_REMOVEICON,
|
---|
51 | SYSTRAYCMD_SETTOOLTIP,
|
---|
52 | SYSTRAYCMD_SHOWBALLOON,
|
---|
53 | SYSTRAYCMD_HIDEBALLOON,
|
---|
54 | SYSTRAYCMD_QUERYRECT,
|
---|
55 | } SYSTRAYCMD;
|
---|
56 |
|
---|
57 | // server responses to WM_XST_CONTROL
|
---|
58 | #define XST_OK 0 // command succeeded
|
---|
59 | #define XST_FAIL 1 // command failed
|
---|
60 | #define XST_REPLACED 2 // SYSTRAYCMD_ADDICON replaced the existing icon
|
---|
61 |
|
---|
62 | /*
|
---|
63 | *@@ SYSTRAYCTLDATA:
|
---|
64 | * Structure holding information accompanying WM_XST_CONTROL messages sent
|
---|
65 | * to the system tray server by clients (windows associated with system
|
---|
66 | * tray icons).
|
---|
67 | *
|
---|
68 | * NOTE: When you change the size of this structure, you may also need to
|
---|
69 | * change CLIENT_MEMORYPOOL_SIZE value (see the comments there for
|
---|
70 | * details).
|
---|
71 | */
|
---|
72 |
|
---|
73 | typedef struct
|
---|
74 | {
|
---|
75 | SYSTRAYCMD ulCommand;
|
---|
76 | // command to execute, must always be set
|
---|
77 | HWND hwndSender;
|
---|
78 | // sender window, a must for SYSTRAYCMD_ADDICON, _CHANGEICON,
|
---|
79 | // _REMOVEICON, _SETTOOLTIP, _SHOWBALLOON, _HIDEBALLOON,
|
---|
80 | // _QUERYRECT
|
---|
81 | union
|
---|
82 | {
|
---|
83 | struct
|
---|
84 | {
|
---|
85 | ULONG ulMajor;
|
---|
86 | ULONG ulMinor;
|
---|
87 | ULONG ulRevision;
|
---|
88 | } version;
|
---|
89 | // used by SYSTRAYCMD_GETVERSION
|
---|
90 |
|
---|
91 | struct
|
---|
92 | {
|
---|
93 | USHORT usId;
|
---|
94 | HPOINTER hIcon;
|
---|
95 | CHAR szToolTip[512];
|
---|
96 | ULONG ulMsgId;
|
---|
97 | } icon;
|
---|
98 | // used by SYSTRAYCMD_ADDICON, _CHANGEICON, _REMOVEICON, _SETTOOLTIP
|
---|
99 |
|
---|
100 | struct
|
---|
101 | {
|
---|
102 | RECTL rclIcon;
|
---|
103 | } rect;
|
---|
104 | // used by SYSTRAYCMD_QUERYRECT
|
---|
105 | } u;
|
---|
106 |
|
---|
107 | BOOL bAcknowledged : 1;
|
---|
108 | // set to true by the recipient if it processes the message
|
---|
109 |
|
---|
110 | } SYSTRAYCTLDATA, *PSYSTRAYCTLDATA;
|
---|
111 |
|
---|
112 | /*
|
---|
113 | *@@ NOTIFYDATA:
|
---|
114 | * Structure holding information acompanying notification messages
|
---|
115 | * posted to clients (windows associated with system tray icons) about
|
---|
116 | * icon events. This structure unions all public notification code
|
---|
117 | * dependent structures defined in xsystray_api.h (starting with XST*).
|
---|
118 | *
|
---|
119 | * All messages posted to the client have an ID corresponding to the
|
---|
120 | * WM_XST_NOTIFY_ATOM in the system atom table. The client-side API
|
---|
121 | * implementation intercepts these messages (using HK_INPUT), composes a
|
---|
122 | * new message given the information in NOTIFYDATA, frees the NOTIFYDATA
|
---|
123 | * pointer using FreeNotifyDataPtr() and then sends the composed message to
|
---|
124 | * the appropriate window.
|
---|
125 | *
|
---|
126 | * The layout of the XST_NOTIFY message is as follows:
|
---|
127 | *
|
---|
128 | * param1
|
---|
129 | * PNOTIFYDATA pNotifyData pointer to the NOTIFYDATA structure
|
---|
130 | *
|
---|
131 | * param2
|
---|
132 | * PVOID pvMemoryPool server memory pool (for the
|
---|
133 | * FreeNotifyDataPtr() call)
|
---|
134 | *
|
---|
135 | * NOTE: Structures in the union should only contain values; passing
|
---|
136 | * pointers to arbitrary data to the client side is not supported (yet).
|
---|
137 | *
|
---|
138 | * NOTE: When you change the size of this structure, you may also need to
|
---|
139 | * change SERVER_MEMORYPOOL_SIZE value in xsystray.c (see the comments
|
---|
|
---|