ReactOS  0.4.15-dev-499-g1f31905
CNotifyToolbar Class Reference
Inheritance diagram for CNotifyToolbar:
Collaboration diagram for CNotifyToolbar:

Public Member Functions

 CNotifyToolbar ()
 
virtual ~CNotifyToolbar ()
 
int GetVisibleButtonCount ()
 
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 Initialize (HWND hWndParent, CBalloonQueue *queue)
 
- Public Member Functions inherited from ATL::CWindowImplBaseT< CToolbar< InternalIconData >, CControlWinTraits >
 CWindowImplBaseT ()
 
virtual void OnFinalMessage (HWND)
 
BOOL SubclassWindow (HWND hWnd)
 
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< CToolbar< InternalIconData > >
 CWindowImplRoot ()
 
virtual ~CWindowImplRoot ()
 
- Public Member Functions inherited from CToolbar< InternalIconData >
HWND Create (HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
 
DWORD SetButtonStructSize ()
 
HWND GetTooltip ()
 
DWORD SetTooltip (HWND hWndTooltip)
 
INT GetHotItem ()
 
DWORD SetHotItem (INT item)
 
DWORD SetDrawTextFlags (DWORD useBits, DWORD bitState)
 
int GetButtonCount ()
 
DWORD GetButton (int index, TBBUTTON *btn)
 
DWORD AddButton (TBBUTTON *btn)
 
DWORD AddButtons (int count, TBBUTTON *buttons)
 
DWORD InsertButton (int insertAt, TBBUTTON *btn)
 
DWORD MoveButton (int oldIndex, int newIndex)
 
DWORD DeleteButton (int index)
 
DWORD GetButtonInfo (int cmdId, TBBUTTONINFO *info)
 
DWORD SetButtonInfo (int cmdId, TBBUTTONINFO *info)
 
DWORD CheckButton (int cmdId, BOOL bCheck)
 
DWORD GetButtonSize ()
 
DWORD SetButtonSize (int w, int h)
 
DWORD AutoSize ()
 
DWORD GetMaxSize (LPSIZE size)
 
DWORD GetIdealSize (BOOL useHeight, LPSIZE size)
 
DWORD GetMetrics (TBMETRICS *tbm)
 
DWORD SetMetrics (TBMETRICS *tbm)
 
DWORD GetItemRect (int index, LPRECT prcItem)
 
DWORD SetRedraw (BOOL bEnable)
 
DWORD GetPadding ()
 
DWORD SetPadding (int x, int y)
 
HIMAGELIST SetImageList (HIMAGELIST himl)
 
INT HitTest (PPOINT ppt)
 
InternalIconDataGetItemData (int index)
 
DWORD SetItemData (int index, InternalIconData *data)
 
- 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 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< CToolbar< InternalIconData > >
enum  
 
- 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)
 
- Public Attributes inherited from ATL::CWindowImplBaseT< CToolbar< InternalIconData >, CControlWinTraits >
WNDPROC m_pfnSuperWindowProc
 
- Public Attributes inherited from ATL::CWindowImplRoot< CToolbar< InternalIconData > >
CWndProcThunk m_thunk
 
const _ATL_MSGm_pCurrentMsg
 
DWORD m_dwState
 

Detailed Description

Definition at line 145 of file syspager.cpp.

Constructor & Destructor Documentation

◆ CNotifyToolbar()

CNotifyToolbar::CNotifyToolbar ( )

Definition at line 661 of file syspager.cpp.

661  :
662  m_ImageList(NULL),
665 {
666 }
int m_VisibleButtonCount
Definition: syspager.cpp:149
smooth NULL
Definition: ftsmooth.c:416
CBalloonQueue * m_BalloonQueue
Definition: syspager.cpp:151
HIMAGELIST m_ImageList
Definition: syspager.cpp:148

◆ ~CNotifyToolbar()

CNotifyToolbar::~CNotifyToolbar ( )
virtual

Definition at line 668 of file syspager.cpp.

669 {
670 }

Member Function Documentation

◆ AddButton()

BOOL CNotifyToolbar::AddButton ( IN CONST NOTIFYICONDATA iconData)

Definition at line 714 of file syspager.cpp.

