ReactOS 0.4.17-dev-806-gffa4164
CNotifyToolbar Class Reference
Inheritance diagram for CNotifyToolbar:
Collaboration diagram for CNotifyToolbar:

Public Member Functions

 CNotifyToolbar ()
 
virtual ~CNotifyToolbar ()
 
int GetVisibleButtonCount ()
 
int GetFirstVisibleIndex ()
 
int FindItem (IN HWND hWnd, IN UINT uID, InternalIconData **pdata)
 
int FindExistingSharedIcon (HICON handle)
 
BOOL AddButton (IN CONST NOTIFYICONDATA *iconData)
 
BOOL SwitchVersion (IN CONST NOTIFYICONDATA *iconData)
 
BOOL UpdateButton (IN CONST NOTIFYICONDATA *iconData)
 
BOOL RemoveButton (IN CONST NOTIFYICONDATA *iconData)
 
VOID ResizeImagelist ()
 
bool SendNotifyCallback (InternalIconData *notifyItem, UINT uMsg)
 
void RefreshToolbarMetrics (BOOL bForceRefresh)
 
void Initialize (HWND hWndParent, CBalloonQueue *queue)
 
- Public Member Functions inherited from ATL::CWindowImplBaseT< CToolbar< InternalIconData >, CControlWinTraits >
 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
 

Private Member Functions

