diff --git a/reactos/subsys/system/explorer/.cvsignore b/reactos/subsys/system/explorer/.cvsignore index cf8e0fbba7d..bb9a6b53319 100644 --- a/reactos/subsys/system/explorer/.cvsignore +++ b/reactos/subsys/system/explorer/.cvsignore @@ -15,3 +15,4 @@ _NO_COMUTIL *.aps *.ncb *.plg +*.suo diff --git a/reactos/subsys/system/explorer/taskbar/traynotify.cpp b/reactos/subsys/system/explorer/taskbar/traynotify.cpp index c2087b012cf..fb84670dc91 100644 --- a/reactos/subsys/system/explorer/taskbar/traynotify.cpp +++ b/reactos/subsys/system/explorer/taskbar/traynotify.cpp @@ -29,6 +29,7 @@ #include "../utility/utility.h" #include "../explorer.h" +#include "../globals.h" #include "traynotify.h" @@ -277,10 +278,13 @@ NotifyIconSet::iterator NotifyArea::IconHitTest(const POINT& pos) ClockWindow::ClockWindow(HWND hwnd) - : super(hwnd) + : super(hwnd), + _tooltip(hwnd) { *_time = _T('\0'); FormatTime(); + + _tooltip.add(_hwnd, _hwnd); } HWND ClockWindow::Create(HWND hwndParent) @@ -306,6 +310,23 @@ LRESULT ClockWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) return 0; } +int ClockWindow::Notify(int id, NMHDR* pnmh) +{ + if (pnmh->code == TTN_GETDISPINFO) { + LPNMTTDISPINFO pdi = (LPNMTTDISPINFO)pnmh; + + SYSTEMTIME systime; + TCHAR buffer[64]; + + GetLocalTime(&systime); + GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &systime, NULL, buffer, 64); + + _tcscpy(pdi->szText, buffer); + } + + return 0; +} + void ClockWindow::TimerTick() { if (FormatTime()) diff --git a/reactos/subsys/system/explorer/taskbar/traynotify.h b/reactos/subsys/system/explorer/taskbar/traynotify.h index 7dce0ad2788..db318f2be5e 100644 --- a/reactos/subsys/system/explorer/taskbar/traynotify.h +++ b/reactos/subsys/system/explorer/taskbar/traynotify.h @@ -114,9 +114,11 @@ struct ClockWindow : public Window protected: LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam); + int Notify(int id, NMHDR* pnmh); bool FormatTime(); void Paint(); TCHAR _time[16]; + ToolTip _tooltip; }; diff --git a/reactos/subsys/system/explorer/utility/window.cpp b/reactos/subsys/system/explorer/utility/window.cpp index 345c69e270a..c63391c4d79 100644 --- a/reactos/subsys/system/explorer/utility/window.cpp +++ b/reactos/subsys/system/explorer/utility/window.cpp @@ -653,3 +653,12 @@ void PictureButton::DrawItem(LPDRAWITEMSTRUCT dis) DrawFocusRect(dis->hDC, &rect); } } + + +ToolTip::ToolTip(HWND owner) + : super(CreateWindowEx(WS_EX_NOPARENTNOTIFY, TOOLTIPS_CLASS, 0, + TTS_ALWAYSTIP, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT, + owner, 0, g_Globals._hInstance, 0)) +{ + activate(); +} diff --git a/reactos/subsys/system/explorer/utility/window.h b/reactos/subsys/system/explorer/utility/window.h index f0ad683b33d..58653a9e959 100644 --- a/reactos/subsys/system/explorer/utility/window.h +++ b/reactos/subsys/system/explorer/utility/window.h @@ -448,3 +448,26 @@ protected: HICON _hIcon; bool _flat; }; + + +struct ToolTip : public WindowHandle +{ + typedef WindowHandle super; + + ToolTip(HWND owner); + + void activate(BOOL active=TRUE) + { + SendMessage(_hwnd, TTM_ACTIVATE, active, 0); + } + + void add(HWND hparent, HWND htool, LPCTSTR txt=LPSTR_TEXTCALLBACK) + { + TOOLINFO ti = { + sizeof(TOOLINFO), TTF_SUBCLASS|TTF_IDISHWND/*|TTF_TRANSPARENT*/, hparent, (UINT)htool, 0, 0, 0, 0, 0, 0, 0 + }; + ti.lpszText = (LPTSTR) txt; + + SendMessage(_hwnd, TTM_ADDTOOL, 0, (LPARAM)&ti); + } +};