715 {
716  TBBUTTON tbBtn = { 0 };
717  InternalIconData * notifyItem;
718  WCHAR text[] = L"";
719 
720  TRACE("Adding icon %d from hWnd %08x flags%s%s state%s%s",
721  iconData->uID, iconData->hWnd,
722  (iconData->uFlags & NIF_ICON) ? " ICON" : "",
723  (iconData->uFlags & NIF_STATE) ? " STATE" : "",
724  (iconData->dwState & NIS_HIDDEN) ? " HIDDEN" : "",
725  (iconData->dwState & NIS_SHAREDICON) ? " SHARED" : "");
726 
727  int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
728  if (index >= 0)
729  {
730  TRACE("Icon %d from hWnd %08x ALREADY EXISTS!", iconData->uID, iconData->hWnd);
731  return FALSE;
732  }
733 
734  notifyItem = new InternalIconData();
735  ZeroMemory(notifyItem, sizeof(*notifyItem));
736 
737  notifyItem->hWnd = iconData->hWnd;
738  notifyItem->uID = iconData->uID;
739 
740  tbBtn.fsState = TBSTATE_ENABLED;
741  tbBtn.fsStyle = BTNS_NOPREFIX;
742  tbBtn.dwData = (DWORD_PTR)notifyItem;
743  tbBtn.iString = (INT_PTR) text;
744  tbBtn.idCommand = GetButtonCount();
745  tbBtn.iBitmap = -1;
746 
747  if (iconData->uFlags & NIF_STATE)
748  {
749  notifyItem->dwState = iconData->dwState & iconData->dwStateMask;
750  }
751 
752  if (iconData->uFlags & NIF_MESSAGE)
753  {
754  notifyItem->uCallbackMessage = iconData->uCallbackMessage;
755  }
756 
757  if (iconData->uFlags & NIF_ICON)
758  {
759  notifyItem->hIcon = iconData->hIcon;
760  BOOL hasSharedIcon = notifyItem->dwState & NIS_SHAREDICON;
761  if (hasSharedIcon)
762  {
763  INT iIcon = FindExistingSharedIcon(notifyItem->hIcon);
764  if (iIcon < 0)
765  {
766  notifyItem->hIcon = NULL;
767  TRACE("Shared icon requested, but HICON not found!!!");
768  }
769  tbBtn.iBitmap = iIcon;
770  }
771  else
772  {
773  tbBtn.iBitmap = ImageList_AddIcon(m_ImageList, notifyItem->hIcon);
774  }
775  }
776 
777  if (iconData->uFlags & NIF_TIP)
778  {
779  StringCchCopy(notifyItem->szTip, _countof(notifyItem->szTip), iconData->szTip);
780  }
781 
782  if (iconData->uFlags & NIF_INFO)
783  {
784  // NOTE: In Vista+, the uTimeout value is disregarded, and the accessibility settings are used always.
785  StringCchCopy(notifyItem->szInfo, _countof(notifyItem->szInfo), iconData->szInfo);
786  StringCchCopy(notifyItem->szInfoTitle, _countof(notifyItem->szInfoTitle), iconData->szInfoTitle);
787  notifyItem->dwInfoFlags = iconData->dwInfoFlags;
788  notifyItem->uTimeout = iconData->uTimeout;
789  }
790 
791  if (notifyItem->dwState & NIS_HIDDEN)
792  {
793  tbBtn.fsState |= TBSTATE_HIDDEN;
794  }
795  else
796  {
798  }
799 
800  /* TODO: support VERSION_4 (NIF_GUID, NIF_REALTIME, NIF_SHOWTIP) */
801 
802  CToolbar::AddButton(&tbBtn);
804 
805  if (iconData->uFlags & NIF_INFO)
806  {
807  m_BalloonQueue->UpdateInfo(notifyItem);
808  }
809 
810  return TRUE;
811 }
#define BTNS_NOPREFIX
Definition: commctrl.h:1001
#define NIF_MESSAGE
Definition: shellapi.h:102
#define TRUE
Definition: types.h:120
void UpdateInfo(InternalIconData *notifyItem)
Definition: syspager.cpp:551
#define DWORD_PTR
Definition: treelist.c:76
const WCHAR * text
Definition: package.c:1827
DWORD dwInfoFlags
Definition: shellapi.h:244
#define ZeroMemory
Definition: winbase.h:1648
#define SM_CYSMICON
Definition: winuser.h:1003
int32_t INT_PTR
Definition: typedefs.h:63
BYTE fsStyle
Definition: commctrl.h:948
int32_t INT
Definition: typedefs.h:57
int m_VisibleButtonCount
Definition: syspager.cpp:149
unsigned int BOOL
Definition: ntddk_ex.h:94
CHAR szTip[128]
Definition: shellapi.h:235
#define NIF_TIP
Definition: shellapi.h:104
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
INT_PTR iString
Definition: commctrl.h:955
#define NIF_ICON
Definition: shellapi.h:103
DWORD_PTR dwData
Definition: commctrl.h:954
int iBitmap
Definition: commctrl.h:945
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
int FindExistingSharedIcon(HICON handle)
Definition: syspager.cpp:697
int WINAPI GetSystemMetrics(_In_ int)
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
#define SM_CXSMICON
Definition: winuser.h:1002
static const WCHAR L[]
Definition: oid.c:1250
#define StringCchCopy
Definition: strsafe.h:139
int idCommand
Definition: commctrl.h:946
CBalloonQueue * m_BalloonQueue
Definition: syspager.cpp:151
HIMAGELIST m_ImageList
Definition: syspager.cpp:148
UINT uCallbackMessage
Definition: shellapi.h:229
DWORD SetButtonSize(int w, int h)
Definition: rosctrls.h:371
int FindItem(IN HWND hWnd, IN UINT uID, InternalIconData **pdata)
Definition: syspager.cpp:677
CHAR szInfo[256]
Definition: shellapi.h:238
#define TBSTATE_HIDDEN
Definition: commctrl.h:971
#define TBSTATE_ENABLED
Definition: commctrl.h:970
BYTE fsState
Definition: commctrl.h:947
CHAR szInfoTitle[64]
Definition: shellapi.h:243
DWORD AddButton(TBBUTTON *btn)
Definition: rosctrls.h:325

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

