Changeset 838 for trunk/src


Ignore:
Timestamp:
Mar 18, 2011, 4:53:58 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/3rdparty/os2/xsystray/apilib/xsystray.h

    r837 r838  
    3333#endif
    3434
     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
    3540#ifdef XSTAPI_IMPL
    36 #define XSTAPI __declspec(dllexport) EXPENTRY
     41# define XSTAPI(rt,fn) rt __declspec(dllexport) EXPENTRY fn
    3742#else
    38 #define XSTAPI EXPENTRY
     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
    3950#endif
    4051
     
    97108 */
    98109
    99 BOOL XSTAPI xstQuerySysTrayVersion(PULONG pulMajor, PULONG pulMinor,
    100                                    PULONG pulRevision);
     110XSTAPI(BOOL, xstQuerySysTrayVersion)(PULONG pulMajor, PULONG pulMinor,
     111                                     PULONG pulRevision);
    101112
    102113/*
     
    141152 */
    142153
    143 BOOL XSTAPI xstAddSysTrayIcon(HWND hwnd, USHORT usId, HPOINTER hIcon,
    144                               PCSZ pcszToolTip, ULONG ulMsgId, ULONG ulFlags);
     154XSTAPI(BOOL, xstAddSysTrayIcon)(HWND hwnd, USHORT usId, HPOINTER hIcon,
     155                                PCSZ pcszToolTip, ULONG ulMsgId, ULONG ulFlags);
    145156
    146157/*
     
    153164 */
    154165
    155 BOOL XSTAPI xstReplaceSysTrayIcon(HWND hwnd, USHORT usId, HPOINTER hIcon);
     166XSTAPI(BOOL, xstReplaceSysTrayIcon)(HWND hwnd, USHORT usId, HPOINTER hIcon);
    156167
    157168/*
     
    164175 */
    165176
    166 BOOL XSTAPI xstRemoveSysTrayIcon(HWND hwnd, USHORT usId);
     177XSTAPI(BOOL, xstRemoveSysTrayIcon)(HWND hwnd, USHORT usId);
    167178
    168179/*
     
    183194 */
    184195
    185 BOOL XSTAPI xstSetSysTrayIconToolTip(HWND hwnd, USHORT usId, PCSZ pcszToolTip);
     196XSTAPI(BOOL, xstSetSysTrayIconToolTip)(HWND hwnd, USHORT usId, PCSZ pcszToolTip);
    186197
    187198/*
     
    191202 */
    192203
    193 BOOL XSTAPI xstShowSysTrayIconBalloon(HWND hwnd, USHORT usId, PCSZ pcszTitle,
     204XSTAPI(BOOL, xstShowSysTrayIconBalloon)(HWND hwnd, USHORT usId, PCSZ pcszTitle,
    194205                                      PCSZ pcszText, ULONG ulFlags,
    195206                                      ULONG ulTimeout);
     
    201212 */
    202213
    203 BOOL XSTAPI xstHideSysTrayIconBalloon(HWND hwnd, USHORT usId);
     214XSTAPI(BOOL, xstHideSysTrayIconBalloon)(HWND hwnd, USHORT usId);
    204215
    205216/*
     
    212223 */
    213224
    214 BOOL XSTAPI xstQuerySysTrayIconRect(HWND hwnd, USHORT usId, PRECTL prclRect);
     225XSTAPI(BOOL, xstQuerySysTrayIconRect)(HWND hwnd, USHORT usId, PRECTL prclRect);
    215226
    216227/*
     
    226237 */
    227238
    228 ULONG XSTAPI xstGetSysTrayCreatedMsgId();
     239XSTAPI(ULONG, xstGetSysTrayCreatedMsgId)();
    229240
    230241/*
     
    246257 */
    247258
    248 ULONG XSTAPI xstGetSysTrayMaxTextLen();
     259XSTAPI(ULONG, xstGetSysTrayMaxTextLen)();
    249260
    250261#if __cplusplus
  • trunk/src/gui/util/qsystemtrayicon_pm.cpp

    r835 r838  
    5151#include "qt_os2.h"
    5252
    53 // for dynamic linking to xsystray DLL
    54 #define xstQuerySysTrayVersion (*_xstQuerySysTrayVersion)
    55 #define xstAddSysTrayIcon (*_xstAddSysTrayIcon)
    56 #define xstReplaceSysTrayIcon (*_xstReplaceSysTrayIcon)
    57 #define xstRemoveSysTrayIcon (*_xstRemoveSysTrayIcon)
    58 #define xstSetSysTrayIconToolTip (*_xstSetSysTrayIconToolTip)
    59 #define xstQuerySysTrayIconRect (*_xstQuerySysTrayIconRect)
    60 #define xstGetSysTrayCreatedMsgId (*_xstGetSysTrayCreatedMsgId)
    61 #define xstGetSysTrayMaxTextLen (*_xstGetSysTrayMaxTextLen)
    62 
     53// declare function pointers for dynamic linking to xsystray DLL
     54#define XSTAPI_FPTRS_STATIC
    6355#include "xsystray.h"
    6456
     
    325317        QLibrary xsystray(QLatin1String("xsystray"));
    326318
    327         #define R(f) if ((*((void **)&_##f) = xsystray.resolve(#f)) == NULL) return false
     319        #define R(f) if ((*((void **)&f) = xsystray.resolve(#f)) == NULL) return false
    328320
    329321        R(xstQuerySysTrayVersion);
     
    333325        R(xstSetSysTrayIconToolTip);
    334326        R(xstQuerySysTrayIconRect);
     327        R(xstShowSysTrayIconBalloon);
     328        R(xstHideSysTrayIconBalloon);
    335329        R(xstGetSysTrayCreatedMsgId);
    336330        R(xstGetSysTrayMaxTextLen);
Note: See TracChangeset for help on using the changeset viewer.