explorer: Store information needed for the info balloon in the tray icon structure.

This commit is contained in:
Alexandre Julliard 2010-12-15 16:31:12 +01:00
parent 477c085e4d
commit d2e047612c
1 changed files with 19 additions and 8 deletions

View File

@ -65,10 +65,16 @@ struct icon
HICON image; /* the image to render */
HWND owner; /* the HWND passed in to the Shell_NotifyIcon call */
HWND tooltip; /* Icon tooltip */
UINT state; /* state flags */
UINT id; /* the unique id given by the app */
UINT callback_message;
int display; /* index in display list, or -1 if hidden */
WCHAR tiptext[128]; /* Tooltip text. If empty => tooltip disabled */
WCHAR info_text[256]; /* info balloon text */
WCHAR info_title[64]; /* info balloon title */
UINT info_flags; /* flags for info balloon */
UINT info_timeout; /* timeout for info balloon */
HICON info_icon; /* info balloon icon */
};
static struct list icon_list = LIST_INIT( icon_list );
@ -84,6 +90,9 @@ static int icon_cx, icon_cy, tray_width;
#define MIN_DISPLAYED 8
#define ICON_BORDER 2
#define BALLOON_SHOW_MIN_TIMEOUT 10000
#define BALLOON_SHOW_MAX_TIMEOUT 30000
/* Retrieves icon record by owner window and ID */
static struct icon *get_icon(HWND owner, UINT id)
{
@ -252,10 +261,9 @@ static BOOL modify_icon( struct icon *icon, NOTIFYICONDATAW *nid )
return FALSE;
}
if ((nid->uFlags & NIF_STATE) && (nid->dwStateMask & NIS_HIDDEN))
if (nid->uFlags & NIF_STATE)
{
if (nid->dwState & NIS_HIDDEN) hide_icon( icon );
else show_icon( icon );
icon->state = (icon->state & ~nid->dwStateMask) | (nid->dwState & nid->dwStateMask);
}
if (nid->uFlags & NIF_ICON)
@ -276,8 +284,14 @@ static BOOL modify_icon( struct icon *icon, NOTIFYICONDATAW *nid )
}
if (nid->uFlags & NIF_INFO && nid->cbSize >= NOTIFYICONDATAA_V2_SIZE)
{
WINE_FIXME("balloon tip title %s, message %s\n", wine_dbgstr_w(nid->szInfoTitle), wine_dbgstr_w(nid->szInfo));
lstrcpynW( icon->info_text, nid->szInfo, sizeof(icon->info_text)/sizeof(WCHAR) );
lstrcpynW( icon->info_title, nid->szInfoTitle, sizeof(icon->info_title)/sizeof(WCHAR) );
icon->info_flags = nid->dwInfoFlags;
icon->info_timeout = max(min(nid->u.uTimeout, BALLOON_SHOW_MAX_TIMEOUT), BALLOON_SHOW_MIN_TIMEOUT);
icon->info_icon = nid->hBalloonIcon;
}
if (icon->state & NIS_HIDDEN) hide_icon( icon );
else show_icon( icon );
return TRUE;
}
@ -308,10 +322,7 @@ static BOOL add_icon(NOTIFYICONDATAW *nid)
if (list_empty( &icon_list )) SetTimer( tray_window, 1, 2000, NULL );
list_add_tail(&icon_list, &icon->entry);
modify_icon( icon, nid );
/* show icon, unless hidden state was explicitly specified */
if (!((nid->uFlags & NIF_STATE) && (nid->dwStateMask & NIS_HIDDEN))) show_icon( icon );
return TRUE;
return modify_icon( icon, nid );
}
/* Deletes tray icon window and icon record */