structure for maintaining informations about one notification icon More...
#include <traynotify.h>
Public Member Functions | |
NotifyInfo () | |
bool | modify (NOTIFYICONDATA *pnid) |
Public Attributes | |
int | _idx |
HICON | _hIcon |
DWORD | _dwState |
UINT | _uCallbackMessage |
UINT | _version |
DWORD | _lastChange |
Friends | |
bool | operator< (const NotifyInfo &a, const NotifyInfo &b) |
structure for maintaining informations about one notification icon
Definition at line 93 of file traynotify.h.
NotifyInfo::NotifyInfo | ( | ) |
Definition at line 84 of file traynotify.cpp.
References _dwState, _hIcon, _idx, _lastChange, NotifyIconConfig::_mode, _uCallbackMessage, _version, and NIM_AUTO.
{ _idx = -1; _hIcon = 0; _dwState = 0; _uCallbackMessage = 0; _version = 0; _mode = NIM_AUTO; _lastChange = GetTickCount(); }
bool NotifyInfo::modify | ( | NOTIFYICONDATA * | pnid ) |
Definition at line 107 of file traynotify.cpp.
References _dwState, _hIcon, NotifyIconIndex::_hWnd, _lastChange, NotifyIconConfig::_tipText, _uCallbackMessage, NotifyIconIndex::_uID, NotifyIconConfig::_windowTitle, String::assign(), COUNTOF, NotifyIconConfig::create_name(), NID_SIZE_A3, NID_SIZE_A5, NID_SIZE_A6, NID_SIZE_W3, NID_SIZE_W5, NID_SIZE_W6, and NOTIFYICON_SIZE.
Referenced by NotifyArea::ProcessTrayNotification().
{ bool changes = false; if (_hWnd!=pnid->hWnd || _uID!=pnid->uID) { _hWnd = pnid->hWnd; _uID = pnid->uID; changes = true; } if (pnid->uFlags & NIF_MESSAGE) { if (_uCallbackMessage != pnid->uCallbackMessage) { _uCallbackMessage = pnid->uCallbackMessage; changes = true; } } if (pnid->uFlags & NIF_ICON) { // Some applications destroy the icon immediatelly after completing the // NIM_ADD/MODIFY message, so we have to make a copy of it. if (_hIcon) DestroyIcon(_hIcon); _hIcon = (HICON) CopyImage(pnid->hIcon, IMAGE_ICON, NOTIFYICON_SIZE, NOTIFYICON_SIZE, 0); changes = true; ///@todo compare icon } #ifdef NIF_STATE // as of 21.08.2003 missing in MinGW headers if (pnid->uFlags & NIF_STATE) { DWORD new_state = (_dwState&~pnid->dwStateMask) | (pnid->dwState&pnid->dwStateMask); if (_dwState != new_state) { _dwState = new_state; changes = true; } } #endif // store tool tip text if (pnid->uFlags & NIF_TIP) { String new_text; if (pnid->cbSize==NID_SIZE_W6 || pnid->cbSize==NID_SIZE_W5 || pnid->cbSize==NID_SIZE_W3) { // UNICODE version of NOTIFYICONDATA structure LPCWSTR txt = (LPCWSTR)pnid->szTip; int max_len = pnid->cbSize==NID_SIZE_W3? 64: 128; // get tooltip string length int l = 0; for(; l<max_len; ++l) if (!txt[l]) break; new_text.assign(txt, l); if (new_text != _tipText) { _tipText = new_text; changes = true; } } else if (pnid->cbSize==NID_SIZE_A6 || pnid->cbSize==NID_SIZE_A5 || pnid->cbSize==NID_SIZE_A3) { LPCSTR txt = (LPCSTR)pnid->szTip; int max_len = pnid->cbSize==NID_SIZE_A3? 64: 128; int l = 0; for(int l=0; l<max_len; ++l) if (!txt[l]) break; new_text.assign(txt, l); if (new_text != _tipText) { _tipText = new_text; changes = true; } } } TCHAR title[MAX_PATH]; DWORD pid; GetWindowThreadProcessId(_hWnd, &pid); // avoid to send WM_GETTEXT messages to the own process if (pid != GetCurrentProcessId()) if (GetWindowText(_hWnd, title, COUNTOF(title))) { if (_windowTitle != title) { _windowTitle = title; changes = true; } } if (changes) { create_name(); _lastChange = GetTickCount(); } return changes; }
bool operator< | ( | const NotifyInfo & | a, |
const NotifyInfo & | b | ||
) | [friend] |
Definition at line 98 of file traynotify.h.
DWORD NotifyInfo::_dwState |
Definition at line 105 of file traynotify.h.
Referenced by TrayNotifyDlg::Command(), modify(), NotifyInfo(), NotifyArea::ProcessTrayNotification(), TrayNotifyDlg::Refresh(), NotifyArea::Refresh(), and NotifyArea::UpdateIcons().
HICON NotifyInfo::_hIcon |
Definition at line 104 of file traynotify.h.
Referenced by TrayNotifyDlg::InsertItem(), modify(), and NotifyInfo().
int NotifyInfo::_idx |
Definition at line 103 of file traynotify.h.
Referenced by NotifyInfo(), and NotifyArea::ProcessTrayNotification().
DWORD NotifyInfo::_lastChange |
Definition at line 109 of file traynotify.h.
Referenced by modify(), NotifyInfo(), and NotifyArea::Refresh().
Definition at line 106 of file traynotify.h.
Referenced by modify(), NotifyInfo(), and NotifyArea::WndProc().
UINT NotifyInfo::_version |
Definition at line 107 of file traynotify.h.
Referenced by NotifyInfo().
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |