https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e7ad10241f12bb3760d6cd...
commit e7ad10241f12bb3760d6cdb73fd7077f87ce1cd3 Author: Brock Mammen brockmammen@gmail.com AuthorDate: Sat Mar 23 11:16:44 2019 -0500 Commit: Hermès BÉLUSCA - MAÏTO hermes.belusca-maito@reactos.org CommitDate: Sun Mar 24 23:34:57 2019 +0100
[EXPLORER] Add date tooltip to taskbar clock
CORE-11444 --- base/shell/explorer/trayclock.cpp | 41 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/base/shell/explorer/trayclock.cpp b/base/shell/explorer/trayclock.cpp index b4e85d951c3..c49f154554c 100644 --- a/base/shell/explorer/trayclock.cpp +++ b/base/shell/explorer/trayclock.cpp @@ -51,6 +51,7 @@ class CTrayClockWnd : COLORREF textColor; RECT rcText; SYSTEMTIME LocalTime; + CTooltips m_tooltip;
union { @@ -388,6 +389,31 @@ VOID CTrayClockWnd::UpdateWnd() GetParent().SendMessage(WM_NOTIFY, 0, (LPARAM) &nmh); } } + + int iDateLength = GetDateFormat(LOCALE_USER_DEFAULT, + DATE_LONGDATE, + &LocalTime, + NULL, + NULL, + 0); + if (iDateLength <= 0) + { + return; + } + + WCHAR* szDate = new WCHAR[iDateLength]; + if (GetDateFormat(LOCALE_USER_DEFAULT, + DATE_LONGDATE, + &LocalTime, + NULL, + szDate, + iDateLength) > 0) + { + m_tooltip.UpdateTipText(m_hWnd, + reinterpret_cast<UINT_PTR>(m_hWnd), + szDate); + } + delete[] szDate; }
VOID CTrayClockWnd::Update() @@ -624,7 +650,8 @@ LRESULT CTrayClockWnd::OnGetMinimumSize(UINT uMsg, WPARAM wParam, LPARAM lParam,
LRESULT CTrayClockWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - return HTTRANSPARENT; + // HTCLIENT is returned to receive WM_MOUSEMOVE messages for the tooltip + return HTCLIENT; }
LRESULT CTrayClockWnd::OnSetFont(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) @@ -635,6 +662,18 @@ LRESULT CTrayClockWnd::OnSetFont(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
LRESULT CTrayClockWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { + m_tooltip.Create(m_hWnd, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP); + + TOOLINFOW ti = { 0 }; + ti.cbSize = TTTOOLINFOW_V1_SIZE; + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + ti.hwnd = m_hWnd; + ti.uId = reinterpret_cast<UINT_PTR>(m_hWnd); + ti.lpszText = NULL; + ti.lParam = NULL; + + m_tooltip.AddTool(&ti); + ResetTime(); return TRUE; }