source: trunk/src/3rdparty/os2/xsystray/apilib/xsystray.h@ 983

Last change on this file since 983 was 840, checked in by Dmitry A. Kuminov, 14 years ago

xsystray: Finished r837.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Date Revision Author Id
File size: 9.7 KB
Line 
1
2/*
3 *@@sourcefile xsystray.h:
4 * Extended system tray widget for XCenter/eCenter.
5 *
6 * Public API.
7 *
8 * This file contains the public API to the Extended system tray widget.
9 * This API is used by applications to add and remove icons from the
10 * special notification area on the desktop provided by the Extended
11 * system tray widget.
12 *
13 * Refer to the "API" file for more details about the public API.
14 *
15 * Copyright (C) 2009-2011 Dmitriy Kuminov
16 *
17 * This file is part of the Extended system tray widget source package.
18 * Extended system tray widget is free software; you can redistribute it
19 * and/or modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation, in version 2 as it comes in
21 * the "COPYING" file of the Extended system tray widget distribution. This
22 * program is distributed in the hope that it will be useful, but WITHOUT
23 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
25 * more details.
26 */
27
28#ifndef XSYSTRAY_API_HEADER_INCLUDED
29#define XSYSTRAY_API_HEADER_INCLUDED
30
31#if __cplusplus
32extern "C" {
33#endif
34
35// Use #define XSTAPI_FPTRS before including this header to declare funciton
36// pointers instead of functions (useful for dynamic linking to the DLL).
37// Use #define XSTAPI_FPTRS_STATIC to declare static pointers. Note that all
38// pointers must be initialized with a valid function address before calling!
39
40#ifdef XSTAPI_IMPL
41# define XSTAPI(rt,fn) rt __declspec(dllexport) EXPENTRY fn
42#else
43# if defined(XSTAPI_FPTRS)
44# define XSTAPI(rt,fn) rt (* EXPENTRY fn)
45# elif defined(XSTAPI_FPTRS_STATIC)
46# define XSTAPI(rt,fn) static rt (* EXPENTRY fn)
47# else
48# define XSTAPI(rt,fn) rt EXPENTRY fn
49# endif
50#endif
51
52// notification code constants for the notification messages sent by the system
53// tray (refer to xstAddSysTrayIcon() for details)
54#define XST_IN_MOUSE 0x0001
55#define XST_IN_CONTEXT 0x0002
56#define XST_IN_WHEEL 0x0003
57
58// structure for XST_IN_MOUSE
59typedef struct
60{
61 ULONG ulMouseMsg;
62 // mouse message (one of WM_BUTTONxyyy)
63 POINTS ptsPointerPos;
64 // global pointer position at the time of the mouse event
65 USHORT fsHitTestRes;
66 // hit-test result (see WM_BUTTONxyyy description in PM)
67 USHORT fsFlags;
68 // keyboard control codes (see WM_BUTTONxyyy description in PM)
69
70} XSTMOUSEMSG, *PXSTMOUSEMSG;
71
72// structure for XST_IN_CONTEXT
73typedef struct
74{
75 POINTS ptsPointerPos;
76 // global pointer position at the time of the mouse event
77 USHORT fPointer;
78 // input device flag (see WM_CONTEXTMENU description in PM)
79
80} XSTCONTEXTMSG, *PXSTCONTEXTMSG;
81
82// structure for XST_IN_WHEEL
83typedef struct
84{
85 ULONG ulWheelMsg;
86 // mouse message (one of WM_HSCROLL or WM_VSCROLL)
87 POINTS ptsPointerPos;
88 // global pointer position at the time of the mouse event
89 USHORT usCmd;
90 // command (see WM_HSCROLL/WM_VSCROLL description in PM)
91
92} XSTWHEELMSG, *PXSTWHEELMSG;
93
94/*
95 *@@ xstQuerySysTrayVersion:
96 *
97 * Returns the version of the Extended system tray in the variables pointed
98 * to by arguments. Any argument may be NULL in which case the
99 * corresponding component of the version is not returned.
100 *
101 * Returns TRUE on success and FALSE if the Extended system tray is not
102 * installed or not operational.
103 *
104 * NOTE: When the Extended system tray is started up or gets enabled after
105 * being temporarily disabled, it sends a message with the ID returned by
106 * xstGetSysTrayCreatedMsgId() to all top-level WC_FRAME windows on the
107 * desktop to let them add tray icons if they need.
108 */
109
110XSTAPI(BOOL, xstQuerySysTrayVersion)
111 (PULONG pulMajor, // out: major version number
112 PULONG pulMinor, // out: minor version number
113 PULONG pulRevision); // out: revision number
114
115/*
116 *@@ xstAddSysTrayIcon:
117 *
118 * Adds an icon for the given window handle to the system tray. The icon ID
119 * is used to distinguish between several icons for the same window handle.
120 * If the icon with the specified ID already exists in the system tray, it
121 * will be replaced.
122 *
123 * Returns TRUE on success and FALSE otherwise.
124 *
125 * The specified window handle receives notification messages about icon
126 * events using the message ID specified by the ulMsgId parameter. The
127 * layout of the message parameters is as follows:
128 *
129 * param1
130 * USHORT usIconID icon ID
131 * USHORT usNotifyCode notify code, one of XST_IN_ constants
132 *
133 * param2
134 * PVOID pData notify code specific data (see below)
135 *
136 * The following notify codes are currently recognized:
137 *
138 * XST_IN_MOUSE:
139 * Mouse event in the icon area. Currently, only mouse click
140 * messages are recognized. param2 is a pointer to the XSTMOUSEMSG
141 * structure containing full mouse message details.
142 *
143 * XST_IN_CONTEXT:
144 * Context menu event in the icon area. param2 is a pointer to the
145 * XSTCONTEXTMSG structure containing full message details.
146 *
147 * XST_IN_WHEEL:
148 * Mouse wheel event in the icon area. param2 is a pointer to the
149 * XSTWHEELTMSG structure containing full message details.
150 *
151 * NOTE: The maximum tooltip text length (including terminating null) is
152 * limited to a value returned by xstGetSysTrayMaxTextLen(). If the
153 * supplied string is longer, it will be truncated.
154 */
155
156XSTAPI(BOOL, xstAddSysTrayIcon)
157 (HWND hwnd, // in: window handle associated with the icon
158 USHORT usId, // in: icon ID to add
159 HPOINTER hIcon, // in: icon handle
160 PCSZ pcszToolTip,// in: tooltip text
161 ULONG ulMsgId, // in: message ID for notifications
162 ULONG ulFlags); // in: flags (not currently used, must be 0)
163
164/*
165 *@@ xstReplaceSysTrayIcon:
166 *
167 * Replaces the existing icon previously added by xstAddSysTrayIcon() with
168 * a new icon.
169 *
170 * Returns TRUE on success and FALSE otherwise.
171 */
172
173XSTAPI(BOOL, xstReplaceSysTrayIcon)
174 (HWND hwnd, // in: window handle associated with the icon
175 USHORT usId, // in: icon ID to change
176 HPOINTER hIcon); // in: new icon handle
177
178/*
179 *@@ xstRemoveSysTrayIcon:
180 *
181 * Removes the icon previously added by xstAddSysTrayIcon() from the system
182 * tray.
183 *
184 * Returns TRUE on success and FALSE otherwise.
185 */
186
187XSTAPI(BOOL, xstRemoveSysTrayIcon)
188 (HWND hwnd, // in: window handle associated with the icon
189 USHORT usId); // in: icon ID to remove
190
191/*
192 *@@ xstSetSysTrayIconToolTip:
193 *
194 * Sets the tooltip text for the given icon in the system tray. This text
195 * is shown when the mouse pointer is held still over the icon area for
196 * some time.
197 *
198 * If pszText is NULL, the tooltip text is reset and will not be shown next
199 * time. The old tooltip is hidden if it is being currently shown.
200 *
201 * Returns TRUE on success and FALSE otherwise.
202 *
203 * NOTE: The maximum tooltip text length (including terminating null) is
204 * limited to a value returned by xstGetSysTrayMaxTextLen(). If the
205 * supplied string is longer, it will be truncated.
206 */
207
208XSTAPI(BOOL, xstSetSysTrayIconToolTip)
209 (HWND hwnd, // in: window handle associated with the icon
210 USHORT usId, // in: icon ID to set the tooltip for
211 PCSZ pcszToolTip); // in: tooltip text
212
213/*
214 *@@ xstShowSysTrayIconBalloon:
215 *
216 * Not implemented yet.
217 */
218
219XSTAPI(BOOL, xstShowSysTrayIconBalloon)(HWND hwnd, USHORT usId, PCSZ pcszTitle,
220 PCSZ pcszText, ULONG ulFlags,
221 ULONG ulTimeout);
222
223/*
224 *@@ xstHideSysTrayIconBalloon:
225 *
226 * Not implemented yet.
227 */
228
229XSTAPI(BOOL, xstHideSysTrayIconBalloon)(HWND hwnd, USHORT usId);
230
231/*
232 *@@ xstQuerySysTrayIconRect:
233 *
234 * Obtains a rectangle occupied by the given icon (in screen coordinates,
235 * top right corner exclusive).
236 *
237 * Returns TRUE on success and FALSE otherwise.
238 */
239
240XSTAPI(BOOL, xstQuerySysTrayIconRect)
241 (HWND hwnd, // in: window handle associated with the icon
242 USHORT usId, // in: icon ID to query the rectangle for
243 PRECTL prclRect); // out: where to store the returned rectangle
244
245/*
246 *@@ xstGetSysTrayCreatedMsgId:
247 *
248 * Returns the ID of the message that is sent by the Extended system tray
249 * to all top-level WC_FRAME windows on the desktop to let them add tray
250 * icons if they need.
251 *
252 * NOTE: The returned value never changes until reboot so it is a good
253 * practice to cache it instead of calling this function each time from the
254 * window procedure of every involved window.
255 */
256
257XSTAPI(ULONG, xstGetSysTrayCreatedMsgId)();
258
259/*
260 *@@ xstGetSysTrayMaxTextLen:
261 *
262 * Returns the maximum length of the text (in bytes, including the
263 * terminating null) that can be shown in the tooltop of the icon in the
264 * system tray. You can use the returned value to determine the maximum
265 * length of the string passed as pszText to xstSetSysTrayIconToolTip().
266 *
267 * The returned value also defines the maximum length of both the title and
268 * the text (including terminating nulls) of the icon's balloon for the
269 * xstShowSysTrayIconBalloon() call.
270 *
271 * Returns TRUE on success and FALSE otherwise.
272 *
273 * NOTE: The returned value never changes until reboot so it is a good
274 * practice to cache it instead of calling this function each time.
275 */
276
277XSTAPI(ULONG, xstGetSysTrayMaxTextLen)();
278
279#if __cplusplus
280}
281#endif
282
283#endif // XSYSTRAY_API_HEADER_INCLUDED
284
Note: See TracBrowser for help on using the repository browser.