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

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

xsystray: Provide function pointer declarations to simplify importing API from the DLL at runtime.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Date Revision Author Id
File size: 8.9 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)(PULONG pulMajor, PULONG pulMinor,
111 PULONG pulRevision);
112
113/*
114 *@@ xstAddSysTrayIcon:
115 *
116 * Adds an icon for the given window handle to the system tray. The icon ID
117 * is used to distinguish between several icons for the same window handle.
118 * If the icon with the specified ID already exists in the system tray, it
119 * will be replaced.
120 *
121 * Returns TRUE on success and FALSE otherwise.
122 *
123 * The specified window handle receives notification messages about icon
124 * events using the message ID specified by the ulMsgId parameter. The
125 * layout of the message parameters is as follows:
126 *
127 * param1
128 * USHORT usIconID icon ID
129 * USHORT usNotifyCode notify code, one of XST_IN_ constants
130 *
131 * param2
132 * PVOID pData notify code specific data (see below)
133 *
134 * The following notify codes are currently recognized:
135 *
136 * XST_IN_MOUSE:
137 * Mouse event in the icon area. Currently, only mouse click
138 * messages are recognized. param2 is a pointer to the XSTMOUSEMSG
139 * structure containing full mouse message details.
140 *
141 * XST_IN_CONTEXT:
142 * Context menu event in the icon area. param2 is a pointer to the
143 * XSTCONTEXTMSG structure containing full message details.
144 *
145 * XST_IN_WHEEL:
146 * Mouse wheel event in the icon area. param2 is a pointer to the
147 * XSTWHEELTMSG structure containing full message details.
148 *
149 * NOTE: The maximum tooltip text length (including terminating null) is
150 * limited to a value returned by xstGetSysTrayMaxTextLen(). If the
151 * supplied string is longer, it will be truncated.
152 */
153
154XSTAPI(BOOL, xstAddSysTrayIcon)(HWND hwnd, USHORT usId, HPOINTER hIcon,
155 PCSZ pcszToolTip, ULONG ulMsgId, ULONG ulFlags);
156
157/*
158 *@@ xstReplaceSysTrayIcon:
159 *
160 * Replaces the existing icon previously added by xstAddSysTrayIcon() with
161 * a new icon.
162 *
163 * Returns TRUE on success and FALSE otherwise.
164 */
165
166XSTAPI(BOOL, xstReplaceSysTrayIcon)(HWND hwnd, USHORT usId, HPOINTER hIcon);
167
168/*
169 *@@ xstRemoveSysTrayIcon:
170 *
171 * Removes the icon previously added by xstAddSysTrayIcon() from the system
172 * tray.
173 *
174 * Returns TRUE on success and FALSE otherwise.
175 */
176
177XSTAPI(BOOL, xstRemoveSysTrayIcon)(HWND hwnd, USHORT usId);
178
179/*
180 *@@ xstSetSysTrayIconToolTip:
181 *
182 * Sets the tooltip text for the given icon in the system tray. This text
183 * is shown when the mouse pointer is held still over the icon area for
184 * some time.
185 *
186 * If pszText is NULL, the tooltip text is reset and will not be shown next
187 * time. The old tooltip is hidden if it is being currently shown.
188 *
189 * Returns TRUE on success and FALSE otherwise.
190 *
191 * NOTE: The maximum tooltip text length (including terminating null) is
192 * limited to a value returned by xstGetSysTrayMaxTextLen(). If the
193 * supplied string is longer, it will be truncated.
194 */
195
196XSTAPI(BOOL, xstSetSysTrayIconToolTip)(HWND hwnd, USHORT usId, PCSZ pcszToolTip);
197
198/*
199 *@@ xstShowSysTrayIconBalloon:
200 *
201 * Not implemented yet.
202 */
203
204XSTAPI(BOOL, xstShowSysTrayIconBalloon)(HWND hwnd, USHORT usId, PCSZ pcszTitle,
205 PCSZ pcszText, ULONG ulFlags,
206 ULONG ulTimeout);
207
208/*
209 *@@ xstHideSysTrayIconBalloon:
210 *
211 * Not implemented yet.
212 */
213
214XSTAPI(BOOL, xstHideSysTrayIconBalloon)(HWND hwnd, USHORT usId);
215
216/*
217 *@@ xstQuerySysTrayIconRect:
218 *
219 * Obtains a rectangle occupied by the given icon (in screen coordinates,
220 * top right corner exclusive).
221 *
222 * Returns TRUE on success and FALSE otherwise.
223 */
224
225XSTAPI(BOOL, xstQuerySysTrayIconRect)(HWND hwnd, USHORT usId, PRECTL prclRect);
226
227/*
228 *@@ xstGetSysTrayCreatedMsgId:
229 *
230 * Returns the ID of the message that is sent by the Extended system tray
231 * to all top-level WC_FRAME windows on the desktop to let them add tray
232 * icons if they need.
233 *
234 * NOTE: The returned value never changes until reboot so it is a good
235 * practice to cache it instead of calling this function each time from the
236 * window procedure of every involved window.
237 */
238
239XSTAPI(ULONG, xstGetSysTrayCreatedMsgId)();
240
241/*
242 *@@ xstGetSysTrayMaxTextLen:
243 *
244 * Returns the maximum length of the text (in bytes, including the
245 * terminating null) that can be shown in the tooltop of the icon in the
246 * system tray. You can use the returned value to determine the maximum
247 * length of the string passed as pszText to xstSetSysTrayIconToolTip().
248 *
249 * The returned value also defines the maximum length of both the title and
250 * the text (including terminating nulls) of the icon's balloon for the
251 * xstShowSysTrayIconBalloon() call.
252 *
253 * Returns TRUE on success and FALSE otherwise.
254 *
255 * NOTE: The returned value never changes until reboot so it is a good
256 * practice to cache it instead of calling this function each time.
257 */
258
259XSTAPI(ULONG, xstGetSysTrayMaxTextLen)();
260
261#if __cplusplus
262}
263#endif
264
265#endif // XSYSTRAY_API_HEADER_INCLUDED
266
Note: See TracBrowser for help on using the repository browser.