SysPagerWnd_UpdateButton(IN OUT PSYS_PAGER_WND_DATA This,
IN CONST NOTIFYICONDATA *iconData)
{
- TBBUTTONINFO tbbi;
+ TBBUTTONINFO tbbi = {0};
PNOTIFY_ITEM notifyItem;
PPNOTIFY_ITEM NotifyPointer;
notifyItem->IconIndex = tbbi.iImage = ImageList_AddIcon(This->SysIcons, iconData->hIcon);
}
- /* TODO: support NIF_TIP */
+ if (iconData->uFlags & NIF_TIP)
+ {
+ StringCchCopy(notifyItem->iconData.szTip, _countof(notifyItem->iconData.szTip), iconData->szTip);
+ }
if (iconData->uFlags & NIF_STATE)
{
{
HWND parent = GetParent(hWnd);
- if (!parent)
- return 0;
-
- return SendMessage(parent, msg, wParam, lParam);
+ if (parent)
+ {
+ SendMessage(parent, msg, wParam, lParam);
+ }
}
return DefSubclassProc(hWnd, msg, wParam, lParam);
static VOID
SysPagerWnd_Create(IN OUT PSYS_PAGER_WND_DATA This)
{
- This->hWndToolbar = CreateWindowEx(0,
+ DWORD styles =
+ WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN |
+ TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | TBSTYLE_TRANSPARENT |
+ CCS_TOP | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER;
+ DWORD exStyles = WS_EX_TOOLWINDOW;
+
+ This->hWndToolbar = CreateWindowEx(exStyles,
TOOLBARCLASSNAME,
NULL,
- WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN |
- TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE |
- TBSTYLE_TRANSPARENT |
- CCS_TOP | CCS_NORESIZE | CCS_NODIVIDER,
+ styles,
0,
0,
0,
PCOPYDATASTRUCT cpData = (PCOPYDATASTRUCT)lParam;
if (cpData->dwData == 1)
{
- SYS_PAGER_COPY_DATA data;
+ SYS_PAGER_COPY_DATA * data;
NOTIFYICONDATA *iconData;
HWND parentHWND;
RECT windowRect;
parentHWND = GetParent(parentHWND);
GetClientRect(parentHWND, &windowRect);
- ZeroMemory(&data, sizeof(data));
- CopyMemory(
- &data,
- (PSYS_PAGER_COPY_DATA) cpData->lpData,
- cpData->cbData);
- iconData = &data.nicon_data;
+ data = (PSYS_PAGER_COPY_DATA) cpData->lpData;
+ iconData = &data->nicon_data;
- switch (data.notify_code)
+ switch (data->notify_code)
{
case NIM_ADD:
{
PPNOTIFY_ITEM NotifyPointer;
- DbgPrint("NotifyMessage received with NIM_ADD\n");
-
NotifyPointer = SysPagerWnd_FindPPNotifyItemByIconData(This,
iconData);
if (!NotifyPointer)
{
PPNOTIFY_ITEM NotifyPointer;
- DbgPrint("NotifyMessage received with NIM_MODIFY\n");
-
NotifyPointer = SysPagerWnd_FindPPNotifyItemByIconData(This,
iconData);
if (!NotifyPointer)
}
case NIM_DELETE:
{
- DbgPrint("NotifyMessage received with NIM_DELETE\n");
-
SysPagerWnd_RemoveButton(This, iconData);
break;
}
default:
- DbgPrint("NotifyMessage received with unknown code %d.\n", data.notify_code);
+ TRACE("NotifyMessage received with unknown code %d.\n", data->notify_code);
break;
}
SendMessage(parentHWND,
switch (uMsg)
{
case WM_ERASEBKGND:
- SysPagerWnd_DrawBackground(hwnd,(HDC)wParam);
- return 0;
+ if (!IsAppThemed())
+ break;
+
+ SysPagerWnd_DrawBackground(hwnd, (HDC) wParam);
+ return TRUE;
case WM_NCCREATE:
{
This->ButtonCount = 0;
This->VisibleButtonCount = 0;
- SetWindowLongPtr(hwnd,
- 0,
- (LONG_PTR)This);
+ SetWindowLongPtr(hwnd, 0, (LONG_PTR) This);
return TRUE;
}
SysPagerWnd_NCDestroy(This);
break;
+ case WM_NOTIFY:
+ {
+ const NMHDR * nmh = (const NMHDR *) lParam;
+ if (nmh->code == TBN_GETINFOTIPW)
+ {
+ NMTBGETINFOTIP * nmtip = (NMTBGETINFOTIP *) lParam;
+ PPNOTIFY_ITEM ptr = SysPagerWnd_FindPPNotifyItemByIndex(This, nmtip->iItem);
+ if (ptr)
+ {
+ PNOTIFY_ITEM item = *ptr;
+ StringCchCopy(nmtip->pszText, nmtip->cchTextMax, item->iconData.szTip);
+ }
+ }
+ else if (nmh->code == NM_CUSTOMDRAW)
+ {
+ NMCUSTOMDRAW * cdraw = (NMCUSTOMDRAW *) lParam;
+ switch (cdraw->dwDrawStage)
+ {
+ case CDDS_PREPAINT:
+ return CDRF_NOTIFYITEMDRAW;
+
+ case CDDS_ITEMPREPAINT:
+ return TBCDRF_NOBACKGROUND | TBCDRF_NOEDGES | TBCDRF_NOOFFSET | TBCDRF_NOMARK | TBCDRF_NOETCHEDEFFECT;
+ }
+ }
+
+ break;
+ }
+
case WM_SIZE:
{
SIZE szClient;
szClient.cx = LOWORD(lParam);
szClient.cy = HIWORD(lParam);
- Ret = DefWindowProc(hwnd,
- uMsg,
- wParam,
- lParam);
-
+ Ret = DefWindowProc(hwnd, uMsg, wParam, lParam);
if (This->hWndToolbar != NULL && This->hWndToolbar != hwnd)
{
- SetWindowPos(This->hWndToolbar,
- NULL,
- 0,
- 0,
- szClient.cx,
- szClient.cy,
- SWP_NOZORDER);
+ SetWindowPos(This->hWndToolbar, NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER);
}
+
+ return Ret;
}
default:
return 0;
}
- Ret = DefWindowProc(hwnd,
- uMsg,
- wParam,
- lParam);
break;
}
}
- return Ret;
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
static HWND
IN LPARAM lParam)
{
PTRAY_CLOCK_WND_DATA This = NULL;
- LRESULT Ret = FALSE;
if (uMsg != WM_NCCREATE)
{
TrayClockWnd_UpdateTheme(This);
break;
case WM_ERASEBKGND:
- TrayClockWnd_DrawBackground(hwnd, (HDC)wParam);
- break;
+ if (!IsAppThemed())
+ break;
+
+ TrayClockWnd_DrawBackground(hwnd, (HDC) wParam);
+ return TRUE;
case WM_PAINT:
case WM_PRINTCLIENT:
{
if (wParam == 0)
{
- hDC = BeginPaint(This->hWnd,
- &ps);
+ hDC = BeginPaint(This->hWnd, &ps);
}
if (hDC != NULL)
{
- TrayClockWnd_Paint(This,
- hDC);
+ TrayClockWnd_Paint(This, hDC);
if (wParam == 0)
{
- EndPaint(This->hWnd,
- &ps);
+ EndPaint(This->hWnd, &ps);
}
}
break;
case WM_NCHITTEST:
/* We want the user to be able to drag the task bar when clicking the clock */
- Ret = HTTRANSPARENT;
- break;
+ return HTTRANSPARENT;
case TCWM_GETMINIMUMSIZE:
{
This->IsHorizontal = (BOOL)wParam;
- Ret = (LRESULT)TrayClockWnd_GetMinimumSize(This,
- (BOOL)wParam,
- (PSIZE)lParam) != 0;
- break;
+ return (LRESULT) TrayClockWnd_GetMinimumSize(This, (BOOL) wParam, (PSIZE) lParam) != 0;
}
case TCWM_UPDATETIME:
{
- Ret = (LRESULT)TrayClockWnd_ResetTime(This);
- break;
+ return (LRESULT)TrayClockWnd_ResetTime(This);
}
case WM_NCCREATE:
This->hWnd = hwnd;
This->hWndNotify = CreateStruct->hwndParent;
- SetWindowLongPtr(hwnd,
- 0,
- (LONG_PTR)This);
+ SetWindowLongPtr(hwnd, 0, (LONG_PTR) This);
TrayClockWnd_UpdateTheme(This);
return TRUE;
TRUE);
break;
}
-
- default:
- Ret = DefWindowProc(hwnd,
- uMsg,
- wParam,
- lParam);
- break;
}
}
- return Ret;
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
static HWND
IN LPARAM lParam)
{
PTRAY_NOTIFY_WND_DATA This = NULL;
- LRESULT Ret = FALSE;
if (uMsg != WM_NCCREATE)
{
return 0;
case WM_ERASEBKGND:
if (!This->TrayTheme)
- goto HandleDefaultMessage;
- return TrayNotifyWnd_DrawBackground(hwnd,
- uMsg,
- wParam,
- lParam);
+ break;
+ return TrayNotifyWnd_DrawBackground(hwnd, uMsg, wParam, lParam);
case TNWM_GETMINIMUMSIZE:
{
- Ret = (LRESULT)TrayNotifyWnd_GetMinimumSize(This,
- (BOOL)wParam,
- (PSIZE)lParam);
- break;
+ return (LRESULT) TrayNotifyWnd_GetMinimumSize(This, (BOOL) wParam, (PSIZE) lParam);
}
case TNWM_UPDATETIME:
if (This->hWndTrayClock != NULL)
{
/* Forward the message to the tray clock window procedure */
- Ret = TrayClockWndProc(This->hWndTrayClock,
- TCWM_UPDATETIME,
- wParam,
- lParam);
+ return TrayClockWndProc(This->hWndTrayClock, TCWM_UPDATETIME, wParam, lParam);
}
- break;
+ return 0;
}
case WM_SIZE:
TrayNotifyWnd_Size(This,
&szClient);
- break;
+ return 0;
}
case WM_NCHITTEST:
/* We want the user to be able to drag the task bar when clicking the
tray notification window */
- Ret = HTTRANSPARENT;
- break;
-
+ return HTTRANSPARENT;
case TNWM_SHOWCLOCK:
{
BOOL PrevHidden = This->HideClock;
This->HideClock ? SW_HIDE : SW_SHOW);
}
- Ret = (LRESULT)(!PrevHidden);
- break;
+ return (LRESULT) (!PrevHidden);
}
case WM_NOTIFY:
if (nmh->hwndFrom == This->hWndTrayClock)
{
/* Pass down notifications */
- Ret = SendMessage(This->hWndNotify,
- WM_NOTIFY,
- wParam,
- lParam);
+ return SendMessage(This->hWndNotify, WM_NOTIFY, wParam, lParam);
}
- break;
+ return 0;
}
case WM_SETFONT:
wParam,
lParam);
}
- goto HandleDefaultMessage;
+ break;
}
case WM_NCCREATE:
This->hWnd = hwnd;
This->hWndNotify = CreateStruct->hwndParent;
- SetWindowLongPtr(hwnd,
- 0,
- (LONG_PTR)This);
+ SetWindowLongPtr(hwnd, 0, (LONG_PTR) This);
return TRUE;
}
case WM_CREATE:
TrayNotifyWnd_Create(This);
- break;
+ return 0;
case WM_NCDESTROY:
TrayNotifyWnd_NCDestroy(This);
- break;
-
- default:
-HandleDefaultMessage:
- Ret = DefWindowProc(hwnd,
- uMsg,
- wParam,
- lParam);
- break;
+ return 0;
}
}
- return Ret;
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
HWND