ReactOS  0.4.12-dev-75-g00dd17e
NotifyInfo Struct Reference

structure for maintaining informations about one notification icon More...

#include <traynotify.h>

Inheritance diagram for NotifyInfo:
Collaboration diagram for NotifyInfo:

Public Member Functions

 NotifyInfo ()
 
bool modify (NOTIFYICONDATA *pnid)
 
- Public Member Functions inherited from NotifyIconIndex
 NotifyIconIndex (NOTIFYICONDATA *pnid)
 
- Public Member Functions inherited from NotifyIconConfig
 NotifyIconConfig ()
 
void create_name ()
 
bool match (const NotifyIconConfig &props) const
 

Public Attributes

int _idx
 
HICON _hIcon
 
DWORD _dwState
 
UINT _uCallbackMessage
 
UINT _version
 
DWORD _lastChange
 
- Public Attributes inherited from NotifyIconIndex
HWND _hWnd
 
UINT _uID
 
- Public Attributes inherited from NotifyIconConfig
String _tipText
 
String _windowTitle
 
String _modulePath
 
NOTIFYICONMODE _mode
 
String _name
 

Friends

bool operator< (const NotifyInfo &a, const NotifyInfo &b)
 

Additional Inherited Members

- Protected Member Functions inherited from NotifyIconIndex
 NotifyIconIndex ()
 

Detailed Description

structure for maintaining informations about one notification icon

Definition at line 93 of file traynotify.h.

Constructor & Destructor Documentation

◆ NotifyInfo()

NotifyInfo::NotifyInfo ( )

Definition at line 81 of file traynotify.cpp.

82 {
83  _idx = -1;
84  _hIcon = 0;
85  _dwState = 0;
87  _version = 0;
88 
89  _mode = NIM_AUTO;
91 }
DWORD _dwState
Definition: traynotify.h:105
HICON _hIcon
Definition: traynotify.h:104
NOTIFYICONMODE _mode
Definition: traynotify.h:83
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
UINT _version
Definition: traynotify.h:107
DWORD _lastChange
Definition: traynotify.h:109
UINT _uCallbackMessage
Definition: traynotify.h:106

Member Function Documentation

◆ modify()

bool NotifyInfo::modify ( NOTIFYICONDATA pnid)
Todo:
compare icon

Definition at line 104 of file traynotify.cpp.

Referenced by NotifyArea::ProcessTrayNotification().