LRESULT OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCtxMenu (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
VOID SendMouseEvent (IN WORD wIndex, IN UINT uMsg, IN WPARAM wParam)
 
LRESULT OnMouseEvent (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnTooltipShow (INT uCode, LPNMHDR hdr, BOOL &bHandled)
 

Private Attributes

HIMAGELIST m_ImageList
 
int m_VisibleButtonCount
 
CBalloonQueuem_BalloonQueue
 

Additional Inherited Members

- Public Types inherited from ATL::CWindowImplRoot< TBase >
enum  { WINSTATE_DESTROYED = 0x00000001 }
 
- Static Public Member Functions inherited from ATL::CWindowImplBaseT< CToolbar< InternalIconData >, CControlWinTraits >
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::CWindowImplBaseT< CToolbar< InternalIconData >, CControlWinTraits >
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 151 of file syspager.cpp.

Constructor & Destructor Documentation

◆ CNotifyToolbar()

CNotifyToolbar::CNotifyToolbar ( )

Definition at line 666 of file syspager.cpp.

666 :
670{
671}
HIMAGELIST m_ImageList
Definition: syspager.cpp:154
CBalloonQueue * m_BalloonQueue
Definition: syspager.cpp:157
int m_VisibleButtonCount
Definition: syspager.cpp:155
#define NULL
Definition: types.h:112

◆ ~CNotifyToolbar()

CNotifyToolbar::~CNotifyToolbar ( )
virtual

Definition at line 673 of file syspager.cpp.

674{
675}

Member Function Documentation

◆ AddButton()

BOOL CNotifyToolbar::AddButton ( IN CONST NOTIFYICONDATA iconData)

Definition at line 731 of file syspager.cpp.

732{
733 TBBUTTON tbBtn = { 0 };
734 InternalIconData * notifyItem;
735 WCHAR text[] = L"";
736
737 TRACE("Adding icon %d from hWnd %08x flags%s%s state%s%s\n",
738 iconData->uID, iconData->hWnd,
739 (iconData->uFlags & NIF_ICON) ? " ICON" : "",
740 (iconData->uFlags & NIF_STATE) ? " STATE" : "",
741 (iconData->dwState & NIS_HIDDEN) ? " HIDDEN" : "",
742 (iconData->dwState & NIS_SHAREDICON) ? " SHARED" : "");
743
744 int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
745 if (index >= 0)
746 {
747 TRACE("Icon %d from hWnd %08x ALREADY EXISTS!\n", iconData->uID, iconData->hWnd);
748 return FALSE;
749 }
750
751 notifyItem = new InternalIconData();
752 ZeroMemory(notifyItem, sizeof(*notifyItem));
753
754 notifyItem->hWnd = iconData->hWnd;
755 notifyItem->uID = iconData->uID;
756
757 tbBtn.fsState = TBSTATE_ENABLED;
758 tbBtn.fsStyle = BTNS_NOPREFIX;
759 tbBtn.dwData = (DWORD_PTR)notifyItem;
760 tbBtn.iString = (INT_PTR) text;
761 tbBtn.idCommand = GetButtonCount();
762 tbBtn.iBitmap = -1;
763
764 if (iconData->uFlags & NIF_STATE)
765 {
766 notifyItem->dwState = iconData->dwState & iconData->dwStateMask;
767 }
768
769 if (iconData->uFlags & NIF_MESSAGE)
770 {
771 notifyItem->uCallbackMessage = iconData->uCallbackMessage;
772 }
773
774 if (iconData->uFlags & NIF_ICON)
775 {
776 notifyItem->hIcon = iconData->hIcon;
777 BOOL hasSharedIcon = notifyItem->dwState & NIS_SHAREDICON;
778 if (hasSharedIcon)
779 {
780 INT iIcon = FindExistingSharedIcon(notifyItem->hIcon);
781 if (iIcon < 0)
782 {
783 notifyItem->hIcon = NULL;
784 TRACE("Shared icon requested, but HICON not found!!!\n");
785 }
786 tbBtn.iBitmap = iIcon;
787 }
788 else
789 {
790 tbBtn.iBitmap = ImageList_AddIcon(m_ImageList, notifyItem->hIcon);
791 }
792 }
793
794 if (iconData->uFlags & NIF_TIP)
795 {
796 StringCchCopy(notifyItem->szTip, _countof(notifyItem->szTip), iconData->szTip);
797 }
798
799 if (iconData->uFlags & NIF_INFO)
800 {
801 // NOTE: In Vista+, the uTimeout value is disregarded, and the accessibility settings are used always.
802 StringCchCopy(notifyItem->szInfo, _countof(notifyItem->szInfo), iconData->szInfo);
803 StringCchCopy(notifyItem->szInfoTitle, _countof(notifyItem->szInfoTitle), iconData->szInfoTitle);
804 notifyItem->dwInfoFlags = iconData->dwInfoFlags;
805 notifyItem->uTimeout = iconData->uTimeout;
806 }
807
808 if (notifyItem->dwState & NIS_HIDDEN)
809 {
810 tbBtn.fsState |= TBSTATE_HIDDEN;
811 }
812 else
813 {
815 }
816
817 /* TODO: support VERSION_4 (NIF_GUID, NIF_REALTIME, NIF_SHOWTIP) */
818
819 CToolbar::AddButton(&tbBtn);
821
822 if (iconData->uFlags & NIF_INFO)
823 {
824 m_BalloonQueue->UpdateInfo(notifyItem);
825 }
826
827 return TRUE;
828}
void UpdateInfo(InternalIconData *notifyItem)
Definition: syspager.cpp:558
int FindItem(IN HWND hWnd, IN UINT uID, InternalIconData **pdata)
Definition: syspager.cpp:694
int FindExistingSharedIcon(HICON handle)
Definition: syspager.cpp:714
DWORD AddButton(TBBUTTON *btn)
Definition: rosctrls.h:327
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
const WCHAR * text
Definition: package.c:1794
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint index
Definition: glext.h:6031
#define ZeroMemory
Definition: minwinbase.h:31
short WCHAR
Definition: pedump.c:58
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define BTNS_NOPREFIX
Definition: commctrl.h:1005
#define TBSTATE_HIDDEN
Definition: commctrl.h:975
#define NIF_ICON
Definition: shellapi.h:106
#define NIF_MESSAGE
Definition: shellapi.h:105
#define NIF_TIP
Definition: shellapi.h:107
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
#define StringCchCopy
Definition: strsafe.h:139
CHAR szInfoTitle[64]
Definition: shellapi.h:245
CHAR szInfo[256]
Definition: shellapi.h:240
UINT uCallbackMessage
Definition: shellapi.h:231
DWORD dwInfoFlags
Definition: shellapi.h:246
CHAR szTip[128]
Definition: shellapi.h:237
BYTE fsState
Definition: commctrl.h:951
INT_PTR iString
Definition: commctrl.h:959
int idCommand
Definition: commctrl.h:950
DWORD_PTR dwData
Definition: commctrl.h:958
int iBitmap
Definition: commctrl.h:949
BYTE fsStyle
Definition: commctrl.h:952
#define DWORD_PTR
Definition: treelist.c:76
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
#define SM_CYSMICON
Definition: winuser.h:1024
#define SM_CXSMICON
Definition: winuser.h:1023
int WINAPI GetSystemMetrics(_In_ int)

Referenced by CSysPagerWnd::NotifyIcon().

◆ FindExistingSharedIcon()

int CNotifyToolbar::FindExistingSharedIcon ( HICON  handle)

Definition at line 714 of file syspager.cpp.

715{
716 int count = GetButtonCount();
717 for (int i = 0; i < count; i++)
718 {
719 InternalIconData * data = GetItemData(i);
720 if (data->hIcon == handle)
721 {
722 TBBUTTON btn;
723 GetButton(i, &btn);
724 return btn.iBitmap;
725 }
726 }
727
728 return -1;
729}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
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

Referenced by AddButton(), ResizeImagelist(), and UpdateButton().

◆ FindItem()

int CNotifyToolbar::FindItem ( IN HWND  hWnd,
IN UINT  uID,
InternalIconData **  pdata 
)

Definition at line 694 of file syspager.cpp.

695{
696 int count = GetButtonCount();
697
698 for (int i = 0; i < count; i++)
699 {
700 InternalIconData * data = GetItemData(i);
701
702 if (data->hWnd == hWnd &&
703 data->uID == uID)
704 {
705 if (pdata)
706 *pdata = data;
707 return i;
708 }
709 }
710
711 return -1;
712}
HWND hWnd
Definition: settings.c:17
static PROTOCOLDATA * pdata
Definition: protocol.c:163
_In_ UINT uID
Definition: shlwapi.h:156

Referenced by AddButton(), CSysPagerWnd::NotifyIcon(), RemoveButton(), SwitchVersion(), and UpdateButton().

◆ GetFirstVisibleIndex()

int CNotifyToolbar::GetFirstVisibleIndex ( )

Definition at line 682 of file syspager.cpp.

683{
684 for (UINT i = 0;; ++i)
685 {
687 if (!(state & TBSTATE_HIDDEN))
688 return i;
689 if (state == -1)
690 return state;
691 }
692}
static int state
Definition: maze.c:121
unsigned int UINT
Definition: sysinfo.c:13
#define TB_GETSTATE
Definition: commctrl.h:1055
#define SendMessage
Definition: winuser.h:6009

Referenced by CSysPagerWnd::NotifyIcon().

◆ GetVisibleButtonCount()

int CNotifyToolbar::GetVisibleButtonCount ( )

Definition at line 677 of file syspager.cpp.

678{
680}

Referenced by CSysPagerWnd::GetSize(), and CSysPagerWnd::NotifyIcon().

◆ Initialize()

void CNotifyToolbar::Initialize ( HWND  hWndParent,
CBalloonQueue queue 
)

Definition at line 1257 of file syspager.cpp.

1258{
1260
1261 DWORD styles =
1265
1266 // HACK & FIXME: CORE-18016
1268 m_hWnd = NULL;
1270
1271 // Force the toolbar tooltips window to always show tooltips even if not foreground
1272 HWND tooltipsWnd = (HWND)SendMessageW(TB_GETTOOLTIPS);
1273 if (tooltipsWnd)
1274 {
1275 ::SetWindowLong(tooltipsWnd, GWL_STYLE, ::GetWindowLong(tooltipsWnd, GWL_STYLE) | TTS_ALWAYSTIP);
1276 }
1277
1278 SetWindowTheme(m_hWnd, L"TrayNotify", NULL);
1279
1282
1284
1286}
HWND m_hWnd
Definition: atlwin.h:273
void RefreshToolbarMetrics(BOOL bForceRefresh)
Definition: syspager.cpp:1288
HWND Create(HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
Definition: rosctrls.h:256
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
HANDLE HWND
Definition: compat.h:19
unsigned long DWORD
Definition: ntddk_ex.h:95
static VOID SetImageList(HWND hwnd)
Definition: mplay32.c:238
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define TB_GETTOOLTIPS
Definition: commctrl.h:1138
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define ILC_COLOR32
Definition: commctrl.h:358
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:996
#define CCS_NODIVIDER
Definition: commctrl.h:2253
#define CCS_TOP
Definition: commctrl.h:2247
#define TTS_ALWAYSTIP
Definition: commctrl.h:1757
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define ILC_MASK
Definition: commctrl.h:351
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2251
#define CCS_NORESIZE
Definition: commctrl.h:2250
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:990
Definition: queue.c:179
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
#define SetWindowLong
Definition: winuser.h:6019
#define GetWindowLong
Definition: winuser.h:5962
#define GWL_STYLE
Definition: winuser.h:863
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by CSysPagerWnd::OnCreate().

◆ OnCtxMenu()

LRESULT CNotifyToolbar::OnCtxMenu ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 1060 of file syspager.cpp.

1061{
1062 bHandled = FALSE;
1063
1064 /*
1065 * WM_CONTEXTMENU message can be generated either by the mouse,
1066 * in which case lParam encodes the mouse coordinates where the
1067 * user right-clicked the mouse, or can be generated by (Shift-)F10
1068 * keyboard press, in which case lParam equals -1.
1069 */
1070 INT iBtn = GetHotItem();
1071 if (iBtn < 0)
1072 return 0;
1073
1074 InternalIconData* notifyItem = GetItemData(iBtn);
1075
1076 if (!::IsWindow(notifyItem->hWnd))
1077 return 0;
1078
1079 if (notifyItem->GetVersion() >= NOTIFYICON_VERSION)
1080 {
1081 /* Transmit the WM_CONTEXTMENU message if the notification icon supports it */
1082 ::SendNotifyMessage(notifyItem->hWnd,
1083 notifyItem->uCallbackMessage,
1084 notifyItem->uID,
1086 }
1087 else if (lParam == -1)
1088 {
1089 /*
1090 * Otherwise, and only if the WM_CONTEXTMENU message was generated
1091 * from the keyboard, simulate right-click mouse messages. This is
1092 * not needed if the message came from the mouse because in this
1093 * case the right-click mouse messages were already sent together.
1094 */
1095 ::SendNotifyMessage(notifyItem->hWnd,
1096 notifyItem->uCallbackMessage,
1097 notifyItem->uID,
1099 ::SendNotifyMessage(notifyItem->hWnd,
1100 notifyItem->uCallbackMessage,
1101 notifyItem->uID,
1102 WM_RBUTTONUP);
1103 }
1104
1105 return 0;
1106}
BOOL IsWindow() const
Definition: atlwin.h:947
LPARAM lParam
Definition: combotst.c:139
#define WM_CONTEXTMENU
Definition: richedit.h:64
UINT GetVersion() const
Definition: syspager.cpp:32
#define WM_RBUTTONUP
Definition: winuser.h:1808
#define WM_RBUTTONDOWN
Definition: winuser.h:1807
#define SendNotifyMessage
Definition: winuser.h:6012

◆ OnDestroy()

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

Definition at line 1049 of file syspager.cpp.

1050{
1051 if (m_ImageList)
1052 {
1054 m_ImageList = NULL;
1055 }
1056
1057 return 0;
1058}
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941

◆ OnMouseEvent()

LRESULT CNotifyToolbar::OnMouseEvent ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 1177 of file syspager.cpp.

1178{
1180 INT iBtn = HitTest(&pt);
1181
1182 if (iBtn >= 0)
1183 {
1184 SendMouseEvent(iBtn, uMsg, wParam);
1185 }
1186
1187 bHandled = FALSE;
1188 return FALSE;
1189}
VOID SendMouseEvent(IN WORD wIndex, IN UINT uMsg, IN WPARAM wParam)
Definition: syspager.cpp:1146
WPARAM wParam
Definition: combotst.c:138
#define pt(x, y)
Definition: drawing.c:79
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299

◆ OnTooltipShow()

LRESULT CNotifyToolbar::OnTooltipShow ( INT  uCode,
LPNMHDR  hdr,
BOOL bHandled 
)
private

Definition at line 1204 of file syspager.cpp.

1205{
1206 RECT rcTip, rcItem;
1207 ::GetWindowRect(hdr->hwndFrom, &rcTip);
1208
1209 SIZE szTip = { rcTip.right - rcTip.left, rcTip.bottom - rcTip.top };
1210
1211 INT iBtn = GetHotItem();
1212
1213 if (iBtn >= 0)
1214 {
1215 MONITORINFO monInfo = { 0 };
1216 HMONITOR hMon = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
1217
1218 monInfo.cbSize = sizeof(monInfo);
1219
1220 if (hMon)
1221 GetMonitorInfo(hMon, &monInfo);
1222 else
1223 ::GetWindowRect(GetDesktopWindow(), &monInfo.rcMonitor);
1224
1225 GetItemRect(iBtn, &rcItem);
1226
1227 POINT ptItem = { rcItem.left, rcItem.top };
1228 SIZE szItem = { rcItem.right - rcItem.left, rcItem.bottom - rcItem.top };
1229 ClientToScreen(&ptItem);
1230
1231 ptItem.x += szItem.cx / 2;
1232 ptItem.y -= szTip.cy;
1233
1234 if (ptItem.x + szTip.cx > monInfo.rcMonitor.right)
1235 ptItem.x = monInfo.rcMonitor.right - szTip.cx;
1236
1237 if (ptItem.y + szTip.cy > monInfo.rcMonitor.bottom)
1238 ptItem.y = monInfo.rcMonitor.bottom - szTip.cy;
1239
1240 if (ptItem.x < monInfo.rcMonitor.left)
1241 ptItem.x = monInfo.rcMonitor.left;
1242
1243 if (ptItem.y < monInfo.rcMonitor.top)
1244 ptItem.y = monInfo.rcMonitor.top;
1245
1246 TRACE("ptItem { %d, %d }\n", ptItem.x, ptItem.y);
1247
1248 ::SetWindowPos(hdr->hwndFrom, NULL, ptItem.x, ptItem.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
1249
1250 return TRUE;
1251 }
1252
1253 bHandled = FALSE;
1254 return 0;
1255}
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1288
BOOL GetWindowRect(LPRECT lpRect) const
Definition: atlwin.h:816
BOOL ClientToScreen(LPPOINT lpPoint) const
Definition: atlwin.h:393
char hdr[14]
Definition: iptest.cpp:33
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
RECT rcMonitor
Definition: winuser.h:3893
DWORD cbSize
Definition: winuser.h:3892
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#define GetMonitorInfo
Definition: winuser.h:5957
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define SWP_NOSIZE
Definition: winuser.h:1256
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define SWP_NOZORDER
Definition: winuser.h:1258

◆ RefreshToolbarMetrics()

void CNotifyToolbar::RefreshToolbarMetrics ( BOOL  bForceRefresh = FALSE)

Definition at line 1288 of file syspager.cpp.

1289{
1290 // Toolbar metrics only needs to be refreshed for the automatic setting and first launch
1291 if (g_TaskbarSettings.eCompactTrayIcons == TrayIconsMode::TIM_Default ||
1292 bForceRefresh)
1293 {
1294 TBMETRICS tbm = {sizeof(tbm)};
1296 tbm.cxPad = 1;
1297 tbm.cyPad = 1;
1299 {
1302 }
1303 tbm.cxBarPad = 1;
1304 tbm.cyBarPad = 1;
1305 tbm.cxButtonSpacing = 1;
1306 tbm.cyButtonSpacing = 1;
1307 SetMetrics(&tbm);
1308 }
1309}
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
#define TBMF_BUTTONSPACING
Definition: commctrl.h:1289
#define TBMF_PAD
Definition: commctrl.h:1287
#define TBMF_BARPAD
Definition: commctrl.h:1288
int cyButtonSpacing
Definition: commctrl.h:1299
int cxButtonSpacing
Definition: commctrl.h:1298
int cxBarPad
Definition: commctrl.h:1296
DWORD dwMask
Definition: commctrl.h:1293
int cyBarPad
Definition: commctrl.h:1297
int cyPad
Definition: commctrl.h:1295
int cxPad
Definition: commctrl.h:1294
TrayIconsMode eCompactTrayIcons
Definition: precomp.h:226
BOOL UseCompactTrayIcons()
Definition: precomp.h:232

Referenced by Initialize(), and CSysPagerWnd::OnSize().

◆ RemoveButton()

BOOL CNotifyToolbar::RemoveButton ( IN CONST NOTIFYICONDATA iconData)

Definition at line 958 of file syspager.cpp.

959{
960 InternalIconData * notifyItem;
961
962 TRACE("Removing icon %d from hWnd %08x\n", iconData->uID, iconData->hWnd);
963
964 int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
965 if (index < 0)
966 {
967 TRACE("Icon %d from hWnd %08x ALREADY MISSING!\n", iconData->uID, iconData->hWnd);
968
969 return FALSE;
970 }
971 if (notifyItem->IsRemoved())
972 return FALSE; // Avoid recursion [CORE-20685]
973 else
974 notifyItem->MarkAsRemoved();
975
976 if (!(notifyItem->dwState & NIS_HIDDEN))
977 {
979 }
980
981 if (!(notifyItem->dwState & NIS_SHAREDICON))
982 {
983 TBBUTTON btn;
984 GetButton(index, &btn);
985 int oldIconIndex = btn.iBitmap;
986 ImageList_Remove(m_ImageList, oldIconIndex);
987
988 // Update other icons!
989 int count = GetButtonCount();
990 for (int i = 0; i < count; i++)
991 {
992 TBBUTTON btn;
993 GetButton(i, &btn);
994
995 if (btn.iBitmap > oldIconIndex)
996 {
997 TBBUTTONINFO tbbi2 = { 0 };
998 tbbi2.cbSize = sizeof(tbbi2);
999 tbbi2.dwMask = TBIF_BYINDEX | TBIF_IMAGE;
1000 tbbi2.iImage = btn.iBitmap-1;
1001 SetButtonInfo(i, &tbbi2);
1002 }
1003 }
1004 }
1005
1006 m_BalloonQueue->RemoveInfo(notifyItem);
1007
1008 DeleteButton(index);
1009
1010 delete notifyItem;
1011
1012 return TRUE;
1013}
void RemoveInfo(InternalIconData *notifyItem)
Definition: syspager.cpp:580
BOOL WINAPI ImageList_Remove(HIMAGELIST himl, INT i)
Definition: imagelist.c:2628
#define TBIF_IMAGE
Definition: commctrl.h:1219
#define TBBUTTONINFO
Definition: commctrl.h:1254
#define TBIF_BYINDEX
Definition: commctrl.h:1226
void MarkAsRemoved()
Definition: syspager.cpp:34
BOOL IsRemoved() const
Definition: syspager.cpp:33

Referenced by CSysPagerWnd::NotifyIcon(), and SendNotifyCallback().

◆ ResizeImagelist()

VOID CNotifyToolbar::ResizeImagelist ( )

Definition at line 1015 of file syspager.cpp.

1016{
1017 int cx, cy;
1018 HIMAGELIST iml;
1019
1021 return;
1022
1024 return;
1025
1027 if (!iml)
1028 return;
1029
1031 m_ImageList = iml;
1033
1034 int count = GetButtonCount();
1035 for (int i = 0; i < count; i++)
1036 {
1037 InternalIconData * data = GetItemData(i);
1038 BOOL hasSharedIcon = data->dwState & NIS_SHAREDICON;
1039 INT iIcon = hasSharedIcon ? FindExistingSharedIcon(data->hIcon) : -1;
1040 if (iIcon < 0)
1041 iIcon = ImageList_AddIcon(iml, data->hIcon);
1042 TBBUTTONINFO tbbi = { sizeof(tbbi), TBIF_BYINDEX | TBIF_IMAGE, 0, iIcon};
1043 SetButtonInfo(i, &tbbi);
1044 }
1045
1047}
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2055
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585

Referenced by CSysPagerWnd::OnSettingChanged().

◆ SendMouseEvent()

VOID CNotifyToolbar::SendMouseEvent ( IN WORD  wIndex,
IN UINT  uMsg,
IN WPARAM  wParam 
)
private

Definition at line 1146 of file syspager.cpp.

1147{
1148 static LPCWSTR eventNames [] = {
1149 L"WM_MOUSEMOVE",
1150 L"WM_LBUTTONDOWN",
1151 L"WM_LBUTTONUP",
1152 L"WM_LBUTTONDBLCLK",
1153 L"WM_RBUTTONDOWN",
1154 L"WM_RBUTTONUP",
1155 L"WM_RBUTTONDBLCLK",
1156 L"WM_MBUTTONDOWN",
1157 L"WM_MBUTTONUP",
1158 L"WM_MBUTTONDBLCLK",
1159 L"WM_MOUSEWHEEL",
1160 L"WM_XBUTTONDOWN",
1161 L"WM_XBUTTONUP",
1162 L"WM_XBUTTONDBLCLK"
1163 };
1164
1165 InternalIconData * notifyItem = GetItemData(wIndex);
1166
1167 if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST)
1168 {
1169 TRACE("Sending message %S from button %d to %p (msg=%x, w=%x, l=%x)...\n",
1170 eventNames[uMsg - WM_MOUSEFIRST], wIndex,
1171 notifyItem->hWnd, notifyItem->uCallbackMessage, notifyItem->uID, uMsg);
1172 }
1173
1174 SendNotifyCallback(notifyItem, uMsg);
1175}
bool SendNotifyCallback(InternalIconData *notifyItem, UINT uMsg)
Definition: syspager.cpp:1108
const uint16_t * LPCWSTR
Definition: typedefs.h:57
#define WM_MOUSEFIRST
Definition: winuser.h:1802
#define WM_MOUSELAST
Definition: winuser.h:1829

Referenced by OnMouseEvent().

◆ SendNotifyCallback()

bool CNotifyToolbar::SendNotifyCallback ( InternalIconData notifyItem,
UINT  uMsg 
)

Definition at line 1108 of file syspager.cpp.

1109{
1110 if (!::IsWindow(notifyItem->hWnd))
1111 {
1112 // We detect and destroy icons with invalid handles only on mouse move over systray, same as MS does.
1113 // Alternatively we could search for them periodically (would waste more resources).
1114 TRACE("Destroying icon %d with invalid handle hWnd=%08x\n", notifyItem->uID, notifyItem->hWnd);
1115
1116 RemoveButton(notifyItem);
1117
1118 /* Ask the parent to resize */
1119 NMHDR nmh = {GetParent(), 0, NTNWM_REALIGN};
1120 GetParent().SendMessage(WM_NOTIFY, 0, (LPARAM) &nmh);
1121
1122 return true;
1123 }
1124
1125 DWORD pid;
1126 GetWindowThreadProcessId(notifyItem->hWnd, &pid);
1127
1128 if (pid == GetCurrentProcessId() ||
1129 (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST))
1130 {
1131 ::PostMessage(notifyItem->hWnd,
1132 notifyItem->uCallbackMessage,
1133 notifyItem->uID,
1134 uMsg);
1135 }
1136 else
1137 {
1138 ::SendMessage(notifyItem->hWnd,
1139 notifyItem->uCallbackMessage,
1140 notifyItem->uID,
1141 uMsg);
1142 }
1143 return false;
1144}
#define NTNWM_REALIGN
Definition: precomp.h:384
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1116
CWindow GetParent() const
Definition: atlwin.h:700
BOOL RemoveButton(IN CONST NOTIFYICONDATA *iconData)
Definition: syspager.cpp:958
LONG_PTR LPARAM
Definition: minwindef.h:175
#define WM_NOTIFY
Definition: richedit.h:61
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1205
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define PostMessage
Definition: winuser.h:5998

Referenced by CBalloonQueue::Close(), SendMouseEvent(), and CBalloonQueue::Show().

◆ SwitchVersion()

BOOL CNotifyToolbar::SwitchVersion ( IN CONST NOTIFYICONDATA iconData)

Definition at line 830 of file syspager.cpp.

831{
832 InternalIconData * notifyItem;
833 int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
834 if (index < 0)
835 {
836 WARN("Icon %d from hWnd %08x DOES NOT EXIST!\n", iconData->uID, iconData->hWnd);
837 return FALSE;
838 }
839
840 if (iconData->uVersion != 0 && iconData->uVersion != NOTIFYICON_VERSION)
841 {
842 WARN("Tried to set the version of icon %d from hWnd %08x, to an unknown value %d. Vista+ program?\n", iconData->uID, iconData->hWnd, iconData->uVersion);
843 return FALSE;
844 }
845
846 // We can not store the version in the uVersion field, because it's union'd with uTimeout,
847 // which we also need to keep track of.
848 notifyItem->SaveVersion(iconData->uVersion);
849
850 return TRUE;
851}
#define WARN(fmt,...)
Definition: precomp.h:61
void SaveVersion(UINT Version)
Definition: syspager.cpp:28

Referenced by CSysPagerWnd::NotifyIcon().

◆ UpdateButton()

BOOL CNotifyToolbar::UpdateButton ( IN CONST NOTIFYICONDATA iconData)

Definition at line 853 of file syspager.cpp.

854{
855 InternalIconData * notifyItem;
856 TBBUTTONINFO tbbi = { 0 };
857
858 TRACE("Updating icon %d from hWnd %08x flags%s%s state%s%s\n",
859 iconData->uID, iconData->hWnd,
860 (iconData->uFlags & NIF_ICON) ? " ICON" : "",
861 (iconData->uFlags & NIF_STATE) ? " STATE" : "",
862 (iconData->dwState & NIS_HIDDEN) ? " HIDDEN" : "",
863 (iconData->dwState & NIS_SHAREDICON) ? " SHARED" : "");
864
865 int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
866 if (index < 0)
867 {
868 WARN("Icon %d from hWnd %08x DOES NOT EXIST!\n", iconData->uID, iconData->hWnd);
869 return FALSE;
870 }
871
872 TBBUTTON btn;
873 GetButton(index, &btn);
874 int oldIconIndex = btn.iBitmap;
875
876 tbbi.cbSize = sizeof(tbbi);
877 tbbi.dwMask = TBIF_BYINDEX | TBIF_COMMAND;
878 tbbi.idCommand = index;
879
880 if (iconData->uFlags & NIF_STATE)
881 {
882 if (iconData->dwStateMask & NIS_HIDDEN &&
883 (notifyItem->dwState & NIS_HIDDEN) != (iconData->dwState & NIS_HIDDEN))
884 {
885 tbbi.dwMask |= TBIF_STATE;
886 if (iconData->dwState & NIS_HIDDEN)
887 {
888 tbbi.fsState |= TBSTATE_HIDDEN;
890 }
891 else
892 {
893 tbbi.fsState &= ~TBSTATE_HIDDEN;
895 }
896 }
897
898 notifyItem->dwState &= ~iconData->dwStateMask;
899 notifyItem->dwState |= (iconData->dwState & iconData->dwStateMask);
900 }
901
902 if (iconData->uFlags & NIF_MESSAGE)
903 {
904 notifyItem->uCallbackMessage = iconData->uCallbackMessage;
905 }
906
907 if (iconData->uFlags & NIF_ICON)
908 {
909 BOOL hasSharedIcon = notifyItem->dwState & NIS_SHAREDICON;
910 if (hasSharedIcon)
911 {
912 INT iIcon = FindExistingSharedIcon(iconData->hIcon);
913 if (iIcon >= 0)
914 {
915 notifyItem->hIcon = iconData->hIcon;
916 tbbi.dwMask |= TBIF_IMAGE;
917 tbbi.iImage = iIcon;
918 }
919 else
920 {
921 TRACE("Shared icon requested, but HICON not found!!! IGNORING!\n");
922 }
923 }
924 else
925 {
926 notifyItem->hIcon = iconData->hIcon;
927 tbbi.dwMask |= TBIF_IMAGE;
928 tbbi.iImage = ImageList_ReplaceIcon(m_ImageList, oldIconIndex, notifyItem->hIcon);
929 }
930 }
931
932 if (iconData->uFlags & NIF_TIP)
933 {
934 StringCchCopy(notifyItem->szTip, _countof(notifyItem->szTip), iconData->szTip);
935 }
936
937 if (iconData->uFlags & NIF_INFO)
938 {
939 // NOTE: In Vista+, the uTimeout value is disregarded, and the accessibility settings are used always.
940 StringCchCopy(notifyItem->szInfo, _countof(notifyItem->szInfo), iconData->szInfo);
941 StringCchCopy(notifyItem->szInfoTitle, _countof(notifyItem->szInfoTitle), iconData->szInfoTitle);
942 notifyItem->dwInfoFlags = iconData->dwInfoFlags;
943 notifyItem->uTimeout = iconData->uTimeout;
944 }
945
946 /* TODO: support VERSION_4 (NIF_GUID, NIF_REALTIME, NIF_SHOWTIP) */
947
948 SetButtonInfo(index, &tbbi);
949
950 if (iconData->uFlags & NIF_INFO)
951 {
952 m_BalloonQueue->UpdateInfo(notifyItem);
953 }
954
955 return TRUE;
956}
#define index(s, c)
Definition: various.h:29
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2839
#define TBIF_COMMAND
Definition: commctrl.h:1224
#define TBIF_STATE
Definition: commctrl.h:1221

Referenced by CSysPagerWnd::NotifyIcon().

Member Data Documentation

◆ m_BalloonQueue

CBalloonQueue* CNotifyToolbar::m_BalloonQueue
private

Definition at line 157 of file syspager.cpp.

Referenced by AddButton(), Initialize(), RemoveButton(), and UpdateButton().

◆ m_ImageList

HIMAGELIST CNotifyToolbar::m_ImageList
private

◆ m_VisibleButtonCount

int CNotifyToolbar::m_VisibleButtonCount
private

Definition at line 155 of file syspager.cpp.

Referenced by AddButton(), GetVisibleButtonCount(), RemoveButton(), and UpdateButton().


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