ChangeLog Add generic notification support to comctl32 Index: dlls/comctl32/comctl32.h =================================================================== RCS file: /var/cvs/wine/dlls/comctl32/comctl32.h,v retrieving revision 1.16 diff -u -r1.16 comctl32.h --- dlls/comctl32/comctl32.h 31 May 2002 23:25:43 -0000 1.16 +++ dlls/comctl32/comctl32.h 5 Sep 2002 17:33:49 -0000 @@ -4,6 +4,7 @@ * * Copyright 1999 Thuy Nguyen * Copyright 1999 Eric Kohl + * Copyright 2002 Dimitrie O. Paun * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,6 +24,8 @@ #ifndef __WINE_COMCTL32_H #define __WINE_COMCTL32_H +#include "commctrl.h" + extern HMODULE COMCTL32_hModule; extern HBRUSH COMCTL32_hPattern55AABrush; @@ -125,4 +128,132 @@ #define WINE_FILEVERSION 5, COMCTL32_VERSION_MINOR, 0, 0 #define WINE_FILEVERSIONSTR "5.00" +/* Notification support */ + +inline static LRESULT __send_notify(HWND hwnd, UINT code, NMHDR *hdr) +{ + hdr->hwndFrom = hwnd; + hdr->idFrom = GetWindowLongW (hwnd, GWL_ID); + hdr->code = code; + + return SendMessageW (GetParent(hwnd), WM_NOTIFY, hdr->idFrom, (LPARAM)hdr); +} + + +inline static LRESULT __notify(HWND hwnd, UINT code) +{ + NMHDR hdr; + + return __send_notify(hwnd, code, &hdr); +} + +inline static BOOL __notify_char(HWND hwnd, UINT ch, DWORD prev, DWORD next) +{ + NMCHAR nmch; + + nmch.ch = ch; + nmch.dwItemPrev = prev; + nmch.dwItemNext = next; + return (BOOL)__send_notify(hwnd, NM_CHAR, &nmch.hdr); +} + +inline static BOOL __notify_keydown(HWND hwnd, UINT nVKey, UINT uFlags) +{ + NMKEY nmk; + + nmk.nVKey = nVKey; + nmk.uFlags = uFlags; + return (BOOL)__send_notify(hwnd, NM_KEYDOWN, &nmk.hdr); +} + +inline static DWORD __notify_mouse(HWND hwnd, UINT code, DWORD spec, DWORD data, POINT *pt, LPARAM dwHitInfo) +{ + NMMOUSE nmm; + + nmm.dwItemSpec = spec; + nmm.dwItemData = data; + nmm.pt.x = pt->x; + nmm.pt.y = pt->y; + nmm.dwHitInfo = dwHitInfo; + return __send_notify(hwnd, code, &nmm.hdr); +} + +#define DEFINE_CHAR_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static BOOL notify_char(CTRLINFO *infoPtr, UINT ch, DWORD prev, DWORD next) \ + { return __notify_char(infoPtr->hwndSelf, ch, prev, next); } + +#define DEFINE_CLICK_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static void notify_click(CTRLINFO *infoPtr) \ + { __notify(infoPtr->hwndSelf, NM_CLICK); } + +#define DEFINE_DBLCLK_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static void notify_dblclk(CTRLINFO *infoPtr) \ + { __notify(infoPtr->hwndSelf, NM_DBLCLK); } + +#define DEFINE_HOVER_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static BOOL notify_hover(CTRLINFO *infoPtr) \ + { return __notify(infoPtr->hwndSelf, NM_HOVER); } + +#define DEFINE_KEYDOWN_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static BOOL notify_keydown(CTRLINFO *infoPtr, UINT nVKey, UINT uFlags) \ + { return __notify_keydown(infoPtr->hwndSelf, nVKey, uFlags); } + +#define DEFINE_KILLFOCUS_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static void notify_killfocus(CTRLINFO *infoPtr) \ + { __notify(infoPtr->hwndSelf, NM_KILLFOCUS); } + +#define DEFINE_NCHITTEST_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static DWORD notify_nchittest(CTRLINFO *infoPtr, DWORD spec, DWORD data, POINT *pt, LPARAM dwHitInfo) \ + { return __notify_mouse(infoPtr->hwndSelf, NM_NCHITTEST, spec, data, pt, dwHitInfo); } + +#define DEFINE_OUTOFMEMORY_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static void notify_outofmemory(CTRLINFO *infoPtr) \ + { __notify(infoPtr->hwndSelf, NM_OUTOFMEMORY); } + +#define DEFINE_RCLICK_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static BOOL notify_rclick(CTRLINFO *infoPtr) \ + { return __notify(infoPtr->hwndSelf, NM_RCLICK); } + +#define DEFINE_RDBLCLK_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static void notify_rdblclk(CTRLINFO *infoPtr) \ + { __notify(infoPtr->hwndSelf, NM_RDBLCLK); } + +#define DEFINE_RELEASEDCAPTURE_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static void notify_releasedcapture(CTRLINFO *infoPtr) \ + { __notify(infoPtr->hwndSelf, NM_RELEASEDCAPTURE); } + +#define DEFINE_RETURN_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static void notify_return(CTRLINFO *infoPtr) \ + { __notify(infoPtr->hwndSelf, NM_RETURN); } + +#define DEFINE_SETCURSOR_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static BOOL notify_setcursor(CTRLINFO *infoPtr, DWORD spec, DWORD data, POINT *pt, LPARAM dwHitInfo) \ + { return __notify_mouse(infoPtr->hwndSelf, NM_SETCURSOR, spec, data, pt, dwHitInfo); } + +#define DEFINE_SETFOCUS_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static void notify_setfocus(CTRLINFO *infoPtr) \ + { __notify(infoPtr->hwndSelf, NM_SETFOCUS); } + +#define DEFINE_TOOLTIPSCREATED_NOTIFICATION(CTRLINFO, hwndSelf) \ + inline static void notify_tooltipscreated(CTRLINFO *infoPtr) \ + { __notify(infoPtr->hwndSelf, NM_TOOLTIPSCREATED); } + +#define DEFINE_COMMON_NOTIFICATIONS(CTRLINFO, hwndSelf) \ + DEFINE_CHAR_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_CLICK_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_DBLCLK_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_HOVER_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_KEYDOWN_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_KILLFOCUS_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_NCHITTEST_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_OUTOFMEMORY_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_RCLICK_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_RDBLCLK_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_RELEASEDCAPTURE_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_RETURN_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_SETCURSOR_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_SETFOCUS_NOTIFICATION(CTRLINFO, hwndSelf) \ + DEFINE_TOOLTIPSCREATED_NOTIFICATION(CTRLINFO, hwndSelf) \ + struct __forward_dummy_struc_dec_to_catch_missing_semicolon + #endif /* __WINE_COMCTL32_H */