ReactOS 0.4.15-dev-7958-gcd0bb1a
CTrayClockWnd Class Reference
Inheritance diagram for CTrayClockWnd:
Collaboration diagram for CTrayClockWnd:

Public Member Functions

 CTrayClockWnd ()
 
virtual ~CTrayClockWnd ()
 
HRESULT WINAPI GetWindow (HWND *phwnd)
 
HRESULT WINAPI ContextSensitiveHelp (BOOL fEnterMode)
 
HRESULT Initialize (IN HWND hWndParent)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from ATL::CWindowImpl< CTrayClockWnd, CWindow, CControlWinTraits >
HWND Create (HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
- Public Member Functions inherited from ATL::CWindowImplBaseT< TBase, TWinTraits >
 CWindowImplBaseT ()
 
virtual void OnFinalMessage (HWND)
 
BOOL SubclassWindow (HWND hWnd)
 
HWND UnsubclassWindow (BOOL bForce=FALSE)
 
virtual WNDPROC GetWindowProc ()
 
LRESULT DefWindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HWND Create (HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, _U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam)
 
- Public Member Functions inherited from ATL::CWindowImplRoot< TBase >
 CWindowImplRoot ()
 
virtual ~CWindowImplRoot ()
 
- Public Member Functions inherited from ATL::CWindow
 CWindow (HWND hWnd=NULL)
 
 operator HWND () const
 
UINT ArrangeIconicWindows ()
 
void Attach (HWND hWndNew)
 
HDC BeginPaint (LPPAINTSTRUCT lpPaint)
 
BOOL BringWindowToTop ()
 
BOOL CenterWindow (HWND hWndCenter=NULL)
 
BOOL ChangeClipboardChain (HWND hWndNewNext)
 
BOOL CheckDlgButton (int nIDButton, UINT nCheck)
 
BOOL CheckRadioButton (int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
 
HWND ChildWindowFromPoint (POINT point) const
 
HWND ChildWindowFromPointEx (POINT point, UINT uFlags) const
 
BOOL ClientToScreen (LPPOINT lpPoint) const
 
BOOL ClientToScreen (LPRECT lpRect) const
 
HWND Create (LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
BOOL CreateCaret (HBITMAP pBitmap)
 
BOOL CreateGrayCaret (int nWidth, int nHeight)
 
BOOL CreateSolidCaret (int nWidth, int nHeight)
 
HDWP DeferWindowPos (HDWP hWinPosInfo, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
 
BOOL DestroyWindow ()
 
HWND Detach ()
 
int DlgDirList (LPTSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT nFileType)
 
int DlgDirListComboBox (LPTSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT nFileType)
 
BOOL DlgDirSelect (LPTSTR lpString, int nCount, int nIDListBox)
 
BOOL DlgDirSelectComboBox (LPTSTR lpString, int nCount, int nIDComboBox)
 
void DragAcceptFiles (BOOL bAccept=TRUE)
 
BOOL DrawMenuBar ()
 
BOOL EnableScrollBar (UINT uSBFlags, UINT uArrowFlags=ESB_ENABLE_BOTH)
 
BOOL EnableWindow (BOOL bEnable=TRUE)
 
void EndPaint (LPPAINTSTRUCT lpPaint)
 
BOOL FlashWindow (BOOL bInvert)
 
BOOL GetClientRect (LPRECT lpRect) const
 
HDC GetDC ()
 
HDC GetDCEx (HRGN hRgnClip, DWORD flags)
 
HWND GetDescendantWindow (int nID) const
 
HRESULT GetDlgControl (int nID, REFIID iid, void **ppCtrl)
 
int GetDlgCtrlID () const
 
HRESULT GetDlgHost (int nID, REFIID iid, void **ppHost)
 
HWND GetDlgItem (_In_ int nID) const
 
UINT GetDlgItemInt (_In_ int nID, _Out_opt_ BOOL *lpTrans=NULL, _In_ BOOL bSigned=TRUE) const
 
UINT GetDlgItemText (_In_ int nID, _Out_writes_to_(nMaxCount, return+1) LPTSTR lpStr, _In_ int nMaxCount) const
 
BOOL GetDlgItemText (_In_ int nID, _Inout_ _Outref_result_maybenull_ _Post_z_ BSTR &bstrText) const
 
DWORD GetExStyle () const
 
HFONT GetFont () const
 
DWORD GetHotKey () const
 
HICON GetIcon (BOOL bBigIcon=TRUE) const
 
HWND GetLastActivePopup () const
 
HMENU GetMenu () const
 
HWND GetNextDlgGroupItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
HWND GetNextDlgTabItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
CWindow GetParent () const
 
BOOL GetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo)
 
BOOL GetScrollPos (int nBar)
 
BOOL GetScrollRange (int nBar, LPINT lpMinPos, LPINT lpMaxPos) const
 
DWORD GetStyle () const
 
HMENU GetSystemMenu (BOOL bRevert)
 
HWND GetTopLevelParent () const
 
HWND GetTopLevelWindow () const
 
HWND GetTopWindow () const
 
BOOL GetUpdateRect (LPRECT lpRect, BOOL bErase=FALSE)
 
int GetUpdateRgn (HRGN hRgn, BOOL bErase=FALSE)
 
HWND GetWindow (UINT nCmd) const
 
DWORD GetWindowContextHelpId () const
 
HDC GetWindowDC ()
 
LONG GetWindowLong (int nIndex) const
 
LONG_PTR GetWindowLongPtr (int nIndex) const
 
BOOL GetWindowPlacement (WINDOWPLACEMENT *lpwndpl) const
 
DWORD GetWindowProcessID ()
 
BOOL GetWindowRect (LPRECT lpRect) const
 
int GetWindowRgn (HRGN hRgn)
 
int GetWindowText (_Out_writes_to_(nMaxCount, return+1) LPTSTR lpszStringBuf, _In_ int nMaxCount) const
 
BOOL GetWindowText (_Inout_ _Outref_result_maybenull_ _Post_z_ BSTR &bstrText) const
 
int GetWindowTextLength () const
 
DWORD GetWindowThreadID ()
 
WORD GetWindowWord (int nIndex) const
 
void GotoDlgCtrl (HWND hWndCtrl) const
 
BOOL HideCaret ()
 
BOOL HiliteMenuItem (HMENU hMenu, UINT uHiliteItem, UINT uHilite)
 
BOOL Invalidate (BOOL bErase=TRUE)
 
BOOL InvalidateRect (LPCRECT lpRect, BOOL bErase=TRUE)
 
void InvalidateRgn (HRGN hRgn, BOOL bErase=TRUE)
 
BOOL IsChild (const HWND hWnd) const
 
BOOL IsDialogMessage (LPMSG lpMsg)
 
UINT IsDlgButtonChecked (int nIDButton) const
 
BOOL IsIconic () const
 
BOOL IsParentDialog ()
 
BOOL IsWindow () const
 
BOOL IsWindowEnabled () const
 
BOOL IsWindowVisible () const
 
BOOL IsWindowUnicode ()
 
BOOL IsZoomed () const
 
BOOL KillTimer (UINT_PTR nIDEvent)
 
BOOL LockWindowUpdate (BOOL bLock=TRUE)
 
int MapWindowPoints (HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
 
int MapWindowPoints (HWND hWndTo, LPRECT lpRect) const
 
int MessageBox (LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
 
BOOL ModifyStyle (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL ModifyStyleEx (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL MoveWindow (int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
 
void NextDlgCtrl () const
 
BOOL OpenClipboard ()
 
BOOL PostMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void PrevDlgCtrl () const
 
void Print (HDC hDC, DWORD dwFlags) const
 
void PrintClient (HDC hDC, DWORD dwFlags) const
 
BOOL RedrawWindow (LPCRECT lpRectUpdate=NULL, HRGN hRgnUpdate=NULL, UINT flags=RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE)
 
int ReleaseDC (HDC hDC)
 
BOOL ResizeClient (int nWidth, int nHeight, BOOL bRedraw=FALSE)
 
BOOL ScreenToClient (LPPOINT lpPoint) const
 
BOOL ScrollWindow (int xAmount, int yAmount, LPCRECT lpRect=NULL, LPCRECT lpClipRect=NULL)
 
int ScrollWindowEx (int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate, UINT flags)
 
LRESULT SendDlgItemMessage (int nID, UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
LRESULT SendMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void SendMessageToDescendants (UINT message, WPARAM wParam=0, LPARAM lParam=0, BOOL bDeep=TRUE)
 
BOOL SendNotifyMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
HWND SetActiveWindow ()
 
HWND SetCapture ()
 
HWND SetClipboardViewer ()
 
int SetDlgCtrlID (int nID)
 
BOOL SetDlgItemInt (int nID, UINT nValue, BOOL bSigned=TRUE)
 
BOOL SetDlgItemText (int nID, LPCTSTR lpszString)
 
HWND SetFocus ()
 
void SetFont (HFONT hFont, BOOL bRedraw=TRUE)
 
int SetHotKey (WORD wVirtualKeyCode, WORD wModifiers)
 
HICON SetIcon (HICON hIcon, BOOL bBigIcon=TRUE)
 
BOOL SetMenu (HMENU hMenu)
 
HWND SetParent (HWND hWndNewParent)
 
void SetRedraw (BOOL bRedraw=TRUE)
 
int SetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw=TRUE)
 
int SetScrollPos (int nBar, int nPos, BOOL bRedraw=TRUE)
 
BOOL SetScrollRange (int nBar, int nMinPos, int nMaxPos, BOOL bRedraw=TRUE)
 
UINT_PTR SetTimer (UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
 
BOOL SetWindowContextHelpId (DWORD dwContextHelpId)
 
LONG SetWindowLong (int nIndex, LONG dwNewLong)
 
LONG_PTR SetWindowLongPtr (int nIndex, LONG_PTR dwNewLong)
 
BOOL SetWindowPlacement (const WINDOWPLACEMENT *lpwndpl)
 
BOOL SetWindowPos (HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
 
int SetWindowRgn (HRGN hRgn, BOOL bRedraw=FALSE)
 
BOOL SetWindowText (LPCTSTR lpszString)
 
WORD SetWindowWord (int nIndex, WORD wNewWord)
 
BOOL ShowCaret ()
 
BOOL ShowOwnedPopups (BOOL bShow=TRUE)
 
BOOL ShowScrollBar (UINT nBar, BOOL bShow=TRUE)
 
BOOL ShowWindow (int nCmdShow)
 
BOOL ShowWindowAsync (int nCmdShow)
 
BOOL UpdateWindow ()
 
BOOL ValidateRect (LPCRECT lpRect)
 
BOOL ValidateRgn (HRGN hRgn)
 
BOOL WinHelp (LPCTSTR lpszHelp, UINT nCmd=HELP_CONTEXT, DWORD dwData=0)
 
- Public Member Functions inherited from ATL::CMessageMap
virtual BOOL ProcessWindowMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID)=0
 
HRESULT GetWindow ([out] HWND *phwnd)
 
HRESULT ContextSensitiveHelp ([in] BOOL fEnterMode)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Member Functions

LRESULT OnThemeChanged ()
 
LRESULT OnThemeChanged (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
BOOL MeasureLines ()
 
WORD GetMinimumSize (IN BOOL Horizontal, IN OUT PSIZE pSize)
 
VOID UpdateWnd ()
 
VOID Update ()
 
UINT CalculateDueTime ()
 
BOOL ResetTime ()
 
VOID CalibrateTimer ()
 
LRESULT OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnPaint (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
VOID SetFont (IN HFONT hNewFont, IN BOOL bRedraw)
 
LRESULT DrawBackground (HDC hdc)
 
LRESULT OnEraseBackground (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnTimer (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnGetMinimumSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnContextMenu (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSetFont (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnTaskbarSettingsChanged (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonDblClick (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
VOID PaintLine (IN HDC hDC, IN OUT RECT *rcClient, IN UINT LineNumber, IN UINT szLinesIndex)
 

Private Attributes

HFONT hFont
 
COLORREF textColor
 
RECT rcText
 
SYSTEMTIME LocalTime
 
CTooltips m_tooltip
 
union {
   DWORD   dwFlags
 
   struct {
      DWORD   IsTimerEnabled: 1
 
      DWORD   IsInitTimerEnabled: 1
 
      DWORD   LinesMeasured: 1
 
      DWORD   IsHorizontal: 1
 
   } 
 
}; 
 
DWORD LineSpacing
 
SIZE CurrentSize
 
WORD VisibleLines
 
SIZE LineSizes [CLOCKWND_FORMAT_COUNT]
 
WCHAR szLines [CLOCKWND_FORMAT_COUNT][48]
 

Additional Inherited Members

- Public Types inherited from ATL::CWindowImplRoot< TBase >
enum  { WINSTATE_DESTROYED = 0x00000001 }
 
- Public Types inherited from IOleWindow
typedef IOleWindowLPOLEWINDOW
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Static Public Member Functions inherited from ATL::CComCoClass< CTrayClockWnd >
static LPCTSTR WINAPI GetObjectDescription ()
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Static Public Member Functions inherited from ATL::CWindowImpl< CTrayClockWnd, CWindow, CControlWinTraits >
static LPCTSTR GetWndCaption ()
 
- Static Public Member Functions inherited from ATL::CWindowImplBaseT< TBase, TWinTraits >
static DWORD GetWndStyle (DWORD dwStyle)
 
static DWORD GetWndExStyle (DWORD dwExStyle)
 
static LRESULT CALLBACK StartWindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- Static Public Member Functions inherited from ATL::CWindow
static LPCTSTR GetWndClassName ()
 
static LRESULT SendMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from ATL::CWindowImplBaseT< TBase, TWinTraits >
WNDPROC m_pfnSuperWindowProc
 
- Public Attributes inherited from ATL::CWindowImplRoot< TBase >
CWndProcThunk m_thunk
 
const _ATL_MSGm_pCurrentMsg
 
DWORD m_dwState
 
- Public Attributes inherited from ATL::CWindow
HWND m_hWnd
 
- Static Public Attributes inherited from ATL::CWindow
static RECT rcDefault
 

Detailed Description

Definition at line 47 of file trayclock.cpp.

Constructor & Destructor Documentation

◆ CTrayClockWnd()

CTrayClockWnd::CTrayClockWnd ( )

Definition at line 155 of file trayclock.cpp.

155 :
156 hFont(NULL),
157 textColor(0),
158 dwFlags(0),
159 LineSpacing(0),
160 VisibleLines(0)
161{
162 ZeroMemory(&rcText, sizeof(rcText));
163 ZeroMemory(&LocalTime, sizeof(LocalTime));
166 ZeroMemory(szLines, sizeof(szLines));
167}
SIZE CurrentSize
Definition: trayclock.cpp:71
WORD VisibleLines
Definition: trayclock.cpp:72
DWORD LineSpacing
Definition: trayclock.cpp:70
COLORREF textColor
Definition: trayclock.cpp:54
WCHAR szLines[CLOCKWND_FORMAT_COUNT][48]
Definition: trayclock.cpp:74
SYSTEMTIME LocalTime
Definition: trayclock.cpp:56
SIZE LineSizes[CLOCKWND_FORMAT_COUNT]
Definition: trayclock.cpp:73
#define NULL
Definition: types.h:112
#define ZeroMemory
Definition: winbase.h:1712

◆ ~CTrayClockWnd()

CTrayClockWnd::~CTrayClockWnd ( )
virtual

Definition at line 168 of file trayclock.cpp.

168{ }

Member Function Documentation

◆ CalculateDueTime()

UINT CTrayClockWnd::CalculateDueTime ( )
private

Definition at line 416 of file trayclock.cpp.

417{
418 UINT uiDueTime;
419
421 uiDueTime = 1000 - (UINT) LocalTime.wMilliseconds;
423 uiDueTime += (59 - (UINT) LocalTime.wSecond) * 1000;
424
425 return uiDueTime;
426}
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
if(dx< 0)
Definition: linetemp.h:194
unsigned int UINT
Definition: ndis.h:50
BOOL bShowSeconds
Definition: precomp.h:219
WORD wMilliseconds
Definition: winbase.h:912
WORD wSecond
Definition: winbase.h:911

Referenced by CalibrateTimer(), and ResetTime().

◆ CalibrateTimer()

VOID CTrayClockWnd::CalibrateTimer ( )
private

Definition at line 453 of file trayclock.cpp.

454{
455 UINT uiDueTime;
456 BOOL Ret;
457 UINT uiWait1, uiWait2;
458
459 /* Kill the initialization timer */
462
463 uiDueTime = CalculateDueTime();
464
466 {
467 uiWait1 = 1000 - 200;
468 uiWait2 = 1000;
469 }
470 else
471 {
472 uiWait1 = 60 * 1000 - 200;
473 uiWait2 = 60 * 1000;
474 }
475
476 if (uiDueTime > uiWait1)
477 {
478 /* The update of the clock will be up to 200 ms late, but that's
479 acceptable. We're going to setup a timer that fires depending
480 uiWait2. */
481 Ret = SetTimer(ID_TRAYCLOCK_TIMER, uiWait2, NULL) != 0;
482 IsTimerEnabled = Ret;
483 }
484 else
485 {
486 /* Recalibrate the timer and recalculate again when the current
487 minute/second ends. */
488 ResetTime();
489 }
490
491 /* Update the time */
492 Update();
493}
DWORD IsTimerEnabled
Definition: trayclock.cpp:64
UINT CalculateDueTime()
Definition: trayclock.cpp:416
BOOL ResetTime()
Definition: trayclock.cpp:428
DWORD IsInitTimerEnabled
Definition: trayclock.cpp:65
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ID_TRAYCLOCK_TIMER
Definition: trayclock.cpp:149
#define ID_TRAYCLOCK_TIMER_INIT
Definition: trayclock.cpp:150
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by OnTimer().

◆ ContextSensitiveHelp()

HRESULT WINAPI CTrayClockWnd::ContextSensitiveHelp ( BOOL  fEnterMode)
inline

Implements IOleWindow.

Definition at line 116 of file trayclock.cpp.

117 {
118 return E_NOTIMPL;
119 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DrawBackground()

LRESULT CTrayClockWnd::DrawBackground ( HDC  hdc)
private

Definition at line 596 of file trayclock.cpp.

597{
598 RECT rect;
599
602
603 return TRUE;
604}
HWND m_hWnd
Definition: atlwin.h:273
#define TRUE
Definition: types.h:120
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
HDC hdc
Definition: main.c:9
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by OnEraseBackground().

◆ GetMinimumSize()

WORD CTrayClockWnd::GetMinimumSize ( IN BOOL  Horizontal,
IN OUT PSIZE  pSize 
)
private

Definition at line 258 of file trayclock.cpp.

259{
260 WORD iLinesVisible = 0;
261 UINT i;
262 SIZE szMax = { 0, 0 };
263
264 if (!LinesMeasured)
266
267 if (!LinesMeasured)
268 return 0;
269
270 /* Prevents the date from being cut off when the day of the week is shorter than the date. */
273
274 for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
275 {
276 if (LineSizes[i].cx != 0)
277 {
278 if (iLinesVisible > 0)
279 {
280 if (Horizontal)
281 {
282 if (szMax.cy + LineSizes[i].cy + (LONG) LineSpacing >
283 pSize->cy - (2 * TRAY_CLOCK_WND_SPACING_Y))
284 {
285 break;
286 }
287 }
288 else
289 {
290 if (LineSizes[i].cx > pSize->cx - (2 * TRAY_CLOCK_WND_SPACING_X))
291 break;
292 }
293
294 /* Add line spacing */
295 szMax.cy += LineSpacing;
296 }
297
298 iLinesVisible++;
299
300 /* Increase maximum rectangle */
301 szMax.cy += LineSizes[i].cy;
302 if (LineSizes[i].cx > szMax.cx)
303 szMax.cx = LineSizes[i].cx;
304 }
305 }
306
307 szMax.cx += 2 * TRAY_CLOCK_WND_SPACING_X;
308 szMax.cy += 2 * TRAY_CLOCK_WND_SPACING_Y;
309
310 *pSize = szMax;
311
312 return iLinesVisible;
313}
BOOL MeasureLines()
Definition: trayclock.cpp:202
DWORD LinesMeasured
Definition: trayclock.cpp:66
unsigned short WORD
Definition: ntddk_ex.h:93
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
long LONG
Definition: pedump.c:60
_Out_opt_ int * cx
Definition: commctrl.h:585
BOOL bPreferDate
Definition: precomp.h:220
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
#define CLOCKWND_FORMAT_COUNT
Definition: trayclock.cpp:40
#define TRAY_CLOCK_WND_SPACING_Y
Definition: trayclock.cpp:153
#define TRAY_CLOCK_WND_SPACING_X
Definition: trayclock.cpp:152
#define CLOCKWND_FORMAT_DATE
Definition: trayclock.cpp:43

Referenced by OnGetMinimumSize(), OnSize(), and UpdateWnd().

◆ GetWindow()

HRESULT WINAPI CTrayClockWnd::GetWindow ( HWND phwnd)
inline

Implements IOleWindow.

Definition at line 108 of file trayclock.cpp.

109 {
110 if (!phwnd)
111 return E_INVALIDARG;
112 *phwnd = m_hWnd;
113 return S_OK;
114 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:52

◆ Initialize()

HRESULT CTrayClockWnd::Initialize ( IN HWND  hWndParent)

Definition at line 759 of file trayclock.cpp.

760{
762
763 /* Create the window. The tray window is going to move it to the correct
764 position and resize it as needed. */
765 DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS;
767 dwStyle |= WS_VISIBLE;
768
769 Create(hWndParent, 0, NULL, dwStyle);
770 if (!m_hWnd)
771 return E_FAIL;
772
773 SetWindowTheme(m_hWnd, L"TrayNotify", NULL);
774
775 return S_OK;
776
777};
@ Create
Definition: registry.c:563
DWORD IsHorizontal
Definition: trayclock.cpp:67
#define E_FAIL
Definition: ddrawi.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
TW_STRUCKRECTS2 sr
Definition: precomp.h:225
DWORD HideClock
Definition: precomp.h:207
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69

◆ MeasureLines()

BOOL CTrayClockWnd::MeasureLines ( )
private

Definition at line 202 of file trayclock.cpp.

203{
204 HDC hDC;
205 HFONT hPrevFont;
206 UINT c, i;
207 BOOL bRet = TRUE;
208
209 hDC = GetDC();
210 if (hDC != NULL)
211 {
212 if (hFont)
213 hPrevFont = (HFONT) SelectObject(hDC, hFont);
214
215 for (i = 0; i < CLOCKWND_FORMAT_COUNT && bRet; i++)
216 {
217 if (szLines[i][0] != L'\0' &&
219 &LineSizes[i]))
220 {
221 bRet = FALSE;
222 break;
223 }
224 }
225
226 if (hFont)
227 SelectObject(hDC, hPrevFont);
228
229 ReleaseDC(hDC);
230
231 if (bRet)
232 {
233 LineSpacing = 0;
234
235 /* calculate the line spacing */
236 for (i = 0, c = 0; i < CLOCKWND_FORMAT_COUNT; i++)
237 {
238 if (LineSizes[i].cx > 0)
239 {
241 c++;
242 }
243 }
244
245 if (c > 0)
246 {
247 /* We want a spacing of 1/2 line */
248 LineSpacing = (LineSpacing / c) / 2;
249 }
250
251 return TRUE;
252 }
253 }
254
255 return FALSE;
256}
static HDC hDC
Definition: 3dtext.c:33
HDC GetDC()
Definition: atlwin.h:547
const GLubyte * c
Definition: glext.h:8905
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define c
Definition: ke_i.h:80
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)

Referenced by GetMinimumSize(), SetFont(), and UpdateWnd().

◆ OnContextMenu()

LRESULT CTrayClockWnd::OnContextMenu ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 641 of file trayclock.cpp.

642{
643 return GetParent().SendMessage(uMsg, wParam, lParam);
644}
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1116
CWindow GetParent() const
Definition: atlwin.h:700
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139

◆ OnCreate()

LRESULT CTrayClockWnd::OnCreate ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 652 of file trayclock.cpp.

653{
655
656 TOOLINFOW ti = { 0 };
657 ti.cbSize = TTTOOLINFOW_V1_SIZE;
658 ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
659 ti.hwnd = m_hWnd;
660 ti.uId = reinterpret_cast<UINT_PTR>(m_hWnd);
661 ti.lpszText = NULL;
662 ti.lParam = NULL;
663
664 m_tooltip.AddTool(&ti);
665
667 {
668 ResetTime();
669 }
670
671 /* Update the time */
672 Update();
673
674 return TRUE;
675}
BOOL AddTool(IN CONST TTTOOLINFOW *pInfo)
Definition: rosctrls.h:637
HWND Create(HWND hWndParent, DWORD dwStyles=WS_POPUP|TTS_NOPREFIX, DWORD dwExStyles=WS_EX_TOPMOST)
Definition: rosctrls.h:616
CTooltips m_tooltip
Definition: trayclock.cpp:57
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define WS_POPUP
Definition: pedump.c:616
#define TOOLINFOW
Definition: commctrl.h:1715
#define TTTOOLINFOW_V1_SIZE
Definition: commctrl.h:1721
#define TTF_IDISHWND
Definition: commctrl.h:1764
#define TTF_SUBCLASS
Definition: commctrl.h:1767
#define TTS_ALWAYSTIP
Definition: commctrl.h:1757
#define TTS_NOPREFIX
Definition: commctrl.h:1758

◆ OnDestroy()

LRESULT CTrayClockWnd::OnDestroy ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 495 of file trayclock.cpp.

496{
497 /* Disable all timers */
498 if (IsTimerEnabled)
499 {
501 }
502 else if (IsInitTimerEnabled)
503 {
505 }
506
507 return TRUE;
508}

◆ OnEraseBackground()

LRESULT CTrayClockWnd::OnEraseBackground ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 606 of file trayclock.cpp.

607{
608 HDC hdc = (HDC) wParam;
609
610 if (!IsAppThemed())
611 {
612 bHandled = FALSE;
613 return 0;
614 }
615
616 return DrawBackground(hdc);
617}
LRESULT DrawBackground(HDC hdc)
Definition: trayclock.cpp:596
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596

◆ OnGetMinimumSize()

LRESULT CTrayClockWnd::OnGetMinimumSize ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 634 of file trayclock.cpp.

635{
637
638 return (LRESULT) GetMinimumSize((BOOL) wParam, (PSIZE) lParam) != 0;
639}
WORD GetMinimumSize(IN BOOL Horizontal, IN OUT PSIZE pSize)
Definition: trayclock.cpp:258
#define BOOL
Definition: nt_native.h:43
LONG_PTR LRESULT
Definition: windef.h:209

◆ OnLButtonDblClick()

LRESULT CTrayClockWnd::OnLButtonDblClick ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 749 of file trayclock.cpp.

750{
751 if (IsWindowVisible())
752 {
753 //FIXME: use SHRunControlPanel
754 ShellExecuteW(m_hWnd, NULL, L"timedate.cpl", NULL, NULL, SW_NORMAL);
755 }
756 return TRUE;
757}
BOOL IsWindowVisible() const
Definition: atlwin.h:958
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2402
#define SW_NORMAL
Definition: winuser.h:769

◆ OnPaint()

LRESULT CTrayClockWnd::OnPaint ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 510 of file trayclock.cpp.

511{
512 RECT rcClient;
513 HFONT hPrevFont;
514 INT iPrevBkMode;
515 UINT i, line;
516 PAINTSTRUCT ps;
517 HDC hDC = (HDC) wParam;
518
519 if (wParam == 0)
520 hDC = BeginPaint(&ps);
521
522 if (hDC == NULL)
523 return FALSE;
524
525 if (LinesMeasured &&
526 GetClientRect(&rcClient))
527 {
528 iPrevBkMode = SetBkMode(hDC, TRANSPARENT);
529
530 if (!IsAppThemed())
532
534
535 hPrevFont = (HFONT) SelectObject(hDC, hFont);
536
537 rcClient.top = (rcClient.bottom - CurrentSize.cy) / 2;
538 rcClient.bottom = rcClient.top + CurrentSize.cy;
539
540 if (VisibleLines == 2)
541 {
542 /* Display either time and weekday (by default), or time and date (opt-in) */
543 PaintLine(hDC, &rcClient, 0, CLOCKWND_FORMAT_TIME);
544 PaintLine(hDC, &rcClient, 1,
546 }
547 else
548 {
549 for (i = 0, line = 0;
551 i++)
552 {
553 PaintLine(hDC, &rcClient, i, i);
554 line++;
555 }
556 }
557
558 SelectObject(hDC, hPrevFont);
559
560 SetBkMode(hDC, iPrevBkMode);
561 }
562
563 if (wParam == 0)
564 EndPaint(&ps);
565
566 return TRUE;
567}
VOID PaintLine(IN HDC hDC, IN OUT RECT *rcClient, IN UINT LineNumber, IN UINT szLinesIndex)
Definition: trayclock.cpp:569
Definition: parser.c:49
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
#define CLOCKWND_FORMAT_DAY
Definition: trayclock.cpp:42
#define CLOCKWND_FORMAT_TIME
Definition: trayclock.cpp:41
int32_t INT
Definition: typedefs.h:58
#define TRANSPARENT
Definition: wingdi.h:950
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_BTNTEXT
Definition: winuser.h:933
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

◆ OnSetFont()

LRESULT CTrayClockWnd::OnSetFont ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 646 of file trayclock.cpp.

647{
649 return TRUE;
650}
VOID SetFont(IN HFONT hNewFont, IN BOOL bRedraw)
Definition: trayclock.cpp:586
#define LOWORD(l)
Definition: pedump.c:82

◆ OnSize()

LRESULT CTrayClockWnd::OnSize ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 677 of file trayclock.cpp.

678{
679 SIZE szClient;
680
681 szClient.cx = LOWORD(lParam);
682 szClient.cy = HIWORD(lParam);
683
685 CurrentSize = szClient;
686
687 UpdateWnd();
688 return TRUE;
689}
VOID UpdateWnd()
Definition: trayclock.cpp:315
#define HIWORD(l)
Definition: typedefs.h:247

◆ OnTaskbarSettingsChanged()

LRESULT CTrayClockWnd::OnTaskbarSettingsChanged ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 691 of file trayclock.cpp.

692{
693 BOOL bRealign = FALSE;
694
695 TaskbarSettings* newSettings = (TaskbarSettings*)lParam;
696 if (newSettings->bShowSeconds != g_TaskbarSettings.bShowSeconds)
697 {
700 {
701 bRealign = TRUE;
702
703 ResetTime();
704 }
705 }
706
707 if (newSettings->sr.HideClock != g_TaskbarSettings.sr.HideClock)
708 {
711 bRealign = TRUE;
712
714 {
715 /* Disable all timers */
716 if (IsTimerEnabled)
717 {
720 }
721 else if (IsInitTimerEnabled)
722 {
725 }
726 }
727 else
728 {
729 ResetTime();
730 }
731 }
732
733 if (newSettings->bPreferDate != g_TaskbarSettings.bPreferDate)
734 {
736 bRealign = TRUE;
737 }
738
739 if (bRealign)
740 {
741 /* Ask the parent to resize */
742 NMHDR nmh = {GetParent(), 0, NTNWM_REALIGN};
744 Update();
745 }
746 return 0;
747}
#define NTNWM_REALIGN
Definition: precomp.h:370
#define WM_NOTIFY
Definition: richedit.h:61
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_SHOW
Definition: winuser.h:775

◆ OnThemeChanged() [1/2]

LRESULT CTrayClockWnd::OnThemeChanged ( )
private

Definition at line 170 of file trayclock.cpp.

171{
172 LOGFONTW clockFont;
173 HTHEME clockTheme;
174 HFONT hFont;
175
176 clockTheme = OpenThemeData(m_hWnd, L"Clock");
177
178 if (clockTheme)
179 {
180 GetThemeFont(clockTheme, NULL, CLP_TIME, 0, TMT_FONT, &clockFont);
181
182 hFont = CreateFontIndirectW(&clockFont);
183
185
186 if (this->hFont != NULL)
187 DeleteObject(this->hFont);
188
190
191 CloseThemeData(clockTheme);
192 }
193
194 return TRUE;
195}
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LOGFONTW *pFont)
Definition: property.c:108
HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId, int iPropId, COLORREF *pColor)
Definition: property.c:45
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
pKey DeleteObject()
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define TMT_TEXTCOLOR
Definition: vssym32.h:328
@ CLP_TIME
Definition: vssym32.h:526
#define TMT_FONT
Definition: vssym32.h:144
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)

Referenced by OnThemeChanged().

◆ OnThemeChanged() [2/2]

LRESULT CTrayClockWnd::OnThemeChanged ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 197 of file trayclock.cpp.

198{
199 return OnThemeChanged();
200}
LRESULT OnThemeChanged()
Definition: trayclock.cpp:170

◆ OnTimer()

LRESULT CTrayClockWnd::OnTimer ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 619 of file trayclock.cpp.

620{
621 switch (wParam)
622 {
624 Update();
625 break;
626
629 break;
630 }
631 return TRUE;
632}
VOID CalibrateTimer()
Definition: trayclock.cpp:453

◆ PaintLine()

VOID CTrayClockWnd::PaintLine ( IN HDC  hDC,
IN OUT RECT rcClient,
IN UINT  LineNumber,
IN UINT  szLinesIndex 
)
private

Definition at line 569 of file trayclock.cpp.

570{
571 if (LineSizes[LineNumber].cx == 0)
572 return;
573
574 INT HShift = ((IsHorizontal && (VisibleLines <= 1 ||
576
577 TextOut(hDC,
578 ((rcClient->right - LineSizes[szLinesIndex].cx) / 2) + HShift,
579 rcClient->top + TRAY_CLOCK_WND_SPACING_Y,
580 szLines[szLinesIndex],
581 wcslen(szLines[szLinesIndex]));
582
583 rcClient->top += LineSizes[LineNumber].cy + LineSpacing;
584}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1220
BOOL UseCompactTrayIcons()
Definition: precomp.h:229
#define TextOut
Definition: wingdi.h:4483

Referenced by OnPaint().

◆ ResetTime()

BOOL CTrayClockWnd::ResetTime ( )
private

Definition at line 428 of file trayclock.cpp.

429{
430 UINT uiDueTime;
431 BOOL Ret;
432
433 /* Disable all timers */
434 if (IsTimerEnabled)
435 {
438 }
439 else if (IsInitTimerEnabled)
440 {
442 }
443
444 uiDueTime = CalculateDueTime();
445
446 /* Set the new timer */
447 Ret = SetTimer(ID_TRAYCLOCK_TIMER_INIT, uiDueTime, NULL) != 0;
448 IsInitTimerEnabled = Ret;
449
450 return Ret;
451}

Referenced by CalibrateTimer(), OnCreate(), and OnTaskbarSettingsChanged().

◆ SetFont()

VOID CTrayClockWnd::SetFont ( IN HFONT  hNewFont,
IN BOOL  bRedraw 
)
private

Definition at line 586 of file trayclock.cpp.

587{
588 hFont = hNewFont;
590 if (bRedraw)
591 {
593 }
594}
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by OnSetFont(), and OnThemeChanged().

◆ Update()

VOID CTrayClockWnd::Update ( )
private

Definition at line 410 of file trayclock.cpp.

411{
413 UpdateWnd();
414}

Referenced by CalibrateTimer(), OnCreate(), OnTaskbarSettingsChanged(), and OnTimer().

◆ UpdateWnd()

VOID CTrayClockWnd::UpdateWnd ( )
private

Definition at line 315 of file trayclock.cpp.

316{
317 SIZE szPrevCurrent;
318 UINT BufSize, i;
319 INT iRet;
320 RECT rcClient;
321
323
324 szPrevCurrent = CurrentSize;
325
326 for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
327 {
328 szLines[i][0] = L'\0';
330
332 {
335 &LocalTime,
336 ClockWndFormats[i].lpFormat,
337 szLines[i],
338 BufSize);
339 }
340 else
341 {
344 &LocalTime,
346 szLines[i],
347 BufSize);
348 }
349
350 if (iRet != 0 && i == 0)
351 {
352 /* Set the window text to the time only */
354 }
355 }
356
358
359 if (LinesMeasured &&
360 GetClientRect(&rcClient))
361 {
362 SIZE szWnd;
363
364 szWnd.cx = rcClient.right;
365 szWnd.cy = rcClient.bottom;
366
368 CurrentSize = szWnd;
369 }
370
371 if (IsWindowVisible())
372 {
374
375 if (szPrevCurrent.cx != CurrentSize.cx ||
376 szPrevCurrent.cy != CurrentSize.cy)
377 {
378 /* Ask the parent to resize */
379 NMHDR nmh = {GetParent(), 0, NTNWM_REALIGN};
381 }
382 }
383
384 int iDateLength = GetDateFormat(LOCALE_USER_DEFAULT,
386 &LocalTime,
387 NULL,
388 NULL,
389 0);
390 if (iDateLength <= 0)
391 {
392 return;
393 }
394
395 WCHAR* szDate = new WCHAR[iDateLength];
398 &LocalTime,
399 NULL,
400 szDate,
401 iDateLength) > 0)
402 {
404 reinterpret_cast<UINT_PTR>(m_hWnd),
405 szDate);
406 }
407 delete[] szDate;
408}
#define BufSize
Definition: FsRtlTunnel.c:28
VOID UpdateTipText(IN HWND hwndToolOwner, IN UINT uId, IN PCWSTR szText, IN HINSTANCE hinstResourceOwner=NULL)
Definition: rosctrls.h:685
#define LOCALE_USER_DEFAULT
#define _countof(array)
Definition: sndvol32.h:68
LONG right
Definition: windef.h:308
const struct @94 ClockWndFormats[]
DWORD dwFormatFlags
Definition: trayclock.cpp:31
LPCWSTR lpFormat
Definition: trayclock.cpp:32
BOOL IsTime
Definition: trayclock.cpp:30
#define GetTimeFormat
Definition: winnls.h:1189
#define TIME_NOSECONDS
Definition: winnls.h:278
#define DATE_LONGDATE
Definition: winnls.h:197
#define GetDateFormat
Definition: winnls.h:1184
#define SetWindowText
Definition: winuser.h:5857
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by OnSize(), and Update().

Member Data Documentation

◆ 

union { ... } CTrayClockWnd::@96

◆ CurrentSize

SIZE CTrayClockWnd::CurrentSize
private

Definition at line 71 of file trayclock.cpp.

Referenced by CTrayClockWnd(), OnPaint(), OnSize(), and UpdateWnd().

◆ dwFlags

DWORD CTrayClockWnd::dwFlags

Definition at line 61 of file trayclock.cpp.

◆ hFont

HFONT CTrayClockWnd::hFont
private

Definition at line 53 of file trayclock.cpp.

Referenced by MeasureLines(), OnPaint(), OnThemeChanged(), and SetFont().

◆ IsHorizontal

DWORD CTrayClockWnd::IsHorizontal

Definition at line 67 of file trayclock.cpp.

Referenced by Initialize(), OnGetMinimumSize(), OnSize(), PaintLine(), and UpdateWnd().

◆ IsInitTimerEnabled

DWORD CTrayClockWnd::IsInitTimerEnabled

Definition at line 65 of file trayclock.cpp.

Referenced by CalibrateTimer(), OnDestroy(), OnTaskbarSettingsChanged(), and ResetTime().

◆ IsTimerEnabled

DWORD CTrayClockWnd::IsTimerEnabled

Definition at line 64 of file trayclock.cpp.

Referenced by CalibrateTimer(), OnDestroy(), OnTaskbarSettingsChanged(), and ResetTime().

◆ LineSizes

SIZE CTrayClockWnd::LineSizes[CLOCKWND_FORMAT_COUNT]
private

Definition at line 73 of file trayclock.cpp.

Referenced by CTrayClockWnd(), GetMinimumSize(), MeasureLines(), PaintLine(), and UpdateWnd().

◆ LinesMeasured

DWORD CTrayClockWnd::LinesMeasured

Definition at line 66 of file trayclock.cpp.

Referenced by GetMinimumSize(), OnPaint(), SetFont(), and UpdateWnd().

◆ LineSpacing

DWORD CTrayClockWnd::LineSpacing
private

Definition at line 70 of file trayclock.cpp.

Referenced by GetMinimumSize(), MeasureLines(), and PaintLine().

◆ LocalTime

SYSTEMTIME CTrayClockWnd::LocalTime
private

Definition at line 56 of file trayclock.cpp.

Referenced by CalculateDueTime(), CTrayClockWnd(), Update(), and UpdateWnd().

◆ m_tooltip

CTooltips CTrayClockWnd::m_tooltip
private

Definition at line 57 of file trayclock.cpp.

Referenced by OnCreate(), and UpdateWnd().

◆ rcText

RECT CTrayClockWnd::rcText
private

Definition at line 55 of file trayclock.cpp.

Referenced by CTrayClockWnd().

◆ szLines

WCHAR CTrayClockWnd::szLines[CLOCKWND_FORMAT_COUNT][48]
private

Definition at line 74 of file trayclock.cpp.

Referenced by CTrayClockWnd(), MeasureLines(), PaintLine(), and UpdateWnd().

◆ textColor

COLORREF CTrayClockWnd::textColor
private

Definition at line 54 of file trayclock.cpp.

Referenced by OnPaint(), and OnThemeChanged().

◆ VisibleLines

WORD CTrayClockWnd::VisibleLines
private

Definition at line 72 of file trayclock.cpp.

Referenced by GetMinimumSize(), OnPaint(), OnSize(), PaintLine(), and UpdateWnd().


The documentation for this class was generated from the following file: