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

Last change on this file since 839 was 838, checked in by Dmitry A. Kuminov, 15 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