105 {
106  bool changes = false;
107 
108  if (_hWnd!=pnid->hWnd || _uID!=pnid->uID) {
109  _hWnd = pnid->hWnd;
110  _uID = pnid->uID;
111 
112  changes = true;
113  }
114 
115  if (pnid->uFlags & NIF_MESSAGE) {
116  if (_uCallbackMessage != pnid->uCallbackMessage) {
118  changes = true;
119  }
120  }
121 
122  if (pnid->uFlags & NIF_ICON) {
123  // Some applications destroy the icon immediatelly after completing the
124  // NIM_ADD/MODIFY message, so we have to make a copy of it.
125  if (_hIcon)
127 
129 
130  changes = true;
131  }
132 
133  if (pnid->uFlags & NIF_STATE) {
134  DWORD new_state = (_dwState&~pnid->dwStateMask) | (pnid->dwState&pnid->dwStateMask);
135 
136  if (_dwState != new_state) {
137  _dwState = new_state;
138  changes = true;
139  }
140  }
141 
142  // store tool tip text
143  if (pnid->uFlags & NIF_TIP) {
144  String new_text;
145 
146  if (pnid->cbSize==NID_SIZE_W6 || pnid->cbSize==NID_SIZE_W5 || pnid->cbSize==NID_SIZE_W3) {
147  // UNICODE version of NOTIFYICONDATA structure
148  LPCWSTR txt = (LPCWSTR)pnid->szTip;
149  int max_len = pnid->cbSize==NID_SIZE_W3? 64: 128;
150 
151  // get tooltip string length
152  int l = 0;
153  for(; l<max_len; ++l)
154  if (!txt[l])
155  break;
156 
157  new_text.assign(txt, l);
158 
159  if (new_text != _tipText) {
160  _tipText = new_text;
161  changes = true;
162  }
163  } else if (pnid->cbSize==NID_SIZE_A6 || pnid->cbSize==NID_SIZE_A5 || pnid->cbSize==NID_SIZE_A3) {
164  LPCSTR txt = (LPCSTR)pnid->szTip;
165  int max_len = pnid->cbSize==NID_SIZE_A3? 64: 128;
166 
167  int l = 0;
168  for(int l=0; l<max_len; ++l)
169  if (!txt[l])
170  break;
171 
172  new_text.assign(txt, l);
173 
174  if (new_text != _tipText) {
175  _tipText = new_text;
176  changes = true;
177  }
178  }
179  }
180 
182 
183  DWORD pid;
185 
186  // avoid to send WM_GETTEXT messages to the own process
187  if (pid != GetCurrentProcessId())
188  if (GetWindowText(_hWnd, title, COUNTOF(title))) {
189  if (_windowTitle != title) {
191  changes = true;
192  }
193  }
194 
195  if (changes) {
196  create_name();
198  }
199 
200  return changes;
201 }
DWORD _dwState
Definition: traynotify.h:105
#define NID_SIZE_W5
Definition: traynotify.cpp:96
#define NID_SIZE_A6
Definition: traynotify.cpp:100
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define NIF_MESSAGE
Definition: shellapi.h:102
static HICON
Definition: imagelist.c:84
static CHANGE * changes
Definition: io.c:49
#define IMAGE_ICON
Definition: winuser.h:212
HICON _hIcon
Definition: traynotify.h:104
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define NID_SIZE_A3
Definition: traynotify.cpp:102
static WCHAR String[]
Definition: stringtable.c:55
#define GetWindowText
Definition: winuser.h:5664
DWORD dwStateMask
Definition: shellapi.h:235
DWORD _lastChange
Definition: traynotify.h:109
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
CHAR szTip[128]
Definition: shellapi.h:233
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
#define NIF_TIP
Definition: shellapi.h:104
const char * LPCSTR
Definition: xmlstorage.h:183
#define NIF_ICON
Definition: shellapi.h:103
r l[0]
Definition: byte_order.h:167
char TCHAR
Definition: xmlstorage.h:189
#define NOTIFYICON_SIZE
Definition: traynotify.h:37
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
String _windowTitle
Definition: traynotify.h:80
UINT uCallbackMessage
Definition: shellapi.h:227
#define COUNTOF(x)
Definition: utility.h:93
#define NID_SIZE_W6
Definition: traynotify.cpp:95
#define NID_SIZE_W3
Definition: traynotify.cpp:97
static char title[]
Definition: ps.c:92
#define NID_SIZE_A5
Definition: traynotify.cpp:101
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1188
UINT _uCallbackMessage
Definition: traynotify.h:106
#define LPCWSTR
Definition: msvc.h:45

Friends And Related Function Documentation

◆ operator<

bool operator< ( const NotifyInfo a,
const NotifyInfo b 
)
friend

Definition at line 98 of file traynotify.h.

99  {return a._idx < b._idx;}

Member Data Documentation

◆ _dwState

◆ _hIcon

HICON NotifyInfo::_hIcon

Definition at line 104 of file traynotify.h.

Referenced by TrayNotifyDlg::InsertItem().

◆ _idx

int NotifyInfo::_idx

Definition at line 103 of file traynotify.h.

Referenced by NotifyArea::ProcessTrayNotification().

◆ _lastChange

DWORD NotifyInfo::_lastChange

Definition at line 109 of file traynotify.h.

Referenced by NotifyArea::Refresh().

◆ _uCallbackMessage

UINT NotifyInfo::_uCallbackMessage

Definition at line 106 of file traynotify.h.

Referenced by NotifyArea::WndProc().

◆ _version

UINT NotifyInfo::_version

Definition at line 107 of file traynotify.h.


The documentation for this struct was generated from the following files: