ReactOS 0.4.16-dev-334-g4d9f67c
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
91}
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
NOTIFYICONMODE _mode
Definition: traynotify.h:83
UINT _uCallbackMessage
Definition: traynotify.h:106
DWORD _dwState
Definition: traynotify.h:105
UINT _version
Definition: traynotify.h:107
DWORD _lastChange
Definition: traynotify.h:109
HICON _hIcon
Definition: traynotify.h:104
@ NIM_AUTO
Definition: traynotify.h:65

Member Function Documentation

◆ modify()

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

Definition at line 104 of file traynotify.cpp.

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())
189 if (_windowTitle != title) {
191 changes = true;
192 }
193 }
194
195 if (changes) {
196 create_name();
198 }
199
200 return changes;
201}
r l[0]
Definition: byte_order.h:168
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define COUNTOF(x)
Definition: utility.h:93
static HICON
Definition: imagelist.c:80
static char title[]
Definition: ps.c:92
static CHANGE * changes
Definition: io.c:49
#define NIF_ICON
Definition: shellapi.h:107
#define NIF_MESSAGE
Definition: shellapi.h:106
#define NIF_TIP
Definition: shellapi.h:108
String _windowTitle
Definition: traynotify.h:80
UINT uCallbackMessage
Definition: shellapi.h:232
DWORD dwStateMask
Definition: shellapi.h:240
CHAR szTip[128]
Definition: shellapi.h:238
#define NID_SIZE_W6
Definition: traynotify.cpp:95
#define NID_SIZE_A5
Definition: traynotify.cpp:101
#define NID_SIZE_W3
Definition: traynotify.cpp:97
#define NID_SIZE_A6
Definition: traynotify.cpp:100
#define NID_SIZE_W5
Definition: traynotify.cpp:96
#define NID_SIZE_A3
Definition: traynotify.cpp:102
#define NOTIFYICON_SIZE
Definition: traynotify.h:37
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define IMAGE_ICON
Definition: winuser.h:212
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2024
#define GetWindowText
Definition: winuser.h:5810
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105
char TCHAR
Definition: xmlstorage.h:189
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

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;}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Member Data Documentation

◆ _dwState

DWORD NotifyInfo::_dwState

Definition at line 105 of file traynotify.h.

Referenced by modify(), and NotifyInfo().

◆ _hIcon

HICON NotifyInfo::_hIcon

Definition at line 104 of file traynotify.h.

Referenced by modify(), and NotifyInfo().

◆ _idx

int NotifyInfo::_idx

Definition at line 103 of file traynotify.h.

Referenced by NotifyInfo().

◆ _lastChange

DWORD NotifyInfo::_lastChange

Definition at line 109 of file traynotify.h.

Referenced by modify(), and NotifyInfo().

◆ _uCallbackMessage

UINT NotifyInfo::_uCallbackMessage

Definition at line 106 of file traynotify.h.

Referenced by modify(), and NotifyInfo().

◆ _version

UINT NotifyInfo::_version

Definition at line 107 of file traynotify.h.

Referenced by NotifyInfo().


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