◆ FindExistingSharedIcon()

int CNotifyToolbar::FindExistingSharedIcon ( HICON  handle)

Definition at line 697 of file syspager.cpp.

698 {
699  int count = GetButtonCount();
700  for (int i = 0; i < count; i++)
701  {
703  if (data->hIcon == handle)
704  {
705  TBBUTTON btn;
706  GetButton(i, &btn);
707  return btn.iBitmap;
708  }
709  }
710 
711  return -1;
712 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
InternalIconData * GetItemData(int index)
Definition: rosctrls.h:434
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
int iBitmap
Definition: commctrl.h:945
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
DWORD GetButton(int index, TBBUTTON *btn)
Definition: rosctrls.h:320

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

◆ FindItem()

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

Definition at line 677 of file syspager.cpp.

678 {
679  int count = GetButtonCount();
680 
681  for (int i = 0; i < count; i++)
682  {
684 
685  if (data->hWnd == hWnd &&
686  data->uID == uID)
687  {
688  if (pdata)
689  *pdata = data;
690  return i;
691  }
692  }
693 
694  return -1;
695 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
HWND hWnd
Definition: settings.c:17
InternalIconData * GetItemData(int index)
Definition: rosctrls.h:434
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
static PROTOCOLDATA * pdata
Definition: protocol.c:158
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

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

◆ GetVisibleButtonCount()

int CNotifyToolbar::GetVisibleButtonCount ( )

Definition at line 672 of file syspager.cpp.

673 {
674  return m_VisibleButtonCount;
675 }
int m_VisibleButtonCount
Definition: syspager.cpp:149

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

◆ Initialize()

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

Definition at line 1225 of file syspager.cpp.

1226 {
1228 
1229  DWORD styles =
1233 
1235 
1236  // Force the toolbar tooltips window to always show tooltips even if not foreground
1237  HWND tooltipsWnd = (HWND)SendMessageW(TB_GETTOOLTIPS);
1238  if (tooltipsWnd)
1239  {
1240  ::SetWindowLong(tooltipsWnd, GWL_STYLE, ::GetWindowLong(tooltipsWnd, GWL_STYLE) | TTS_ALWAYSTIP);
1241  }
1242 
1243  SetWindowTheme(m_hWnd, L"TrayNotify", NULL);
1244 
1247 
1248  TBMETRICS tbm = {sizeof(tbm)};
1250  tbm.cxPad = 1;
1251  tbm.cyPad = 1;
1252  tbm.cxBarPad = 1;
1253  tbm.cyBarPad = 1;
1254  tbm.cxButtonSpacing = 1;
1255  tbm.cyButtonSpacing = 1;
1256  SetMetrics(&tbm);
1257 
1259 }
HWND Create(HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
Definition: rosctrls.h:254
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:992
HANDLE HWND
Definition: compat.h:13
#define SM_CYSMICON
Definition: winuser.h:1003
#define SetWindowLong
Definition: winuser.h:5828
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define ILC_COLOR32
Definition: commctrl.h:354
#define CCS_NODIVIDER
Definition: commctrl.h:2244
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define TTS_ALWAYSTIP
Definition: commctrl.h:1753
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
#define TBMF_BUTTONSPACING
Definition: commctrl.h:1285
Definition: _queue.h:59
smooth NULL
Definition: ftsmooth.c:416
#define CCS_TOP
Definition: commctrl.h:2238
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2242
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:422
int cyButtonSpacing
Definition: commctrl.h:1295
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:985
DWORD SetMetrics(TBMETRICS *tbm)
Definition: rosctrls.h:396
#define SM_CXSMICON
Definition: winuser.h:1002
#define CCS_NORESIZE
Definition: commctrl.h:2241
int cxPad
Definition: commctrl.h:1290
int cyPad
Definition: commctrl.h:1291
static const WCHAR L[]
Definition: oid.c:1250
#define GetWindowLong
Definition: winuser.h:5771
#define TB_GETTOOLTIPS
Definition: commctrl.h:1134
#define ILC_MASK
Definition: commctrl.h:347
CBalloonQueue * m_BalloonQueue
Definition: syspager.cpp:151
HIMAGELIST m_ImageList
Definition: syspager.cpp:148
DWORD SetButtonSize(int w, int h)
Definition: rosctrls.h:371
#define GWL_STYLE
Definition: winuser.h:846
int cxBarPad
Definition: commctrl.h:1292
#define TBMF_BARPAD
Definition: commctrl.h:1284
int cxButtonSpacing
Definition: commctrl.h:1294
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBMF_PAD
Definition: commctrl.h:1283
DWORD dwMask
Definition: commctrl.h:1289
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:986
int cyBarPad
Definition: commctrl.h:1293
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_FLAT
Definition: commctrl.h:988

Referenced by CSysPagerWnd::OnCreate().

◆ OnCtxMenu()

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

Definition at line 1028 of file syspager.cpp.

1029 {
1030  bHandled = FALSE;
1031 
1032  /*
1033  * WM_CONTEXTMENU message can be generated either by the mouse,
1034  * in which case lParam encodes the mouse coordinates where the
1035  * user right-clicked the mouse, or can be generated by (Shift-)F10
1036  * keyboard press, in which case lParam equals -1.
1037  */
1038  INT iBtn = GetHotItem();
1039  if (iBtn < 0)
1040  return 0;
1041 
1042  InternalIconData* notifyItem = GetItemData(iBtn);
1043 
1044  if (!::IsWindow(notifyItem->hWnd))
1045  return 0;
1046 
1047  if (notifyItem->uVersionCopy >= NOTIFYICON_VERSION)
1048  {
1049  /* Transmit the WM_CONTEXTMENU message if the notification icon supports it */
1050  ::SendNotifyMessage(notifyItem->hWnd,
1051  notifyItem->uCallbackMessage,
1052  notifyItem->uID,
1053  WM_CONTEXTMENU);
1054  }
1055  else if (lParam == -1)
1056  {
1057  /*
1058  * Otherwise, and only if the WM_CONTEXTMENU message was generated
1059  * from the keyboard, simulate right-click mouse messages. This is
1060  * not needed if the message came from the mouse because in this
1061  * case the right-click mouse messages were already sent together.
1062  */
1063  ::SendNotifyMessage(notifyItem->hWnd,
1064  notifyItem->uCallbackMessage,
1065  notifyItem->uID,
1066  WM_RBUTTONDOWN);
1067  ::SendNotifyMessage(notifyItem->hWnd,
1068  notifyItem->uCallbackMessage,
1069  notifyItem->uID,
1070  WM_RBUTTONUP);
1071  }
1072 
1073  return 0;
1074 }
#define WM_CONTEXTMENU
Definition: richedit.h:64
BOOL WINAPI IsWindow(_In_opt_ HWND)
InternalIconData * GetItemData(int index)
Definition: rosctrls.h:434
int32_t INT
Definition: typedefs.h:57
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
#define WM_RBUTTONUP
Definition: winuser.h:1762
UINT uCallbackMessage
Definition: shellapi.h:229
LPARAM lParam
Definition: combotst.c:139
#define SendNotifyMessage
Definition: winuser.h:5821

◆ OnMouseEvent()

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

Definition at line 1145 of file syspager.cpp.

1146 {
1148  INT iBtn = HitTest(&pt);
1149 
1150  if (iBtn >= 0)
1151  {
1152  SendMouseEvent(iBtn, uMsg, wParam);
1153  }
1154 
1155  bHandled = FALSE;
1156  return FALSE;
1157 }
INT HitTest(PPOINT ppt)
Definition: rosctrls.h:428
UINT uMsg
Definition: menu.cpp:213
#define pt(x, y)
Definition: drawing.c:79
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
int32_t INT
Definition: typedefs.h:57
WPARAM wParam
Definition: combotst.c:138
VOID SendMouseEvent(IN WORD wIndex, IN UINT uMsg, IN WPARAM wParam)
Definition: syspager.cpp:1114
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
LPARAM lParam
Definition: combotst.c:139

◆ OnTooltipShow()

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

Definition at line 1172 of file syspager.cpp.

1173 {
1174  RECT rcTip, rcItem;
1175  ::GetWindowRect(hdr->hwndFrom, &rcTip);
1176 
1177  SIZE szTip = { rcTip.right - rcTip.left, rcTip.bottom - rcTip.top };
1178 
1179  INT iBtn = GetHotItem();
1180 
1181  if (iBtn >= 0)
1182  {
1183  MONITORINFO monInfo = { 0 };
1184  HMONITOR hMon = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
1185 
1186  monInfo.cbSize = sizeof(monInfo);
1187 
1188  if (hMon)
1189  GetMonitorInfo(hMon, &monInfo);
1190  else
1192 
1193  GetItemRect(iBtn, &rcItem);
1194 
1195  POINT ptItem = { rcItem.left, rcItem.top };
1196  SIZE szItem = { rcItem.right - rcItem.left, rcItem.bottom - rcItem.top };
1197  ClientToScreen(&ptItem);
1198 
1199  ptItem.x += szItem.cx / 2;
1200  ptItem.y -= szTip.cy;
1201 
1202  if (ptItem.x + szTip.cx > monInfo.rcMonitor.right)
1203  ptItem.x = monInfo.rcMonitor.right - szTip.cx;
1204 
1205  if (ptItem.y + szTip.cy > monInfo.rcMonitor.bottom)
1206  ptItem.y = monInfo.rcMonitor.bottom - szTip.cy;
1207 
1208  if (ptItem.x < monInfo.rcMonitor.left)
1209  ptItem.x = monInfo.rcMonitor.left;
1210 
1211  if (ptItem.y < monInfo.rcMonitor.top)
1212  ptItem.y = monInfo.rcMonitor.top;
1213 
1214  TRACE("ptItem { %d, %d }\n", ptItem.x, ptItem.y);
1215 
1216  ::SetWindowPos(hdr->hwndFrom, NULL, ptItem.x, ptItem.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
1217 
1218  return TRUE;
1219  }
1220 
1221  bHandled = FALSE;
1222  return 0;
1223 }
#define TRUE
Definition: types.h:120
char hdr[14]
Definition: iptest.cpp:33
long y
Definition: polytest.cpp:48
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
long x
Definition: polytest.cpp:48
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:308
RECT rcMonitor
Definition: winuser.h:3760
int32_t INT
Definition: typedefs.h:57
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LONG cx
Definition: windef.h:334
DWORD GetItemRect(int index, LPRECT prcItem)
Definition: rosctrls.h:401
#define GetMonitorInfo
Definition: winuser.h:5766
#define TRACE(s)
Definition: solgame.cpp:4
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define SWP_NOSIZE
Definition: winuser.h:1230
DWORD cbSize
Definition: winuser.h:3759
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LONG cy
Definition: windef.h:335

◆ RemoveButton()

BOOL CNotifyToolbar::RemoveButton ( IN CONST NOTIFYICONDATA iconData)

Definition at line 941 of file syspager.cpp.

942 {
943  InternalIconData * notifyItem;
944 
945  TRACE("Removing icon %d from hWnd %08x", iconData->uID, iconData->hWnd);
946 
947  int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
948  if (index < 0)
949  {
950  TRACE("Icon %d from hWnd %08x ALREADY MISSING!\n", iconData->uID, iconData->hWnd);
951 
952  return FALSE;
953  }
954 
955  if (!(notifyItem->dwState & NIS_HIDDEN))
956  {
958  }
959 
960  if (!(notifyItem->dwState & NIS_SHAREDICON))
961  {
962  TBBUTTON btn;
963  GetButton(index, &btn);
964  int oldIconIndex = btn.iBitmap;
965  ImageList_Remove(m_ImageList, oldIconIndex);
966 
967  // Update other icons!
968  int count = GetButtonCount();
969  for (int i = 0; i < count; i++)
970  {
971  TBBUTTON btn;
972  GetButton(i, &btn);
973 
974  if (btn.iBitmap > oldIconIndex)
975  {
976  TBBUTTONINFO tbbi2 = { 0 };
977  tbbi2.cbSize = sizeof(tbbi2);
978  tbbi2.dwMask = TBIF_BYINDEX | TBIF_IMAGE;
979  tbbi2.iImage = btn.iBitmap-1;
980  SetButtonInfo(i, &tbbi2);
981  }
982  }
983  }
984 
985  m_BalloonQueue->RemoveInfo(notifyItem);
986 
988 
989  delete notifyItem;
990 
991  return TRUE;
992 }
#define TRUE
Definition: types.h:120
#define TBIF_BYINDEX
Definition: commctrl.h:1222
GLuint GLuint GLsizei count
Definition: gl.h:1545
DWORD DeleteButton(int index)
Definition: rosctrls.h:345
#define TBIF_IMAGE
Definition: commctrl.h:1215
int m_VisibleButtonCount
Definition: syspager.cpp:149
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
GLuint index
Definition: glext.h:6031
int iBitmap
Definition: commctrl.h:945
#define TRACE(s)
Definition: solgame.cpp:4
void RemoveInfo(InternalIconData *notifyItem)
Definition: syspager.cpp:575
BOOL WINAPI ImageList_Remove(HIMAGELIST himl, INT i)
Definition: imagelist.c:2568
CBalloonQueue * m_BalloonQueue
Definition: syspager.cpp:151
HIMAGELIST m_ImageList
Definition: syspager.cpp:148
int FindItem(IN HWND hWnd, IN UINT uID, InternalIconData **pdata)
Definition: syspager.cpp:677
DWORD SetButtonInfo(int cmdId, TBBUTTONINFO *info)
Definition: rosctrls.h:355
#define TBBUTTONINFO
Definition: commctrl.h:1250
DWORD GetButton(int index, TBBUTTON *btn)
Definition: rosctrls.h:320

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

◆ ResizeImagelist()

VOID CNotifyToolbar::ResizeImagelist ( )

Definition at line 994 of file syspager.cpp.

995 {
996  int cx, cy;
997  HIMAGELIST iml;
998 
1000  return;
1001 
1003  return;
1004 
1006  if (!iml)
1007  return;
1008 
1010  m_ImageList = iml;
1012 
1013  int count = GetButtonCount();
1014  for (int i = 0; i < count; i++)
1015  {
1017  BOOL hasSharedIcon = data->dwState & NIS_SHAREDICON;
1018  INT iIcon = hasSharedIcon ? FindExistingSharedIcon(data->hIcon) : -1;
1019  if (iIcon < 0)
1020  iIcon = ImageList_AddIcon(iml, data->hIcon);
1021  TBBUTTONINFO tbbi = { sizeof(tbbi), TBIF_BYINDEX | TBIF_IMAGE, 0, iIcon};
1022  SetButtonInfo(i, &tbbi);
1023  }
1024 
1026 }
#define TBIF_BYINDEX
Definition: commctrl.h:1222
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define SM_CYSMICON
Definition: winuser.h:1003
InternalIconData * GetItemData(int index)
Definition: rosctrls.h:434
int32_t INT
Definition: typedefs.h:57
#define TBIF_IMAGE
Definition: commctrl.h:1215
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define ILC_COLOR32
Definition: commctrl.h:354
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
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
unsigned int BOOL
Definition: ntddk_ex.h:94
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:422
int FindExistingSharedIcon(HICON handle)
Definition: syspager.cpp:697
int WINAPI GetSystemMetrics(_In_ int)
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define SM_CXSMICON
Definition: winuser.h:1002
#define ILC_MASK
Definition: commctrl.h:347
HIMAGELIST m_ImageList
Definition: syspager.cpp:148
DWORD SetButtonSize(int w, int h)
Definition: rosctrls.h:371
_Out_opt_ int * cx
Definition: commctrl.h:581
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
DWORD SetButtonInfo(int cmdId, TBBUTTONINFO *info)
Definition: rosctrls.h:355
#define TBBUTTONINFO
Definition: commctrl.h:1250

Referenced by CSysPagerWnd::OnSettingChanged().

◆ SendMouseEvent()

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

Definition at line 1114 of file syspager.cpp.

1115 {
1116  static LPCWSTR eventNames [] = {
1117  L"WM_MOUSEMOVE",
1118  L"WM_LBUTTONDOWN",
1119  L"WM_LBUTTONUP",
1120  L"WM_LBUTTONDBLCLK",
1121  L"WM_RBUTTONDOWN",
1122  L"WM_RBUTTONUP",
1123  L"WM_RBUTTONDBLCLK",
1124  L"WM_MBUTTONDOWN",
1125  L"WM_MBUTTONUP",
1126  L"WM_MBUTTONDBLCLK",
1127  L"WM_MOUSEWHEEL",
1128  L"WM_XBUTTONDOWN",
1129  L"WM_XBUTTONUP",
1130  L"WM_XBUTTONDBLCLK"
1131  };
1132 
1133  InternalIconData * notifyItem = GetItemData(wIndex);
1134 
1135  if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST)
1136  {
1137  TRACE("Sending message %S from button %d to %p (msg=%x, w=%x, l=%x)...\n",
1138  eventNames[uMsg - WM_MOUSEFIRST], wIndex,
1139  notifyItem->hWnd, notifyItem->uCallbackMessage, notifyItem->uID, uMsg);
1140  }
1141 
1142  SendNotifyCallback(notifyItem, uMsg);
1143 }
#define WM_MOUSEFIRST
Definition: winuser.h:1756
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
UINT uMsg
Definition: menu.cpp:213
InternalIconData * GetItemData(int index)
Definition: rosctrls.h:434
bool SendNotifyCallback(InternalIconData *notifyItem, UINT uMsg)
Definition: syspager.cpp:1076
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_MOUSELAST
Definition: winuser.h:1783
static const WCHAR L[]
Definition: oid.c:1250
UINT uCallbackMessage
Definition: shellapi.h:229

Referenced by OnMouseEvent().

◆ SendNotifyCallback()

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

Definition at line 1076 of file syspager.cpp.

1077 {
1078  if (!::IsWindow(notifyItem->hWnd))
1079  {
1080  // We detect and destroy icons with invalid handles only on mouse move over systray, same as MS does.
1081  // Alternatively we could search for them periodically (would waste more resources).
1082  TRACE("Destroying icon %d with invalid handle hWnd=%08x\n", notifyItem->uID, notifyItem->hWnd);
1083 
1084  RemoveButton(notifyItem);
1085 
1086  /* Ask the parent to resize */
1087  NMHDR nmh = {GetParent(), 0, NTNWM_REALIGN};
1088  GetParent().SendMessage(WM_NOTIFY, 0, (LPARAM) &nmh);
1089 
1090  return true;
1091  }
1092 
1093  DWORD pid;
1094  GetWindowThreadProcessId(notifyItem->hWnd, &pid);
1095 
1096  if (pid == GetCurrentProcessId() ||
1097  (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST))
1098  {
1099  ::PostMessage(notifyItem->hWnd,
1100  notifyItem->uCallbackMessage,
1101  notifyItem->uID,
1102  uMsg);
1103  }
1104  else
1105  {
1106  ::SendMessage(notifyItem->hWnd,
1107  notifyItem->uCallbackMessage,
1108  notifyItem->uID,
1109  uMsg);
1110  }
1111  return false;
1112 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define WM_MOUSEFIRST
Definition: winuser.h:1756
BOOL WINAPI IsWindow(_In_opt_ HWND)
UINT uMsg
Definition: menu.cpp:213
BOOL RemoveButton(IN CONST NOTIFYICONDATA *iconData)
Definition: syspager.cpp:941
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
LONG_PTR LPARAM
Definition: windef.h:208
#define PostMessage
Definition: winuser.h:5807
#define TRACE(s)
Definition: solgame.cpp:4
#define NTNWM_REALIGN
Definition: precomp.h:336
#define WM_MOUSELAST
Definition: winuser.h:1783
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT uCallbackMessage
Definition: shellapi.h:229
HWND WINAPI GetParent(_In_ HWND)
#define SendMessage
Definition: winuser.h:5818
#define WM_NOTIFY
Definition: richedit.h:61
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158

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

◆ SwitchVersion()

BOOL CNotifyToolbar::SwitchVersion ( IN CONST NOTIFYICONDATA iconData)

Definition at line 813 of file syspager.cpp.

814 {
815  InternalIconData * notifyItem;
816  int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
817  if (index < 0)
818  {
819  WARN("Icon %d from hWnd %08x DOES NOT EXIST!", iconData->uID, iconData->hWnd);
820  return FALSE;
821  }
822 
823  if (iconData->uVersion != 0 && iconData->uVersion != NOTIFYICON_VERSION)
824  {
825  WARN("Tried to set the version of icon %d from hWnd %08x, to an unknown value %d. Vista+ program?", iconData->uID, iconData->hWnd, iconData->uVersion);
826  return FALSE;
827  }
828 
829  // We can not store the version in the uVersion field, because it's union'd with uTimeout,
830  // which we also need to keep track of.
831  notifyItem->uVersionCopy = iconData->uVersion;
832 
833  return TRUE;
834 }
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
GLuint index
Definition: glext.h:6031
int FindItem(IN HWND hWnd, IN UINT uID, InternalIconData **pdata)
Definition: syspager.cpp:677

Referenced by CSysPagerWnd::NotifyIcon().

◆ UpdateButton()

BOOL CNotifyToolbar::UpdateButton ( IN CONST NOTIFYICONDATA iconData)

Definition at line 836 of file syspager.cpp.

837 {
838  InternalIconData * notifyItem;
839  TBBUTTONINFO tbbi = { 0 };
840 
841  TRACE("Updating icon %d from hWnd %08x flags%s%s state%s%s\n",
842  iconData->uID, iconData->hWnd,
843  (iconData->uFlags & NIF_ICON) ? " ICON" : "",
844  (iconData->uFlags & NIF_STATE) ? " STATE" : "",
845  (iconData->dwState & NIS_HIDDEN) ? " HIDDEN" : "",
846  (iconData->dwState & NIS_SHAREDICON) ? " SHARED" : "");
847 
848  int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
849  if (index < 0)
850  {
851  WARN("Icon %d from hWnd %08x DOES NOT EXIST!\n", iconData->uID, iconData->hWnd);
852  return AddButton(iconData);
853  }
854 
855  TBBUTTON btn;
856  GetButton(index, &btn);
857  int oldIconIndex = btn.iBitmap;
858 
859  tbbi.cbSize = sizeof(tbbi);
860  tbbi.dwMask = TBIF_BYINDEX | TBIF_COMMAND;
861  tbbi.idCommand = index;
862 
863  if (iconData->uFlags & NIF_STATE)
864  {
865  if (iconData->dwStateMask & NIS_HIDDEN &&
866  (notifyItem->dwState & NIS_HIDDEN) != (iconData->dwState & NIS_HIDDEN))
867  {
868  tbbi.dwMask |= TBIF_STATE;
869  if (iconData->dwState & NIS_HIDDEN)
870  {
871  tbbi.fsState |= TBSTATE_HIDDEN;
873  }
874  else
875  {
876  tbbi.fsState &= ~TBSTATE_HIDDEN;
878  }
879  }
880 
881  notifyItem->dwState &= ~iconData->dwStateMask;
882  notifyItem->dwState |= (iconData->dwState & iconData->dwStateMask);
883  }
884 
885  if (iconData->uFlags & NIF_MESSAGE)
886  {
887  notifyItem->uCallbackMessage = iconData->uCallbackMessage;
888  }
889 
890  if (iconData->uFlags & NIF_ICON)
891  {
892  BOOL hasSharedIcon = notifyItem->dwState & NIS_SHAREDICON;
893  if (hasSharedIcon)
894  {
895  INT iIcon = FindExistingSharedIcon(iconData->hIcon);
896  if (iIcon >= 0)
897  {
898  notifyItem->hIcon = iconData->hIcon;
899  tbbi.dwMask |= TBIF_IMAGE;
900  tbbi.iImage = iIcon;
901  }
902  else
903  {
904  TRACE("Shared icon requested, but HICON not found!!! IGNORING!");
905  }
906  }
907  else
908  {
909  notifyItem->hIcon = iconData->hIcon;
910  tbbi.dwMask |= TBIF_IMAGE;
911  tbbi.iImage = ImageList_ReplaceIcon(m_ImageList, oldIconIndex, notifyItem->hIcon);
912  }
913  }
914 
915  if (iconData->uFlags & NIF_TIP)
916  {
917  StringCchCopy(notifyItem->szTip, _countof(notifyItem->szTip), iconData->szTip);
918  }
919 
920  if (iconData->uFlags & NIF_INFO)
921  {
922  // NOTE: In Vista+, the uTimeout value is disregarded, and the accessibility settings are used always.
923  StringCchCopy(notifyItem->szInfo, _countof(notifyItem->szInfo), iconData->szInfo);
924  StringCchCopy(notifyItem->szInfoTitle, _countof(notifyItem->szInfoTitle), iconData->szInfoTitle);
925  notifyItem->dwInfoFlags = iconData->dwInfoFlags;
926  notifyItem->uTimeout = iconData->uTimeout;
927  }
928 
929  /* TODO: support VERSION_4 (NIF_GUID, NIF_REALTIME, NIF_SHOWTIP) */
930 
931  SetButtonInfo(index, &tbbi);
932 
933  if (iconData->uFlags & NIF_INFO)
934  {
935  m_BalloonQueue->UpdateInfo(notifyItem);
936  }
937 
938  return TRUE;
939 }
#define TBIF_COMMAND
Definition: commctrl.h:1220
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2779
#define NIF_MESSAGE
Definition: shellapi.h:102
#define TRUE
Definition: types.h:120
void UpdateInfo(InternalIconData *notifyItem)
Definition: syspager.cpp:551
#define TBIF_BYINDEX
Definition: commctrl.h:1222
#define WARN(fmt,...)
Definition: debug.h:112
DWORD dwInfoFlags
Definition: shellapi.h:244
int32_t INT
Definition: typedefs.h:57
#define TBIF_IMAGE
Definition: commctrl.h:1215
int m_VisibleButtonCount
Definition: syspager.cpp:149
unsigned int BOOL
Definition: ntddk_ex.h:94
CHAR szTip[128]
Definition: shellapi.h:235
#define NIF_TIP
Definition: shellapi.h:104
GLuint index
Definition: glext.h:6031
#define NIF_ICON
Definition: shellapi.h:103
int iBitmap
Definition: commctrl.h:945
#define TBIF_STATE
Definition: commctrl.h:1217
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
int FindExistingSharedIcon(HICON handle)
Definition: syspager.cpp:697
#define index(s, c)
Definition: various.h:29
#define StringCchCopy
Definition: strsafe.h:139
CBalloonQueue * m_BalloonQueue
Definition: syspager.cpp:151
HIMAGELIST m_ImageList
Definition: syspager.cpp:148
BOOL AddButton(IN CONST NOTIFYICONDATA *iconData)
Definition: syspager.cpp:714
UINT uCallbackMessage
Definition: shellapi.h:229
int FindItem(IN HWND hWnd, IN UINT uID, InternalIconData **pdata)
Definition: syspager.cpp:677
CHAR szInfo[256]
Definition: shellapi.h:238
#define TBSTATE_HIDDEN
Definition: commctrl.h:971
DWORD SetButtonInfo(int cmdId, TBBUTTONINFO *info)
Definition: rosctrls.h:355
CHAR szInfoTitle[64]
Definition: shellapi.h:243
#define TBBUTTONINFO
Definition: commctrl.h:1250
DWORD GetButton(int index, TBBUTTON *btn)
Definition: rosctrls.h:320

Referenced by CSysPagerWnd::NotifyIcon().

Member Data Documentation

◆ m_BalloonQueue

CBalloonQueue* CNotifyToolbar::m_BalloonQueue
private

Definition at line 151 of file syspager.cpp.

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

◆ m_ImageList

HIMAGELIST CNotifyToolbar::m_ImageList
private

Definition at line 148 of file syspager.cpp.

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

◆ m_VisibleButtonCount

int CNotifyToolbar::m_VisibleButtonCount
private

Definition at line 149 of file syspager.cpp.

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


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