mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
tool tip texts for notification icons
svn path=/trunk/; revision=8715
This commit is contained in:
parent
b61431ec36
commit
e8f56accc6
6 changed files with 117 additions and 28 deletions
|
@ -8,7 +8,7 @@ CC = gcc
|
|||
CXX = g++
|
||||
LINK = g++
|
||||
|
||||
CFLAGS = -DWIN32 -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -fexceptions -Wall
|
||||
CFLAGS = -DWIN32 -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -fexceptions -Wall
|
||||
RCFLAGS = -DWIN32 -D__WINDRES__
|
||||
LFLAGS = -Wl,--subsystem,windows
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ SRCDIR = .
|
|||
MODULE = explorer.exe
|
||||
APPMODE = gui
|
||||
IMPORTS = shell32 comctl32 ole32 user32 gdi32 kernel32 advapi32 oleaut32
|
||||
EXTRADEFS = -D__WINE__ -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -D__MINGW32__
|
||||
EXTRADEFS = -D__WINE__ -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -D__MINGW32__
|
||||
#EXTRA_OBJS = explorer_intres.res
|
||||
EXTRALIBS = $(LIBUUID)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
- read "DESCRIPT.ION" files to display file descriptions
|
||||
- tool tip texts for notification icons
|
||||
- hiding of notification icons
|
||||
- context menus for quick launch bar
|
||||
- detect display mode changes and adjust desktop bar size
|
||||
|
|
|
@ -49,7 +49,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O1 /D "NDEBUG" /D "WIN32" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O1 /D "NDEBUG" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /YX /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -74,7 +74,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -100,7 +100,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_ROS_" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FR /YX /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -126,7 +126,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "UNICODE" /D "_ROS_" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /YX /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -152,7 +152,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "UNICODE" /D "_ROS_" /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -178,7 +178,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_ROS_" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "_NO_COMUTIL" /D "WIN32" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "_NO_COMUTIL" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -205,7 +205,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_ROS_" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -232,7 +232,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D "WIN32" /D "_ROS_" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MT /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -259,7 +259,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D "_ROS_" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
|
@ -57,6 +57,7 @@ NotifyInfo::NotifyInfo()
|
|||
_hIcon = 0;
|
||||
_dwState = 0;
|
||||
_uCallbackMessage = 0;
|
||||
_version = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,22 +78,37 @@ NotifyInfo& NotifyInfo::operator=(NOTIFYICONDATA* pnid)
|
|||
_hIcon = (HICON) CopyImage(pnid->hIcon, IMAGE_ICON, 16, 16, 0);
|
||||
}
|
||||
|
||||
#ifdef NIF_STATE // currently (as of 21.08.2003) missing in MinGW headers
|
||||
#ifdef NIF_STATE // as of 21.08.2003 missing in MinGW headers
|
||||
if (pnid->uFlags & NIF_STATE)
|
||||
_dwState = (_dwState&~pnid->dwStateMask) | (pnid->dwState&pnid->dwStateMask);
|
||||
#endif
|
||||
|
||||
///@todo store and display tool tip texts
|
||||
// store tool tip text
|
||||
if (pnid->uFlags & NIF_TIP)
|
||||
// UNICODE version of NOTIFYICONDATA structure
|
||||
if (pnid->cbSize == sizeof(NOTIFYICONDATAW) || // _WIN32_IE = 0x600
|
||||
pnid->cbSize == sizeof(NOTIFYICONDATAW)-sizeof(GUID) || // _WIN32_IE = 0x500
|
||||
pnid->cbSize == sizeof(NOTIFYICONDATAW)-sizeof(GUID)-(128-64)*sizeof(WCHAR))// _WIN32_IE < 0x500
|
||||
_tipText = (LPCWSTR)pnid->szTip;
|
||||
// ANSI version of NOTIFYICONDATA structure
|
||||
else if (pnid->cbSize == sizeof(NOTIFYICONDATAA) || // _WIN32_IE = 0x600
|
||||
pnid->cbSize == sizeof(NOTIFYICONDATAA)-sizeof(GUID) || // _WIN32_IE = 0x500
|
||||
pnid->cbSize == sizeof(NOTIFYICONDATAA)-sizeof(GUID)-(128-64)*sizeof(CHAR)) // _WIN32_IE < 0x400
|
||||
_tipText = (LPCSTR)pnid->szTip;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
NotifyArea::NotifyArea(HWND hwnd)
|
||||
: super(hwnd)
|
||||
: super(hwnd),
|
||||
_tooltip(hwnd)
|
||||
{
|
||||
_next_idx = 0;
|
||||
_clock_width = 0;
|
||||
_show_hidden = false;
|
||||
|
||||
_tooltip.add(_hwnd, _hwnd);
|
||||
}
|
||||
|
||||
LRESULT NotifyArea::Init(LPCREATESTRUCT pcs)
|
||||
|
@ -212,14 +228,15 @@ LRESULT NotifyArea::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
|||
PostMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg);
|
||||
else {
|
||||
// allow SetForegroundWindow() in client process
|
||||
DWORD processId;
|
||||
GetWindowThreadProcessId(entry._hWnd, &processId);
|
||||
DWORD pid;
|
||||
|
||||
if (GetWindowThreadProcessId(entry._hWnd, &pid)) {
|
||||
// bind dynamically to AllowSetForegroundWindow() to be compatible to WIN98
|
||||
static DynamicFct<BOOL(WINAPI*)(DWORD dwProcessId)> AllowSetForegroundWindow(TEXT("USER32"), "AllowSetForegroundWindow");
|
||||
static DynamicFct<BOOL(WINAPI*)(DWORD)> AllowSetForegroundWindow(TEXT("USER32"), "AllowSetForegroundWindow");
|
||||
|
||||
if (AllowSetForegroundWindow)
|
||||
(*AllowSetForegroundWindow)(processId);
|
||||
(*AllowSetForegroundWindow)(pid);
|
||||
}
|
||||
|
||||
SendMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg);
|
||||
}
|
||||
|
@ -235,6 +252,27 @@ LRESULT NotifyArea::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int NotifyArea::Notify(int id, NMHDR* pnmh)
|
||||
{
|
||||
if (pnmh->code == TTN_GETDISPINFO) {
|
||||
LPNMTTDISPINFO pdi = (LPNMTTDISPINFO)pnmh;
|
||||
|
||||
Point pt(GetMessagePos());
|
||||
ScreenToClient(_hwnd, &pt);
|
||||
|
||||
NotifyIconSet::iterator found = IconHitTest(pt);
|
||||
|
||||
if (found != _sorted_icons.end()) {
|
||||
NotifyInfo& entry = const_cast<NotifyInfo&>(*found); // Why does GCC 3.3 need this additional const_cast ?!
|
||||
|
||||
if (!entry._tipText.empty())
|
||||
_tcscpy(pdi->szText, entry._tipText);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NotifyArea::CancelModes()
|
||||
{
|
||||
PostMessage(HWND_BROADCAST, WM_CANCELMODE, 0, 0);
|
||||
|
@ -248,13 +286,18 @@ LRESULT NotifyArea::ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pni
|
|||
switch(notify_code) {
|
||||
case NIM_ADD:
|
||||
case NIM_MODIFY:
|
||||
if ((int)pnid->uID >= 0) { ///@todo fix for windows task manager
|
||||
if ((int)pnid->uID >= 0) { ///@todo This is a fix for Windows Task Manager.
|
||||
NotifyInfo& entry = _icon_map[pnid] = pnid;
|
||||
|
||||
// a new entry?
|
||||
if (entry._idx == -1)
|
||||
entry._idx = ++_next_idx;
|
||||
|
||||
#if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers
|
||||
if (DetermineHideState(entry))
|
||||
entry._dwState |= NIS_HIDDEN;
|
||||
#endif
|
||||
|
||||
Refresh(); ///@todo call only if really changes occurred
|
||||
|
||||
return TRUE;
|
||||
|
@ -273,12 +316,19 @@ LRESULT NotifyArea::ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pni
|
|||
}
|
||||
break;}
|
||||
|
||||
#if NOTIFYICON_VERSION>=3 // currently (as of 21.08.2003) missing in MinGW headers
|
||||
#if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers
|
||||
case NIM_SETFOCUS:
|
||||
SetForegroundWindow(_hwnd);
|
||||
return TRUE;
|
||||
|
||||
case NIM_SETVERSION:
|
||||
return FALSE; ///@todo
|
||||
NotifyIconMap::iterator found = _icon_map.find(pnid);
|
||||
|
||||
if (found != _icon_map.end()) {
|
||||
found->second._version = pnid->UNION_MEMBER(uVersion);
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -293,8 +343,8 @@ void NotifyArea::Refresh()
|
|||
for(NotifyIconMap::const_iterator it=_icon_map.begin(); it!=_icon_map.end(); ++it) {
|
||||
const NotifyInfo& entry = it->second;
|
||||
|
||||
#ifdef NIF_STATE // currently (as of 21.08.2003) missing in MinGW headers
|
||||
if (!(entry._dwState & NIS_HIDDEN))
|
||||
#ifdef NIF_STATE // as of 21.08.2003 missing in MinGW headers
|
||||
if (_show_hidden || !(entry._dwState & NIS_HIDDEN))
|
||||
#endif
|
||||
_sorted_icons.insert(entry);
|
||||
}
|
||||
|
@ -367,6 +417,38 @@ NotifyIconSet::iterator NotifyArea::IconHitTest(const POINT& pos)
|
|||
return it;
|
||||
}
|
||||
|
||||
#if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers
|
||||
bool NotifyArea::DetermineHideState(NotifyInfo& entry)
|
||||
{
|
||||
/*
|
||||
DWORD pid;
|
||||
|
||||
if (GetWindowThreadProcessId(entry._hWnd, &pid)) {
|
||||
|
||||
//@@ look for executable path
|
||||
|
||||
}
|
||||
*/
|
||||
TCHAR title[MAX_PATH];
|
||||
|
||||
if (GetWindowText(entry._hWnd, title, MAX_PATH)) {
|
||||
if (_tcsstr(title, TEXT("Task Manager")))
|
||||
return false;
|
||||
|
||||
if (_tcsstr(title, TEXT("AntiVir")))
|
||||
return true;
|
||||
|
||||
if (_tcsstr(title, TEXT("Apache")))
|
||||
return true;
|
||||
|
||||
if (_tcsstr(title, TEXT("FRITZ!web")))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ClockWindow::ClockWindow(HWND hwnd)
|
||||
: super(hwnd),
|
||||
|
|
|
@ -67,6 +67,8 @@ struct NotifyInfo : public NotifyIconIndex
|
|||
HICON _hIcon;
|
||||
DWORD _dwState;
|
||||
UINT _uCallbackMessage;
|
||||
UINT _version;
|
||||
String _tipText;
|
||||
};
|
||||
|
||||
typedef map<NotifyIconIndex, NotifyInfo> NotifyIconMap;
|
||||
|
@ -86,15 +88,20 @@ struct NotifyArea : public Window
|
|||
LRESULT ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pnid);
|
||||
|
||||
protected:
|
||||
WindowHandle _hwndClock;
|
||||
int _clock_width;
|
||||
|
||||
NotifyIconMap _icon_map;
|
||||
NotifyIconSet _sorted_icons;
|
||||
int _next_idx;
|
||||
|
||||
WindowHandle _hwndClock;
|
||||
int _clock_width;
|
||||
ToolTip _tooltip;
|
||||
|
||||
bool _show_hidden;
|
||||
|
||||
LRESULT Init(LPCREATESTRUCT pcs);
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
int Notify(int id, NMHDR* pnmh);
|
||||
|
||||
void Refresh();
|
||||
void Paint();
|
||||
|
@ -102,6 +109,7 @@ protected:
|
|||
void CancelModes();
|
||||
|
||||
NotifyIconSet::iterator IconHitTest(const POINT& pos);
|
||||
bool DetermineHideState(NotifyInfo& entry);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue