ReactOS  0.4.14-dev-41-g31d7680
trayclock.cpp
Go to the documentation of this file.
1 /*
2  * ReactOS Explorer
3  *
4  * Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
5  * Copyright 2018 Ged Murphy <gedmurphy@reactos.org>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "precomp.h"
23 
24 /*
25  * TrayClockWnd
26  */
27 
28 const struct
29 {
33 } ClockWndFormats[] = {
34  { TRUE, 0, NULL },
35  { FALSE, 0, L"dddd" },
37 };
39 
40 #define CLOCKWND_FORMAT_COUNT ClockWndFormatsCount
41 
42 static const WCHAR szTrayClockWndClass[] = L"TrayClockWClass";
43 
45  public CComCoClass<CTrayClockWnd>,
46  public CComObjectRootEx<CComMultiThreadModelNoCS>,
47  public CWindowImpl < CTrayClockWnd, CWindow, CControlWinTraits >,
48  public IOleWindow
49 {
55 
56  union
57  {
59  struct
60  {
65  };
66  };
72 
73 public:
74  CTrayClockWnd();
75  virtual ~CTrayClockWnd();
76 
77 private:
80 
82  WORD GetMinimumSize(IN BOOL Horizontal, IN OUT PSIZE pSize);
83  VOID UpdateWnd();
84  VOID Update();
86  BOOL ResetTime();
88  LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
89  LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
90  VOID SetFont(IN HFONT hNewFont, IN BOOL bRedraw);
93  LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
96  LRESULT OnSetFont(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
97  LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
98  LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
101 
102 public:
103 
105  {
106  if (!phwnd)
107  return E_INVALIDARG;
108  *phwnd = m_hWnd;
109  return S_OK;
110  }
111 
113  {
114  return E_NOTIMPL;
115  }
116 
118 
122  END_COM_MAP()
123 
125 
133  MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged)
140  END_MSG_MAP()
141 
143 };
144 
145 #define ID_TRAYCLOCK_TIMER 0
146 #define ID_TRAYCLOCK_TIMER_INIT 1
147 
148 #define TRAY_CLOCK_WND_SPACING_X 5
149 #define TRAY_CLOCK_WND_SPACING_Y 0
150 
152  hFont(NULL),
153  dwFlags(0),
154  LineSpacing(0),
155  VisibleLines(0)
156 {
157  ZeroMemory(&textColor, sizeof(textColor));
158  ZeroMemory(&rcText, sizeof(rcText));
159  ZeroMemory(&LocalTime, sizeof(LocalTime));
161  ZeroMemory(LineSizes, sizeof(LineSizes));
162  ZeroMemory(szLines, sizeof(szLines));
163 }
165 
167 {
168  LOGFONTW clockFont;
169  HTHEME clockTheme;
170  HFONT hFont;
171 
172  clockTheme = OpenThemeData(m_hWnd, L"Clock");
173 
174  if (clockTheme)
175  {
176  GetThemeFont(clockTheme,
177  NULL,
178  CLP_TIME,
179  0,
180  TMT_FONT,
181  &clockFont);
182 
183  hFont = CreateFontIndirectW(&clockFont);
184 
185  GetThemeColor(clockTheme,
186  CLP_TIME,
187  0,
189  &textColor);
190 
191  if (this->hFont != NULL)
192  DeleteObject(this->hFont);
193 
194  SetFont(hFont, FALSE);
195  }
196  else
197  {
198  /* We don't need to set a font here, our parent will use
199  * WM_SETFONT to set the right one when themes are not enabled. */
200  textColor = RGB(0, 0, 0);
201  }
202 
203  CloseThemeData(clockTheme);
204 
205  return TRUE;
206 }
207 
209 {
210  return OnThemeChanged();
211 }
212 
214 {
215  HDC hDC;
216  HFONT hPrevFont;
217  UINT c, i;
218  BOOL bRet = TRUE;
219 
220  hDC = GetDC();
221  if (hDC != NULL)
222  {
223  if (hFont)
224  hPrevFont = (HFONT) SelectObject(hDC, hFont);
225 
226  for (i = 0; i < CLOCKWND_FORMAT_COUNT && bRet; i++)
227  {
228  if (szLines[i][0] != L'\0' &&
230  &LineSizes[i]))
231  {
232  bRet = FALSE;
233  break;
234  }
235  }
236 
237  if (hFont)
238  SelectObject(hDC, hPrevFont);
239 
240  ReleaseDC(hDC);
241 
242  if (bRet)
243  {
244  LineSpacing = 0;
245 
246  /* calculate the line spacing */
247  for (i = 0, c = 0; i < CLOCKWND_FORMAT_COUNT; i++)
248  {
249  if (LineSizes[i].cx > 0)
250  {
252  c++;
253  }
254  }
255 
256  if (c > 0)
257  {
258  /* We want a spacing of 1/2 line */
259  LineSpacing = (LineSpacing / c) / 2;
260  }
261 
262  return TRUE;
263  }
264  }
265 
266  return FALSE;
267 }
268 
270 {
271  WORD iLinesVisible = 0;
272  UINT i;
273  SIZE szMax = { 0, 0 };
274 
275  if (!LinesMeasured)
277 
278  if (!LinesMeasured)
279  return 0;
280 
281  for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
282  {
283  if (LineSizes[i].cx != 0)
284  {
285  if (iLinesVisible > 0)
286  {
287  if (Horizontal)
288  {
289  if (szMax.cy + LineSizes[i].cy + (LONG) LineSpacing >
290  pSize->cy - (2 * TRAY_CLOCK_WND_SPACING_Y))
291  {
292  break;
293  }
294  }
295  else
296  {
297  if (LineSizes[i].cx > pSize->cx - (2 * TRAY_CLOCK_WND_SPACING_X))
298  break;
299  }
300 
301  /* Add line spacing */
302  szMax.cy += LineSpacing;
303  }
304 
305  iLinesVisible++;
306 
307  /* Increase maximum rectangle */
308  szMax.cy += LineSizes[i].cy;
309  if (LineSizes[i].cx > szMax.cx)
310  szMax.cx = LineSizes[i].cx;
311  }
312  }
313 
314  szMax.cx += 2 * TRAY_CLOCK_WND_SPACING_X;
315  szMax.cy += 2 * TRAY_CLOCK_WND_SPACING_Y;
316 
317  *pSize = szMax;
318 
319  return iLinesVisible;
320 }
321 
323 {
324  SIZE szPrevCurrent;
325  UINT BufSize, i;
326  INT iRet;
327  RECT rcClient;
328 
329  ZeroMemory(LineSizes, sizeof(LineSizes));
330 
331  szPrevCurrent = CurrentSize;
332 
333  for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
334  {
335  szLines[i][0] = L'\0';
336  BufSize = _countof(szLines[0]);
337 
338  if (ClockWndFormats[i].IsTime)
339  {
342  &LocalTime,
343  ClockWndFormats[i].lpFormat,
344  szLines[i],
345  BufSize);
346  }
347  else
348  {
351  &LocalTime,
353  szLines[i],
354  BufSize);
355  }
356 
357  if (iRet != 0 && i == 0)
358  {
359  /* Set the window text to the time only */
361  }
362  }
363 
365 
366  if (LinesMeasured &&
367  GetClientRect(&rcClient))
368  {
369  SIZE szWnd;
370 
371  szWnd.cx = rcClient.right;
372  szWnd.cy = rcClient.bottom;
373 
375  CurrentSize = szWnd;
376  }
377 
378  if (IsWindowVisible())
379  {
381 
382  if (szPrevCurrent.cx != CurrentSize.cx ||
383  szPrevCurrent.cy != CurrentSize.cy)
384  {
385  /* Ask the parent to resize */
386  NMHDR nmh = {GetParent(), 0, NTNWM_REALIGN};
387  GetParent().SendMessage(WM_NOTIFY, 0, (LPARAM) &nmh);
388  }
389  }
390 
391  int iDateLength = GetDateFormat(LOCALE_USER_DEFAULT,
393  &LocalTime,
394  NULL,
395  NULL,
396  0);
397  if (iDateLength <= 0)
398  {
399  return;
400  }
401 
402  WCHAR* szDate = new WCHAR[iDateLength];
405  &LocalTime,
406  NULL,
407  szDate,
408  iDateLength) > 0)
409  {
411  reinterpret_cast<UINT_PTR>(m_hWnd),
412  szDate);
413  }
414  delete[] szDate;
415 }
416 
418 {
420  UpdateWnd();
421 }
422 
424 {
425  UINT uiDueTime;
426 
427  /* Calculate the due time */
429  uiDueTime = 1000 - (UINT) LocalTime.wMilliseconds;
431  uiDueTime += (UINT) LocalTime.wSecond * 100;
432  else
433  uiDueTime += (59 - (UINT) LocalTime.wSecond) * 1000;
434 
435  if (uiDueTime < USER_TIMER_MINIMUM || uiDueTime > USER_TIMER_MAXIMUM)
436  uiDueTime = 1000;
437  else
438  {
439  /* Add an artificial delay of 0.05 seconds to make sure the timer
440  doesn't fire too early*/
441  uiDueTime += 50;
442  }
443 
444  return uiDueTime;
445 }
446 
448 {
449  UINT uiDueTime;
450  BOOL Ret;
451 
452  /* Disable all timers */
453  if (IsTimerEnabled)
454  {
457  }
458 
459  if (IsInitTimerEnabled)
460  {
462  }
463 
464  uiDueTime = CalculateDueTime();
465 
466  /* Set the new timer */
467  Ret = SetTimer(ID_TRAYCLOCK_TIMER_INIT, uiDueTime, NULL) != 0;
468  IsInitTimerEnabled = Ret;
469 
470  /* Update the time */
471  Update();
472 
473  return Ret;
474 }
475 
477 {
478  UINT uiDueTime;
479  BOOL Ret;
480  UINT uiWait1, uiWait2;
481 
482  /* Kill the initialization timer */
485 
486  uiDueTime = CalculateDueTime();
487 
489  {
490  uiWait1 = 1000 - 200;
491  uiWait2 = 1000;
492  }
493  else
494  {
495  uiWait1 = 60 * 1000 - 200;
496  uiWait2 = 60 * 1000;
497  }
498 
499  if (uiDueTime > uiWait1)
500  {
501  /* The update of the clock will be up to 200 ms late, but that's
502  acceptable. We're going to setup a timer that fires depending
503  uiWait2. */
504  Ret = SetTimer(ID_TRAYCLOCK_TIMER, uiWait2, NULL) != 0;
505  IsTimerEnabled = Ret;
506 
507  /* Update the time */
508  Update();
509  }
510  else
511  {
512  /* Recalibrate the timer and recalculate again when the current
513  minute/second ends. */
514  ResetTime();
515  }
516 }
517 
519 {
520  /* Disable all timers */
521  if (IsTimerEnabled)
522  {
524  }
525 
526  if (IsInitTimerEnabled)
527  {
529  }
530 
531  return TRUE;
532 }
533 
535 {
536  RECT rcClient;
537  HFONT hPrevFont;
538  INT iPrevBkMode;
539  UINT i, line;
540 
541  PAINTSTRUCT ps;
542  HDC hDC = (HDC) wParam;
543 
544  if (wParam == 0)
545  {
546  hDC = BeginPaint(&ps);
547  }
548 
549  if (hDC == NULL)
550  return FALSE;
551 
552  if (LinesMeasured &&
553  GetClientRect(&rcClient))
554  {
555  iPrevBkMode = SetBkMode(hDC, TRANSPARENT);
556 
558 
559  hPrevFont = (HFONT) SelectObject(hDC, hFont);
560 
561  rcClient.top = (rcClient.bottom - CurrentSize.cy) / 2;
562  rcClient.bottom = rcClient.top + CurrentSize.cy;
563 
564  for (i = 0, line = 0;
566  i++)
567  {
568  if (LineSizes[i].cx != 0)
569  {
570  TextOut(hDC,
571  (rcClient.right - LineSizes[i].cx) / 2,
572  rcClient.top + TRAY_CLOCK_WND_SPACING_Y,
573  szLines[i],
574  wcslen(szLines[i]));
575 
576  rcClient.top += LineSizes[i].cy + LineSpacing;
577  line++;
578  }
579  }
580 
581  SelectObject(hDC, hPrevFont);
582 
583  SetBkMode(hDC, iPrevBkMode);
584  }
585 
586  if (wParam == 0)
587  {
588  EndPaint(&ps);
589  }
590 
591  return TRUE;
592 }
593 
595 {
596  hFont = hNewFont;
598  if (bRedraw)
599  {
601  }
602 }
603 
605 {
606  RECT rect;
607 
610 
611  return TRUE;
612 }
613 
615 {
616  HDC hdc = (HDC) wParam;
617 
618  if (!IsAppThemed())
619  {
620  bHandled = FALSE;
621  return 0;
622  }
623 
624  return DrawBackground(hdc);
625 }
626 
628 {
629  switch (wParam)
630  {
631  case ID_TRAYCLOCK_TIMER:
632  Update();
633  break;
634 
636  CalibrateTimer();
637  break;
638  }
639  return TRUE;
640 }
641 
643 {
645 
646  return (LRESULT) GetMinimumSize((BOOL) wParam, (PSIZE) lParam) != 0;
647 }
648 
650 {
651  return GetParent().SendMessage(uMsg, wParam, lParam);
652 }
653 
655 {
657  return TRUE;
658 }
659 
661 {
663 
664  TOOLINFOW ti = { 0 };
665  ti.cbSize = TTTOOLINFOW_V1_SIZE;
666  ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
667  ti.hwnd = m_hWnd;
668  ti.uId = reinterpret_cast<UINT_PTR>(m_hWnd);
669  ti.lpszText = NULL;
670  ti.lParam = NULL;
671 
672  m_tooltip.AddTool(&ti);
673 
674  ResetTime();
675  return TRUE;
676 }
677 
679 {
680  SIZE szClient;
681 
682  szClient.cx = LOWORD(lParam);
683  szClient.cy = HIWORD(lParam);
684 
686  CurrentSize = szClient;
687 
689  return TRUE;
690 }
691 
693 {
694  BOOL bRealign = FALSE;
695 
696  TaskbarSettings* newSettings = (TaskbarSettings*)lParam;
697  if (newSettings->bShowSeconds != g_TaskbarSettings.bShowSeconds)
698  {
700  bRealign = TRUE;
701  }
702 
703  if (newSettings->sr.HideClock != g_TaskbarSettings.sr.HideClock)
704  {
705  g_TaskbarSettings.sr.HideClock = newSettings->sr.HideClock;
707  bRealign = TRUE;
708  }
709 
710  if (bRealign)
711  {
712  /* Ask the parent to resize */
713  NMHDR nmh = {GetParent(), 0, NTNWM_REALIGN};
714  GetParent().SendMessage(WM_NOTIFY, 0, (LPARAM) &nmh);
715  Update();
716  }
717  return 0;
718 }
719 
721 {
722  if (IsWindowVisible())
723  {
724  //FIXME: use SHRunControlPanel
725  ShellExecuteW(m_hWnd, NULL, L"timedate.cpl", NULL, NULL, SW_NORMAL);
726  }
727  return TRUE;
728 }
729 
731 {
732  IsHorizontal = TRUE;
733 
734  /* Create the window. The tray window is going to move it to the correct
735  position and resize it as needed. */
736  DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS;
738  dwStyle |= WS_VISIBLE;
739 
740  Create(hWndParent, 0, NULL, dwStyle);
741  if (!m_hWnd)
742  return E_FAIL;
743 
744  SetWindowTheme(m_hWnd, L"TrayNotify", NULL);
745 
746  return S_OK;
747 
748 };
749 
751 {
752  return ShellObjectCreatorInit<CTrayClockWnd>(hwndParent, riid, ppv);
753 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:649
#define IN
Definition: typedefs.h:38
#define SW_NORMAL
Definition: winuser.h:763
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:518
DWORD dwFormatFlags
Definition: trayclock.cpp:31
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
DWORD HideClock
Definition: precomp.h:195
#define WM_CONTEXTMENU
Definition: richedit.h:64
static const WCHAR szTrayClockWndClass[]
Definition: trayclock.cpp:42
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WORD GetMinimumSize(IN BOOL Horizontal, IN OUT PSIZE pSize)
Definition: trayclock.cpp:269
DWORD IsHorizontal
Definition: trayclock.cpp:64
#define SW_HIDE
Definition: winuser.h:762
REFIID riid
Definition: precomp.h:44
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1631
#define _countof(array)
Definition: fontsub.cpp:30
#define LOCALE_USER_DEFAULT
#define DATE_SHORTDATE
Definition: winnls.h:193
#define _ARRAYSIZE(A)
Definition: ntbasedef.h:708
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:614
BOOL AddTool(IN CONST TTTOOLINFOW *pInfo)
Definition: rosctrls.h:630
#define TNWM_GETMINIMUMSIZE
Definition: precomp.h:333
HRESULT WINAPI ContextSensitiveHelp(BOOL fEnterMode)
Definition: trayclock.cpp:112
static HDC
Definition: imagelist.c:92
BOOL IsTime
Definition: trayclock.cpp:30
#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd)
Definition: atlwin.h:1876
REFIID LPVOID * ppv
Definition: atlbase.h:39
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:611
UINT_PTR WPARAM
Definition: windef.h:207
void EndPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:495
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LOGFONTW *pFont)
Definition: property.c:108
#define WS_CHILD
Definition: pedump.c:617
BOOL bShowSeconds
Definition: precomp.h:207
#define ID_TRAYCLOCK_TIMER_INIT
Definition: trayclock.cpp:146
BOOL SetWindowText(LPCTSTR lpszString)
Definition: atlwin.h:1232
LONG right
Definition: windef.h:293
#define E_FAIL
Definition: ddrawi.h:102
#define BOOL
Definition: nt_native.h:43
int32_t INT
Definition: typedefs.h:56
TW_STRUCKRECTS2 sr
Definition: precomp.h:209
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:660
#define WM_PRINTCLIENT
Definition: richedit.h:70
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:834
#define TTTOOLINFOW_V1_SIZE
Definition: commctrl.h:1693
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define COLOR_3DFACE
Definition: winuser.h:919
CTooltips m_tooltip
Definition: trayclock.cpp:54
VOID UpdateTipText(IN HWND hwndToolOwner, IN UINT uId, IN PCWSTR szText, IN HINSTANCE hinstResourceOwner=NULL)
Definition: rosctrls.h:678
#define TWM_SETTINGSCHANGED
Definition: precomp.h:132
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
#define TTS_ALWAYSTIP
Definition: commctrl.h:1729
UINT_PTR SetTimer(UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
Definition: atlwin.h:1190
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
VOID UpdateWnd()
Definition: trayclock.cpp:322
#define TTF_IDISHWND
Definition: commctrl.h:1736
VOID SetFont(IN HFONT hNewFont, IN BOOL bRedraw)
Definition: trayclock.cpp:594
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
#define TRANSPARENT
Definition: wingdi.h:949
BOOL KillTimer(UINT_PTR nIDEvent)
Definition: atlwin.h:908
SIZE LineSizes[CLOCKWND_FORMAT_COUNT]
Definition: trayclock.cpp:70
#define TMT_TEXTCOLOR
Definition: vssym32.h:328
#define E_INVALIDARG
Definition: ddrawi.h:101
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:678
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
static HWND hwndParent
Definition: cryptui.c:300
LONG cx
Definition: windef.h:319
#define TMT_FONT
Definition: vssym32.h:144
LONG_PTR LPARAM
Definition: windef.h:208
Definition: parser.c:48
#define TOOLINFOW
Definition: commctrl.h:1687
HRESULT WINAPI GetWindow(HWND *phwnd)
Definition: trayclock.cpp:104
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
#define BufSize
Definition: FsRtlTunnel.c:28
DWORD LineSpacing
Definition: trayclock.cpp:67
#define SW_SHOW
Definition: winuser.h:769
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:534
#define WM_DESTROY
Definition: winuser.h:1591
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
#define NTNWM_REALIGN
Definition: precomp.h:336
HRESULT Initialize(IN HWND hWndParent)
Definition: trayclock.cpp:730
SIZE CurrentSize
Definition: trayclock.cpp:68
if(!(yy_init))
Definition: macro.lex.yy.c:714
HDC BeginPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:297
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SIZE
Definition: winuser.h:1593
#define TRAY_CLOCK_WND_SPACING_X
Definition: trayclock.cpp:148
LONG HRESULT
Definition: typedefs.h:77
#define END_MSG_MAP()
Definition: atlwin.h:1789
DWORD COLORREF
Definition: windef.h:285
LRESULT OnGetMinimumSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:642
UINT CalculateDueTime()
Definition: trayclock.cpp:423
#define WM_TIMER
Definition: winuser.h:1724
#define RGB(r, g, b)
Definition: wingdi.h:2935
#define WINAPI
Definition: msvc.h:8
const GLubyte * c
Definition: glext.h:8905
#define ID_TRAYCLOCK_TIMER
Definition: trayclock.cpp:145
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CLOCKWND_FORMAT_COUNT
Definition: trayclock.cpp:40
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
WORD wSecond
Definition: winbase.h:876
#define WM_PAINT
Definition: winuser.h:1602
WORD wMilliseconds
Definition: winbase.h:877
const UINT ClockWndFormatsCount
Definition: trayclock.cpp:38
char line[200]
Definition: main.c:97
static const WCHAR L[]
Definition: oid.c:1250
#define USER_TIMER_MAXIMUM
Definition: winuser.h:895
HDC hdc
Definition: main.c:9
DWORD LinesMeasured
Definition: trayclock.cpp:63
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static const WCHAR szDate[]
Definition: http.c:99
LRESULT DrawBackground(HDC hdc)
Definition: trayclock.cpp:604
COLORREF textColor
Definition: trayclock.cpp:51
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
HWND m_hWnd
Definition: atlwin.h:268
LPCWSTR lpFormat
Definition: trayclock.cpp:32
#define CS_DBLCLKS
Definition: winuser.h:646
const struct @86 ClockWndFormats[]
HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId, int iPropId, COLORREF *pColor)
Definition: property.c:45
LRESULT OnTaskbarSettingsChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:692
HWND Create(HWND hWndParent, DWORD dwStyles=WS_POPUP|TTS_NOPREFIX, DWORD dwExStyles=WS_EX_TOPMOST)
Definition: rosctrls.h:609
int ReleaseDC(HDC hDC)
Definition: atlwin.h:1006
#define GetTimeFormat
Definition: winnls.h:1186
WCHAR szLines[CLOCKWND_FORMAT_COUNT][48]
Definition: trayclock.cpp:71
BOOL MeasureLines()
Definition: trayclock.cpp:213
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
static HDC hDC
Definition: 3dtext.c:33
#define S_OK
Definition: intsafe.h:59
DWORD IsInitTimerEnabled
Definition: trayclock.cpp:62
#define TRAY_CLOCK_WND_SPACING_Y
Definition: trayclock.cpp:149
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1265
#define GetDateFormat
Definition: winnls.h:1181
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
#define DATE_LONGDATE
Definition: winnls.h:194
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT CTrayClockWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: trayclock.cpp:750
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
#define WM_SETFONT
Definition: winuser.h:1632
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1770
LRESULT OnSetFont(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:654
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1798
_Out_opt_ int * cx
Definition: commctrl.h:570
#define OUT
Definition: typedefs.h:39
#define WM_CREATE
Definition: winuser.h:1590
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:627
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2208
const GUID IID_IOleWindow
#define c
Definition: ke_i.h:80
#define HIWORD(l)
Definition: typedefs.h:246
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
#define TextOut
Definition: wingdi.h:4478
LONG bottom
Definition: windef.h:294
LRESULT OnThemeChanged()
Definition: trayclock.cpp:166
WORD VisibleLines
Definition: trayclock.cpp:69
VOID CalibrateTimer()
Definition: trayclock.cpp:476
#define TIME_NOSECONDS
Definition: winnls.h:275
SYSTEMTIME LocalTime
Definition: trayclock.cpp:53
CWindow GetParent() const
Definition: atlwin.h:654
#define END_COM_MAP()
Definition: atlcom.h:552
#define WM_ERASEBKGND
Definition: winuser.h:1607
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_VISIBLE
Definition: pedump.c:620
LONG cy
Definition: windef.h:320
LPARAM lParam
Definition: combotst.c:139
#define TTS_NOPREFIX
Definition: commctrl.h:1730
#define LOWORD(l)
Definition: pedump.c:82
#define TTF_SUBCLASS
Definition: commctrl.h:1739
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HDC GetDC()
Definition: atlwin.h:513
DWORD IsTimerEnabled
Definition: trayclock.cpp:61
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
#define WM_NOTIFY
Definition: richedit.h:61
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
BOOL IsWindowVisible() const
Definition: atlwin.h:890
LRESULT OnLButtonDblClick(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayclock.cpp:720
virtual ~CTrayClockWnd()
Definition: trayclock.cpp:164
BOOL ResetTime()
Definition: trayclock.cpp:447