33#include "../notifyhook/notifyhook.h"
95#define NID_SIZE_W6 sizeof(NOTIFYICONDATAW)
96#define NID_SIZE_W5 (sizeof(NOTIFYICONDATAW)-sizeof(GUID))
97#define NID_SIZE_W3 (sizeof(NOTIFYICONDATAW)-sizeof(GUID)-(128-64)*sizeof(WCHAR))
100#define NID_SIZE_A6 sizeof(NOTIFYICONDATAA)
101#define NID_SIZE_A5 (sizeof(NOTIFYICONDATAA)-sizeof(GUID))
102#define NID_SIZE_A3 (sizeof(NOTIFYICONDATAA)-sizeof(GUID)-(128-64)*sizeof(CHAR))
133 if (pnid->
uFlags & NIF_STATE) {
153 for(;
l<max_len; ++
l)
157 new_text.assign(txt,
l);
168 for(
int l=0;
l<max_len; ++
l)
172 new_text.assign(txt,
l);
225 HKEY hkeyStuckRects = 0;
229 bool hide_clock =
false;
235 hide_clock =
buffer[2] & 0x08?
true:
false;
245 bool clock_visible =
true;
252 if (cfg_pos.go_down(
"desktopbar")) {
258 if (cfg_pos.go_down(
"notify-icons")) {
259 XMLPos
options(cfg_pos,
"options");
265 XMLChildrenFilter icons(cfg_pos,
"icon");
267 for(XMLChildrenFilter::iterator it=icons.begin(); it!=icons.end(); ++it) {
268 const XMLNode&
node = **it;
276 const string&
mode =
node.get(
"show");
280 else if (
mode ==
"hide")
299 cfg_pos.smart_create(
"desktopbar");
300 XMLBoolRef boolRef(XMLPos(cfg_pos,
"options"),
"show-clock");
304 cfg_pos.smart_create(
"notify-icons");
306 XMLPos
options(cfg_pos,
"options");
315 cfg_pos.smart_create(
"icon",
"name", cfg.
_name);
320 cfg_pos[
"name"] = cfg.
_name.c_str();
321 cfg_pos[
"text"] = cfg.
_tipText.c_str();
425 menu.TrackPopupMenu(_hwnd,
p);
443 || nmsg==WM_XBUTTONDOWN
459 nmsg == WM_XBUTTONDOWN ||
471 nmsg == WM_XBUTTONDOWN ||
484 (*AllowSetForegroundWindow)(
pid);
564 pdi->lpszText =
entry._tipText.str();
582 switch(notify_code) {
585 if ((
int)pnid->
uID >= 0) {
589 if (
entry._idx == -1)
606 entry._dwState |= NIS_HIDDEN;
621 if (found->second._hIcon)
637 found->second._version = pnid->UNION_MEMBER(uVersion);
672 while(tt_idx < icon_cnt) {
691#ifndef _NO_ALPHABLEND
693#pragma comment(lib, "msimg32")
699 BufferedPaintCanvas canvas(_hwnd);
716#ifndef _NO_ALPHABLEND
724#ifndef _NO_ALPHABLEND
725 if (it->_dwState & NIS_HIDDEN) {
728 AlphaBlend(canvas,
x,
y,
NOTIFYICON_SIZE,
NOTIFYICON_SIZE, mem_dc, 0, 0,
NOTIFYICON_SIZE,
NOTIFYICON_SIZE, blend);
757 switch(
entry._mode) {
759 if (!(
entry._dwState & NIS_HIDDEN)) {
760 entry._dwState |= NIS_HIDDEN;
766 if (
entry._dwState&NIS_HIDDEN) {
767 entry._dwState &= ~NIS_HIDDEN;
775 if (!(
entry._dwState & NIS_HIDDEN))
777 entry._dwState |= NIS_HIDDEN;
839 if (
entry._modulePath.empty()) {
843 if (!modulePath.empty())
844 entry._modulePath = modulePath;
900 WindowCanvas canvas(_hwnd);
964 tv.pszText = str_cur.str();
965 tv.iSelectedImage = tv.iImage = 0;
969 tv.pszText = str_conf.str();
970 tv.iSelectedImage = tv.iImage = 2;
976 tv.pszText = str_visible.str();
977 tv.iSelectedImage = tv.iImage = 0;
981 tv.pszText = str_hidden.str();
982 tv.iSelectedImage = tv.iImage = 1;
990 WindowCanvas canvas(_hwnd);
1054 FmtString txt(
TEXT(
"%s - %s [%s]"),
entry._tipText.c_str(),
entry._windowTitle.c_str(), mode_str.c_str());
1058 tvi.hParent = hparent;
1059 tvi.hInsertAfter =
after;
1065 tv.pszText = txt.str();
1131 info._mode = it->second.first;
1132 info._dwState = it->second.second;
1150 switch(pnmh->
code) {
1153 int idx = pnmtv->itemNew.lParam;
1181 if (
entry._lastChange)
1188 if (!hicon && !
entry._modulePath.empty()) {
1274 SYSTEMTIME st = { 1601, 1, 0, 1, 23, 59, 59, 999 };
1281 int clockwindowWidth =
rect.right-
rect.left + 4;
1285 clnt.right-(clockwindowWidth), 1, clockwindowWidth, clnt.bottom-2,
hwndParent);
1319 pdi->szText[0] =
'\0';
1346 PaintCanvas canvas(_hwnd);
#define RegCloseKey(hKey)
void push_back(const_reference __x)
_STLP_PRIV _List_iterator< NotifyIconConfig, _Const_traits< NotifyIconConfig > > const_iterator
_STLP_PRIV _List_iterator< NotifyIconConfig, _Nonconst_traits< NotifyIconConfig > > iterator
_STLP_TEMPLATE_FOR_CONT_EXT iterator find(const _KT &__x)
_Rep_type::iterator iterator
void erase(iterator __pos)
_Rep_type::const_iterator const_iterator
pair< iterator, bool > insert(const value_type &__x)
_Rep_type::const_iterator const_iterator
_Rep_type::iterator iterator
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
DWORD WINAPI GetTickCount(VOID)
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
#define PM_REFRESH_CONFIG
#define PM_RESIZE_CHILDREN
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLubyte GLubyte GLubyte GLubyte w
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 flag
void SetWindowIcon(HWND hwnd, UINT nid)
set big and small icons out of the resources for a window
int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
add icon with alpha channel to imagelist using the specified background color
ExplorerGlobals g_Globals
#define IDS_ITEMS_CONFIGURED
#define ID_SHOW_ICON_BUTTON
#define IDS_ITEMS_VISIBLE
#define IDC_NOTIFY_AUTOHIDE
#define IDC_NOTIFY_TOOLTIP
#define IDS_NOTIFY_AUTOHIDE
#define IDS_SHOW_HIDDEN_ICONS
#define ID_CONFIG_NOTIFYAREA
#define ID_SHOW_HIDDEN_ICONS
#define IDC_NOTIFY_MODULE
BOOL launch_cpanel(HWND hwnd, LPCTSTR applet)
#define GET_WINDOW(CLASS, hwnd)
#define WINDOW_CREATOR(WND_CLASS)
LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
void DeinstallNotifyHook()
DECL_NOTIFYHOOK int GetWindowModulePathCopyData(LPARAM lparam, HWND *phwnd, LPSTR buffer, int size)
static UINT WM_GETMODULEPATH
#define LOCALE_USER_DEFAULT
#define TreeView_DeleteAllItems(hwnd)
#define TreeView_Expand(hwnd, hitem, code)
#define TreeView_EnsureVisible(hwnd, hitem)
#define TreeView_SetImageList(hwnd, himl, iImage)
#define TreeView_InsertItem(hwnd, lpis)
#define TVIF_SELECTEDIMAGE
#define TTM_SETMAXTIPWIDTH
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
window class with gray background color
window for displaying the time in the tray notification area
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
int Notify(int id, NMHDR *pnmh)
static HWND Create(HWND hwndParent)
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0)
tray notification area aka "tray"
bool DetermineHideState(NotifyInfo &entry)
void show_clock(bool flag)
NotifyIconSet::iterator IconHitTest(const POINT &pos)
search for a icon at a given client coordinate position
void Refresh(bool do_refresh=false)
LRESULT ProcessTrayNotification(int notify_code, NOTIFYICONDATA *pnid)
int Notify(int id, NMHDR *pnmh)
NotifyIconSet _sorted_icons
LRESULT Init(LPCREATESTRUCT pcs)
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
map< HWND, String > _window_modules
static HWND Create(HWND hwndParent)
int Command(int id, int code)
bool ModulePathCopyData(LPARAM lparam, HWND *phwnd, String &path)
const UINT WM_GETMODULEPATH
void GetModulePath(HWND hwnd, HWND hwndCallback)
configuration for the display mode of a notification icon
bool match(const NotifyIconConfig &props) const
structure for maintaining informations about one notification icon
bool modify(NOTIFYICONDATA *pnid)
convenient loading of string resources
ResizeManager _resize_mgr
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
void Resize(int dx, int dy)
void Add(UINT id, int flags)
convenient loading of small (16x16) icon resources
configuration dialog for notification icons
void SetIconMode(NOTIFYICONMODE mode)
virtual int Notify(int id, NMHDR *pnmh)
NotifyIconDlgInfoMap _info
HTREEITEM _hitemCurrent_hidden
void RefreshProperties(const NotifyIconDlgInfo &entry)
HTREEITEM _hitemCurrent_visible
IconStateMap _icon_states_org
NotifyIconCfgList _cfg_org
pair< NOTIFYICONMODE, DWORD > IconStatePair
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
NotifyArea * _pNotifyArea
virtual int Command(int id, int code)
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo &, HDC)
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
static HWND Create(CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
LRESULT SendParent(UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
static void register_pretranslate(HWND hwnd)
static void unregister_pretranslate(HWND hwnd)
virtual LRESULT Init(LPCREATESTRUCT pcs)
__inline int after(__u32 seq1, __u32 seq2)
String string_from_mode(NOTIFYICONMODE mode)
static bool get_hide_clock_from_registry()
#define NOTIFYAREA_WIDTH_DEF
String string_from_mode(NOTIFYICONMODE mode)
#define CLASSNAME_CLOCKWINDOW
#define ICON_AUTOHIDE_SECONDS
#define PM_GET_NOTIFYAREA
#define CLASSNAME_TRAYNOTIFY
TW_UINT32 TW_UINT16 TW_UINT16 MSG
static const WCHAR props[]
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
BOOL WINAPI AllowSetForegroundWindow(DWORD dwProcessId)
DWORD WINAPI GetCurrentProcessId(void)
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO * pdi
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define HKEY_CURRENT_USER
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
DWORD WINAPI GetMessagePos(void)
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define TranslateAccelerator
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)