ReactOS 0.4.15-dev-7788-g1ad9096
traynotify.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2003, 2004, 2005 Martin Fuchs
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19
20 //
21 // Explorer clone
22 //
23 // traynotify.cpp
24 //
25 // Martin Fuchs, 22.08.2003
26 //
27
28
29#include <precomp.h>
30
31#include "traynotify.h"
32
33#include "../notifyhook/notifyhook.h"
34
37{
38}
39
41{
43}
44
46{
47 PostMessage(hwnd, WM_GETMODULEPATH, (WPARAM)hwndCallback, 0);
48}
49
51{
52 char buffer[MAX_PATH];
53
55
56 if (l) {
57 path.assign(buffer, l);
58 return true;
59 } else
60 return false;
61}
62
63
65{
66 _hWnd = pnid->hWnd;
67 _uID = pnid->uID;
68
69 // special handling for windows task manager
70 if ((int)_uID < 0)
71 _uID = 0;
72}
73
75{
76 _hWnd = 0;
77 _uID = 0;
78}
79
80
82{
83 _idx = -1;
84 _hIcon = 0;
85 _dwState = 0;
87 _version = 0;
88
91}
92
93
94 // WCHAR versions von NOTIFYICONDATA
95#define NID_SIZE_W6 sizeof(NOTIFYICONDATAW) // _WIN32_IE = 0x600
96#define NID_SIZE_W5 (sizeof(NOTIFYICONDATAW)-sizeof(GUID)) // _WIN32_IE = 0x500
97#define NID_SIZE_W3 (sizeof(NOTIFYICONDATAW)-sizeof(GUID)-(128-64)*sizeof(WCHAR)) // _WIN32_IE < 0x500
98
99 // CHAR versions von NOTIFYICONDATA
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))
103
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}
202
203
205 : super(hwnd),
206 _tooltip(hwnd)
207{
208 _next_idx = 0;
209 _clock_width = 0;
211 _show_hidden = false;
212 _hide_inactive = true;
213 _show_button = true;
214}
215
217{
218 KillTimer(_hwnd, 0);
219
220 write_config();
221}
222
224{
225 HKEY hkeyStuckRects = 0;
226 DWORD buffer[10];
227 DWORD len = sizeof(buffer);
228
229 bool hide_clock = false;
230
231 // check if the clock should be hidden
232 if (!RegOpenKey(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StuckRects2"), &hkeyStuckRects) &&
233 !RegQueryValueEx(hkeyStuckRects, TEXT("Settings"), 0, NULL, (LPBYTE)buffer, &len) &&
234 len==sizeof(buffer) && buffer[0]==sizeof(buffer))
235 hide_clock = buffer[2] & 0x08? true: false;
236
237 if (hkeyStuckRects)
238 RegCloseKey(hkeyStuckRects);
239
240 return hide_clock;
241}
242
244{
245 bool clock_visible = true;
246
247 // read notification icon settings from XML configuration
248 XMLPos cfg_pos = g_Globals.get_cfg();
249
250 if (!g_Globals._SHRestricted || !SHRestricted(REST_HIDECLOCK))
251 {
252 if (cfg_pos.go_down("desktopbar")) {
253 clock_visible = XMLBoolRef(XMLPos(cfg_pos,"options"), "show-clock", !get_hide_clock_from_registry());
254 cfg_pos.back();
255 }
256 }
257
258 if (cfg_pos.go_down("notify-icons")) {
259 XMLPos options(cfg_pos, "options");
260
261 _hide_inactive = XMLBool(options, "hide-inactive", true);
262 _show_hidden = XMLBool(options, "show-hidden", false);
263 _show_button = XMLBool(options, "show-button", true);
264
265 XMLChildrenFilter icons(cfg_pos, "icon");
266
267 for(XMLChildrenFilter::iterator it=icons.begin(); it!=icons.end(); ++it) {
268 const XMLNode& node = **it;
269
271
272 cfg._name = node.get("name").c_str();
273 cfg._tipText = node.get("text").c_str();
274 cfg._windowTitle = node.get("window").c_str();
275 cfg._modulePath = node.get("module").c_str();
276 const string& mode = node.get("show");
277
278 if (mode == "show")
279 cfg._mode = NIM_SHOW;
280 else if (mode == "hide")
281 cfg._mode = NIM_HIDE;
282 else //if (mode == "auto")
283 cfg._mode = NIM_HIDE;
284
285 _cfg.push_back(cfg);
286 }
287
288 cfg_pos.back();
289 }
290
291 show_clock(clock_visible);
292}
293
295{
296 // write notification icon settings to XML configuration file
297 XMLPos cfg_pos = g_Globals.get_cfg();
298
299 cfg_pos.smart_create("desktopbar");
300 XMLBoolRef boolRef(XMLPos(cfg_pos,"options"), "show-clock");
301 boolRef = _hwndClock!=0;
302 cfg_pos.back();
303
304 cfg_pos.smart_create("notify-icons");
305
306 XMLPos options(cfg_pos, "options");
307 XMLBoolRef(options, "hide-inactive") = _hide_inactive;
308 XMLBoolRef(options, "show-hidden") = _show_hidden;
309 XMLBoolRef(options, "show-button") = _show_button;
310
311 for(NotifyIconCfgList::iterator it=_cfg.begin(); it!=_cfg.end(); ++it) {
312 NotifyIconConfig& cfg = *it;
313
314 // search for the corresponding node using the original name
315 cfg_pos.smart_create("icon", "name", cfg._name);
316
317 // refresh unique name
318 cfg.create_name();
319
320 cfg_pos["name"] = cfg._name.c_str();
321 cfg_pos["text"] = cfg._tipText.c_str();
322 cfg_pos["window"] = cfg._windowTitle.c_str();
323 cfg_pos["module"] = cfg._modulePath.c_str();
324 cfg_pos["show"] = string_from_mode(cfg._mode).c_str();
325
326 cfg_pos.back();
327 }
328
329 cfg_pos.back(); // smart_create
330}
331
333{
334 bool vis = _hwndClock!=0;
335
336 if (vis != flag) {
337 if (flag) {
338 // create clock window
340
341 if (_hwndClock) {
342 ClientRect clock_size(_hwndClock);
343 _clock_width = clock_size.right;
344 }
345 } else {
347 _hwndClock = 0;
348 _clock_width = 0;
349 }
350
352 }
353}
354
356{
357 if (super::Init(pcs))
358 return 1;
359
360 read_config();
361
362 SetTimer(_hwnd, 0, 1000, NULL);
363
364 return 0;
365}
366
368{
369 static BtnWindowClass wcTrayNotify(CLASSNAME_TRAYNOTIFY, CS_DBLCLKS);
370
371 ClientRect clnt(hwndParent);
372
375 clnt.right-(NOTIFYAREA_WIDTH_DEF+1), 1, NOTIFYAREA_WIDTH_DEF, clnt.bottom-2, hwndParent);
376}
377
379{
380 switch(nmsg) {
381 case WM_PAINT:
382 Paint();
383 break;
384
385 case WM_TIMER: {
386 Refresh();
387
389
390 if (clock_window)
391 clock_window->TimerTick();
392 break;}
393
394 case PM_REFRESH:
395 Refresh(true);
396 break;
397
398 case WM_SIZE: {
399 int cx = LOWORD(lparam);
401 break;}
402
403 case PM_GET_WIDTH: {
405 if (_show_button)
407 return w;}
408
410 read_config();
411 break;
412
413 case WM_CONTEXTMENU: {
414 Point pt(lparam);
415 POINTS p;
416 p.x = (SHORT) pt.x;
417 p.y = (SHORT) pt.y;
418 ScreenToClient(_hwnd, &pt);
419
420 if (IconHitTest(pt) == _sorted_icons.end()) { // display menu only when no icon clicked
421 PopupMenu menu(IDM_NOTIFYAREA);
425 menu.TrackPopupMenu(_hwnd, p);
426 }
427 break;}
428
429 case WM_COPYDATA: { // receive NotifyHook answers
430 String path;
431 HWND hwnd;
432
435 break;}
436
437 default:
438 if (nmsg>=WM_MOUSEFIRST && nmsg<=WM_MOUSELAST) {
439 // close startup menu and other popup menus
440 // This functionality is missing in MS Windows.
441 if (nmsg==WM_LBUTTONDOWN || nmsg==WM_MBUTTONDOWN || nmsg==WM_RBUTTONDOWN
442#ifdef WM_XBUTTONDOWN
443 || nmsg==WM_XBUTTONDOWN
444#endif
445 )
446
447 CancelModes();
448
449 Point pt(lparam);
451
452 if (found != _sorted_icons.end()) {
453 const NotifyInfo& entry = const_cast<NotifyInfo&>(*found); // Why does GCC 3.3 need this additional const_cast ?!
454
455 // set activation time stamp
456 if (nmsg == WM_LBUTTONDOWN || // Some programs need PostMessage() instead of SendMessage().
457 nmsg == WM_MBUTTONDOWN || // So call SendMessage() only for BUTTONUP and BLCLK messages
458#ifdef WM_XBUTTONDOWN
459 nmsg == WM_XBUTTONDOWN ||
460#endif
461 nmsg == WM_RBUTTONDOWN) {
462 _icon_map[entry]._lastChange = GetTickCount();
463 }
464
465 // Notify the message if the owner is still alive
466 if (IsWindow(entry._hWnd)) {
467 if (nmsg == WM_MOUSEMOVE || // avoid to call blocking SendMessage() for merely moving the mouse over icons
468 nmsg == WM_LBUTTONDOWN || // Some programs need PostMessage() instead of SendMessage().
469 nmsg == WM_MBUTTONDOWN || // So call SendMessage() only for BUTTONUP and BLCLK messages
470#ifdef WM_XBUTTONDOWN
471 nmsg == WM_XBUTTONDOWN ||
472#endif
473 nmsg == WM_RBUTTONDOWN)
474 PostMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg);
475 else {
476 // allow SetForegroundWindow() in client process
477 DWORD pid;
478
479 if (GetWindowThreadProcessId(entry._hWnd, &pid)) {
480 // bind dynamically to AllowSetForegroundWindow() to be compatible to WIN98
481 static DynamicFct<BOOL(WINAPI*)(DWORD)> AllowSetForegroundWindow(TEXT("USER32"), "AllowSetForegroundWindow");
482
484 (*AllowSetForegroundWindow)(pid);
485 }
486
487 // use PostMessage() for notifcation icons of Shell Service Objects in the own process
488 if (pid == GetCurrentProcessId())
489 PostMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg);
490 else
491 SendMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg);
492 }
493 }
494 else if (_icon_map.erase(entry)) // delete icons without valid owner window
495 UpdateIcons();
496 } else
497 // handle clicks on notification area button "show hidden icons"
498 if (_show_button)
499 if (nmsg == WM_LBUTTONDOWN)
503 }
504
505 return super::WndProc(nmsg, wparam, lparam);
506 }
507
508 return 0;
509}
510
511int NotifyArea::Command(int id, int code)
512{
513 switch(id) {
516 UpdateIcons();
517 break;
518
521 UpdateIcons();
522 break;
523
526 break;
527
528 case ID_CONFIG_TIME:
529 launch_cpanel(_hwnd, TEXT("timedate.cpl"));
530 break;
531
532 default:
534 }
535
536 return 0;
537}
538
539int NotifyArea::Notify(int id, NMHDR* pnmh)
540{
541 if (pnmh->code == TTN_GETDISPINFO) {
543
545 ScreenToClient(_hwnd, &pt);
546
547 if (_show_button &&
550 {
551 static ResString sShowIcons(IDS_SHOW_HIDDEN_ICONS);
552 static ResString sHideIcons(IDS_HIDE_ICONS);
553
554 pdi->lpszText = (_show_hidden? sHideIcons: sShowIcons).str();
555 } else {
557
558 if (found != _sorted_icons.end()) {
559 NotifyInfo& entry = const_cast<NotifyInfo&>(*found); // Why does GCC 3.3 need this additional const_cast ?!
560
561 // enable multiline tooltips (break at CR/LF and for very long one-line strings)
563
564 pdi->lpszText = entry._tipText.str();
565 }
566 }
567 }
568
569 return 0;
570}
571
573{
575
577 PostMessage(it->_hWnd, WM_CANCELMODE, 0, 0);
578}
579
581{
582 switch(notify_code) {
583 case NIM_ADD:
584 case NIM_MODIFY:
585 if ((int)pnid->uID >= 0) {
586 NotifyInfo& entry = _icon_map[pnid];
587
588 // a new entry?
589 if (entry._idx == -1)
590 entry._idx = ++_next_idx;
591 /* equivalent code using iterator::find();
592 NotifyIconMap::iterator found = _icon_map.find(pnid);
593 NotifyInfo* pentry;
594 // a new entry?
595 if (found == _icon_map.end()) {
596 pentry = &_icon_map[pnid];
597 pentry->_idx = ++_next_idx;
598 } else {
599 pentry = &found->second;
600 }
601 NotifyInfo& entry = *pentry;
602 */
603 bool changes = entry.modify(pnid);
604
605 if (DetermineHideState(entry) && entry._mode==NIM_HIDE) {
606 entry._dwState |= NIS_HIDDEN;
607 changes = true;
608 }
609
610 if (changes)
611 UpdateIcons();
612
613 return TRUE;
614 }
615 break;
616
617 case NIM_DELETE: {
619
620 if (found != _icon_map.end()) {
621 if (found->second._hIcon)
622 DestroyIcon(found->second._hIcon);
623 _icon_map.erase(found);
624 UpdateIcons();
625 return TRUE;
626 }
627 break;}
628
629 case NIM_SETFOCUS:
630 SetForegroundWindow(_hwnd);
631 return TRUE;
632
633 case NIM_SETVERSION:
635
636 if (found != _icon_map.end()) {
637 found->second._version = pnid->UNION_MEMBER(uVersion);
638 return TRUE;
639 } else
640 return FALSE;
641 }
642
643 return FALSE;
644}
645
647{
649
650 // sort icon infos by display index
652 const NotifyInfo& entry = it->second;
653
654 if (_show_hidden || !(entry._dwState & NIS_HIDDEN))
656 }
657
658 // sync tooltip areas to current icon number
661
662 size_t tt_idx = 0;
663
664 if (_show_button) {
665 _tooltip.add(_hwnd, tt_idx++, rect);
666
667 rect.left += NOTIFYICON_DIST;
668 rect.right += NOTIFYICON_DIST;
669 }
670
671 size_t icon_cnt = _sorted_icons.size();
672 while(tt_idx < icon_cnt) {
673 _tooltip.add(_hwnd, tt_idx++, rect);
674
675 rect.left += NOTIFYICON_DIST;
676 rect.right += NOTIFYICON_DIST;
677 }
678
679 while(tt_idx < _last_icon_count)
680 _tooltip.remove(_hwnd, tt_idx++);
681
683 }
684
686
687 InvalidateRect(_hwnd, NULL, FALSE); // refresh icon display
688 UpdateWindow(_hwnd);
689}
690
691#ifndef _NO_ALPHABLEND
692#ifdef _MSC_VER
693#pragma comment(lib, "msimg32") // for AlphaBlend()
694#endif
695#endif
696
698{
699 BufferedPaintCanvas canvas(_hwnd);
700
701 // first fill with the background color
702 FillRect(canvas, &canvas.rcPaint, GetSysColorBrush(COLOR_BTNFACE));
703
704 // draw icons
705 int x = NOTIFYICON_X;
706 int y = NOTIFYICON_Y;
707
708 if (_show_button) {
709 static SmallIcon leftArrowIcon(IDI_NOTIFY_L);
710 static SmallIcon rightArrowIcon(IDI_NOTIFY_R);
711
712 DrawIconEx(canvas, x, y, _show_hidden?rightArrowIcon:leftArrowIcon, NOTIFYICON_SIZE, NOTIFYICON_SIZE, 0, 0, DI_NORMAL);
714 }
715
716#ifndef _NO_ALPHABLEND
717 MemCanvas mem_dc;
718 SelectedBitmap bmp(mem_dc, CreateCompatibleBitmap(canvas, NOTIFYICON_SIZE, NOTIFYICON_SIZE));
720 BLENDFUNCTION blend = {AC_SRC_OVER, 0, 128, 0}; // 50 % visible
721#endif
722
724#ifndef _NO_ALPHABLEND
725 if (it->_dwState & NIS_HIDDEN) {
727 DrawIconEx(mem_dc, 0, 0, it->_hIcon, NOTIFYICON_SIZE, NOTIFYICON_SIZE, 0, 0, DI_NORMAL);
729 } else
730#endif
731 DrawIconEx(canvas, x, y, it->_hIcon, NOTIFYICON_SIZE, NOTIFYICON_SIZE, 0, 0, DI_NORMAL);
732
734 }
735}
736
737void NotifyArea::Refresh(bool update)
738{
739 // Look for task icons without valid owner window.
740 // This is an extended feature missing in MS Windows.
742 const NotifyInfo& entry = *it;
743
744 if (!IsWindow(entry._hWnd))
745 if (_icon_map.erase(entry)) // delete icons without valid owner window
746 ++update;
747 }
748
750
751 // handle icon hiding
752 for(NotifyIconMap::iterator it=_icon_map.begin(); it!=_icon_map.end(); ++it) {
753 NotifyInfo& entry = it->second;
754
756
757 switch(entry._mode) {
758 case NIM_HIDE:
759 if (!(entry._dwState & NIS_HIDDEN)) {
760 entry._dwState |= NIS_HIDDEN;
761 ++update;
762 }
763 break;
764
765 case NIM_SHOW:
766 if (entry._dwState&NIS_HIDDEN) {
767 entry._dwState &= ~NIS_HIDDEN;
768 ++update;
769 }
770 break;
771
772 case NIM_AUTO:
773 // automatically hide icons after long periods of inactivity
774 if (_hide_inactive)
775 if (!(entry._dwState & NIS_HIDDEN))
776 if (now-entry._lastChange > ICON_AUTOHIDE_SECONDS*1000) {
777 entry._dwState |= NIS_HIDDEN;
778 ++update;
779 }
780 break;
781 }
782 }
783
784 if (update)
785 UpdateIcons();
786}
787
790{
792 return _sorted_icons.end();
793
795
796 int x = NOTIFYICON_X;
797
798 if (_show_button)
800
801 for(; it!=_sorted_icons.end(); ++it) {
802 //NotifyInfo& entry = const_cast<NotifyInfo&>(*it); // Why does GCC 3.3 need this additional const_cast ?!
803
804 if (pos.x>=x && pos.x<x+NOTIFYICON_SIZE)
805 break;
806
808 }
809
810 return it;
811}
812
813
815{
816 _name = FmtString(TEXT("'%s' - '%s' - '%s'"), _tipText.c_str(), _windowTitle.c_str(), _modulePath.c_str());
817}
818
819
821{
822 if (!_tipText.empty() && !props._tipText.empty())
823 if (props._tipText == _tipText)
824 return true;
825
826 if (!_windowTitle.empty() && !props._windowTitle.empty())
827 if (_tcsstr(props._windowTitle, _windowTitle))
828 return true;
829
830 if (!_modulePath.empty() && !props._modulePath.empty())
831 if (!_tcsicmp(props._modulePath, _modulePath))
832 return true;
833
834 return false;
835}
836
838{
839 if (entry._modulePath.empty()) {
840 const String& modulePath = _window_modules[entry._hWnd];
841
842 // request module path for new windows (We will get an asynchronous answer by a WM_COPYDATA message.)
843 if (!modulePath.empty())
844 entry._modulePath = modulePath;
845 else
846 _hook.GetModulePath(entry._hWnd, _hwnd);
847 }
848
849 for(NotifyIconCfgList::const_iterator it=_cfg.begin(); it!=_cfg.end(); ++it) {
850 const NotifyIconConfig& cfg = *it;
851
852 if (cfg.match(entry)) {
853 entry._mode = cfg._mode;
854 return true;
855 }
856 }
857
858 return false;
859}
860
861
862
864{
865 switch(mode) {
866 case NIM_SHOW:
868
869 case NIM_HIDE:
871
872 default: //case NIM_AUTO
874 }
875}
876
877
879 : super(hwnd),
880 _tree_ctrl(GetDlgItem(hwnd, IDC_NOTIFY_ICONS)),
882 _pNotifyArea(static_cast<NotifyArea*>(Window::get_window((HWND)SendMessage(g_Globals._hwndDesktopBar, PM_GET_NOTIFYAREA, 0, 0))))
883{
884 _selectedItem = 0;
885
886 if (_pNotifyArea) {
887 // save original icon states and configuration data
889 _icon_states_org[it->first] = IconStatePair(it->second._mode, it->second._dwState);
890
893 }
894
896
898
899 {
900 WindowCanvas canvas(_hwnd);
901 HBRUSH hbkgnd = GetStockBrush(WHITE_BRUSH);
902
906 }
907
909
917
922
925
928
931
932 _resize_mgr.Resize(+150, +200);
933
934 Refresh();
935
936 SetTimer(_hwnd, 0, 3000, NULL);
938}
939
941{
942 KillTimer(_hwnd, 0);
945}
946
948{
950
951 HiddenWindow hide(_tree_ctrl);
952
954
955 TV_INSERTSTRUCT tvi;
956
957 tvi.hParent = 0;
958 tvi.hInsertAfter = TVI_LAST;
959
960 TV_ITEM& tv = tvi.item;
962
963 ResString str_cur(IDS_ITEMS_CUR);
964 tv.pszText = str_cur.str();
965 tv.iSelectedImage = tv.iImage = 0; // IDI_DOT
967
969 tv.pszText = str_conf.str();
970 tv.iSelectedImage = tv.iImage = 2; // IDI_DOT_RED
972
973 tvi.hParent = _hitemCurrent;
974
975 ResString str_visible(IDS_ITEMS_VISIBLE);
976 tv.pszText = str_visible.str();
977 tv.iSelectedImage = tv.iImage = 0; // IDI_DOT
979
980 ResString str_hidden(IDS_ITEMS_HIDDEN);
981 tv.pszText = str_hidden.str();
982 tv.iSelectedImage = tv.iImage = 1; // IDI_DOT_TRANS
984
985 if (_pNotifyArea) {
986 _info.clear();
987
988 tv.mask |= TVIF_PARAM;
989
990 WindowCanvas canvas(_hwnd);
991
992 // insert current (visible and hidden) items
994 const NotifyInfo& entry = it->second;
995
997 }
998
999 // insert configured items in tree view
1000 const NotifyIconCfgList& cfg = _pNotifyArea->_cfg;
1001 for(NotifyIconCfgList::const_iterator it=cfg.begin(); it!=cfg.end(); ++it) {
1002 const NotifyIconConfig& cfg_entry = *it;
1003
1004 HICON hicon = 0;
1005
1006 if (!cfg_entry._modulePath.empty()) {
1007 if ((int)ExtractIconEx(cfg_entry._modulePath, 0, NULL, &hicon, 1) <= 0)
1008 hicon = 0;
1009
1010 if (!hicon) {
1011 SHFILEINFO sfi;
1012
1013 if (SHGetFileInfo(cfg_entry._modulePath, 0, &sfi, sizeof(sfi), SHGFI_ICON|SHGFI_SMALLICON))
1014 hicon = sfi.hIcon;
1015 }
1016 }
1017
1018 InsertItem(_hitemConfig, TVI_SORT, cfg_entry, canvas, hicon, cfg_entry._mode);
1019
1020 if (hicon)
1021 DestroyIcon(hicon);
1022 }
1023
1025 }
1026
1031
1033}
1034
1036{
1037 InsertItem(hparent, after, entry, hdc, entry._hIcon, entry._mode);
1038}
1039
1042{
1043 int idx = _info.size() + 1;
1044 _info[idx] = entry;
1045
1046 String mode_str = string_from_mode(mode);
1047
1048 switch(mode) {
1049 case NIM_SHOW: mode_str = ResString(IDS_NOTIFY_SHOW); break;
1050 case NIM_HIDE: mode_str = ResString(IDS_NOTIFY_HIDE); break;
1051 case NIM_AUTO: mode_str = ResString(IDS_NOTIFY_AUTOHIDE);
1052 }
1053
1054 FmtString txt(TEXT("%s - %s [%s]"), entry._tipText.c_str(), entry._windowTitle.c_str(), mode_str.c_str());
1055
1056 TV_INSERTSTRUCT tvi;
1057
1058 tvi.hParent = hparent;
1059 tvi.hInsertAfter = after;
1060
1061 TV_ITEM& tv = tvi.item;
1063
1064 tv.lParam = (LPARAM)idx;
1065 tv.pszText = txt.str();
1066 tv.iSelectedImage = tv.iImage = ImageList_AddAlphaIcon(_himl, hicon, GetStockBrush(WHITE_BRUSH), hdc);
1068}
1069
1071{
1072 switch(nmsg) {
1073 case PM_TRANSLATE_MSG: {
1074 MSG* pmsg = (MSG*) lparam;
1075
1076 if (TranslateAccelerator(_hwnd, _haccel, pmsg))
1077 return TRUE;
1078
1079 return FALSE;}
1080
1081 case WM_TIMER:
1082 Refresh();
1083 break;
1084
1085 default:
1086 return super::WndProc(nmsg, wparam, lparam);
1087 }
1088
1089 return 0;
1090}
1091
1093{
1094 if (code == BN_CLICKED) {
1095 switch(id) {
1096 case ID_REFRESH:
1097 Refresh();
1098 break;
1099
1100 case IDC_NOTIFY_SHOW:
1102 break;
1103
1104 case IDC_NOTIFY_HIDE:
1106 break;
1107
1110 break;
1111
1113 if (_pNotifyArea)
1115 break;
1116
1117 case IDOK:
1118 EndDialog(_hwnd, id);
1119 break;
1120
1121 case IDCANCEL:
1122 // rollback changes
1123 if (_pNotifyArea) {
1124 // restore original icon states and configuration data
1127
1129 NotifyInfo& info = _pNotifyArea->_icon_map[it->first];
1130
1131 info._mode = it->second.first;
1132 info._dwState = it->second.second;
1133 }
1134
1136 }
1137
1138 EndDialog(_hwnd, id);
1139 break;
1140 }
1141
1142 return 0;
1143 }
1144
1145 return 1;
1146}
1147
1149{
1150 switch(pnmh->code) {
1151 case TVN_SELCHANGED: {
1152 NMTREEVIEW* pnmtv = (NMTREEVIEW*)pnmh;
1153 int idx = pnmtv->itemNew.lParam;
1154
1155 if (idx) {
1157 _selectedItem = pnmtv->itemNew.hItem;
1158 } else {
1159 /*
1160 SetDlgItemText(_hwnd, IDC_NOTIFY_TOOLTIP, NULL);
1161 SetDlgItemText(_hwnd, IDC_NOTIFY_TITLE, NULL);
1162 SetDlgItemText(_hwnd, IDC_NOTIFY_MODULE, NULL);
1163 */
1165 }
1166 break;}
1167 }
1168
1169 return 0;
1170}
1171
1173{
1174 SetDlgItemText(_hwnd, IDC_NOTIFY_TOOLTIP, entry._tipText);
1175 SetDlgItemText(_hwnd, IDC_NOTIFY_TITLE, entry._windowTitle);
1176 SetDlgItemText(_hwnd, IDC_NOTIFY_MODULE, entry._modulePath);
1177
1179
1180 String change_str;
1181 if (entry._lastChange)
1182 change_str.printf(TEXT("before %d s"), (GetTickCount()-entry._lastChange+500)/1000);
1183 SetDlgItemText(_hwnd, IDC_LAST_CHANGE, change_str);
1184
1185 HICON hicon = 0; //get_window_icon_big(entry._hWnd, false);
1186
1187 // If we could not find an icon associated with the owner window, try to load one from the owning module.
1188 if (!hicon && !entry._modulePath.empty()) {
1189 hicon = ExtractIcon(g_Globals._hInstance, entry._modulePath, 0);
1190
1191 if (!hicon) {
1192 SHFILEINFO sfi;
1193
1194 if (SHGetFileInfo(entry._modulePath, 0, &sfi, sizeof(sfi), SHGFI_ICON|SHGFI_LARGEICON))
1195 hicon = sfi.hIcon;
1196 }
1197 }
1198
1199 if (hicon) {
1201 DestroyIcon(hicon);
1202 } else
1204}
1205
1207{
1209
1210 if (!idx)
1211 return;
1212
1214
1215 if (entry._mode != mode) {
1216 entry._mode = mode;
1217
1218 // trigger refresh in notify area and this dialog
1219 if (_pNotifyArea)
1221 }
1222
1223 if (_pNotifyArea) {
1224 bool found = false;
1225
1227 for(NotifyIconCfgList::iterator it=cfg.begin(); it!=cfg.end(); ++it) {
1228 NotifyIconConfig& cfg_entry = *it;
1229
1230 if (cfg_entry.match(entry)) {
1231 cfg_entry._mode = mode;
1232 ++found;
1233 break;
1234 }
1235 }
1236
1237 if (!found) {
1238 // insert new configuration entry
1239 NotifyIconConfig cfg_entry = entry;
1240
1241 cfg_entry._mode = mode;
1242
1243 _pNotifyArea->_cfg.push_back(cfg_entry);
1244 }
1245 }
1246
1247 Refresh();
1249}
1250
1251
1253 : super(hwnd),
1254 _tooltip(hwnd)
1255{
1256 *_time = TEXT('\0');
1257 FormatTime();
1258
1259 _tooltip.add(_hwnd, _hwnd);
1260}
1261
1263{
1265
1266 ClientRect clnt(hwndParent);
1267
1268 WindowCanvas canvas(hwndParent);
1269 FontSelection font(canvas, GetStockFont(ANSI_VAR_FONT));
1270
1271 RECT rect = {0, 0, 0, 0};
1272 TCHAR buffer[16];
1273 // Arbitrary high time so that the created clock window is big enough
1274 SYSTEMTIME st = { 1601, 1, 0, 1, 23, 59, 59, 999 };
1275
1277 _tcscpy(buffer, TEXT("00:00"));
1278
1279 // Calculate the rectangle needed to draw the time (without actually drawing it)
1281 int clockwindowWidth = rect.right-rect.left + 4;
1282
1284 wcClock, NULL, WS_CHILD|WS_VISIBLE,
1285 clnt.right-(clockwindowWidth), 1, clockwindowWidth, clnt.bottom-2, hwndParent);
1286}
1287
1289{
1290 switch(nmsg) {
1291 case WM_PAINT:
1292 Paint();
1293 break;
1294
1295 case WM_LBUTTONDBLCLK:
1296 launch_cpanel(_hwnd, TEXT("timedate.cpl"));
1297 break;
1298
1299 default:
1300 return super::WndProc(nmsg, wparam, lparam);
1301 }
1302
1303 return 0;
1304}
1305
1306int ClockWindow::Notify(int id, NMHDR* pnmh)
1307{
1308 if (pnmh->code == TTN_GETDISPINFO) {
1310
1311 SYSTEMTIME systime;
1312 TCHAR buffer[64];
1313
1314 GetLocalTime(&systime);
1315
1317 _tcscpy(pdi->szText, buffer);
1318 else
1319 pdi->szText[0] = '\0';
1320 }
1321
1322 return 0;
1323}
1324
1326{
1327 if (FormatTime())
1328 InvalidateRect(_hwnd, NULL, TRUE); // refresh displayed time
1329}
1330
1332{
1333 TCHAR buffer[16];
1334
1336 if (_tcscmp(buffer, _time)) {
1338 return true; // The text to display has changed.
1339 }
1340
1341 return false; // no change
1342}
1343
1345{
1346 PaintCanvas canvas(_hwnd);
1347
1348 FillRect(canvas, &canvas.rcPaint, GetSysColorBrush(COLOR_BTNFACE));
1349
1350 BkMode bkmode(canvas, TRANSPARENT);
1351 FontSelection font(canvas, GetStockFont(ANSI_VAR_FONT));
1352
1353 DrawText(canvas, _time, -1, ClientRect(_hwnd), DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX);
1354}
#define MOVE(x, y)
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define ID_REFRESH
Definition: resource.h:16
#define RegCloseKey(hKey)
Definition: registry.h:49
r l[0]
Definition: byte_order.h:168
void push_back(const_reference __x)
Definition: _list.h:509
_STLP_PRIV _List_iterator< NotifyIconConfig, _Const_traits< NotifyIconConfig > > const_iterator
Definition: _list.h:276
iterator begin()
Definition: _list.h:367
_STLP_PRIV _List_iterator< NotifyIconConfig, _Nonconst_traits< NotifyIconConfig > > iterator
Definition: _list.h:275
iterator end()
Definition: _list.h:370
_STLP_TEMPLATE_FOR_CONT_EXT iterator find(const _KT &__x)
Definition: _map.h:210
void clear()
Definition: _map.h:206
iterator end()
Definition: _map.h:165
_Rep_type::iterator iterator
Definition: _map.h:85
size_type size() const
Definition: _map.h:172
iterator begin()
Definition: _map.h:163
void erase(iterator __pos)
Definition: _map.h:203
_Rep_type::const_iterator const_iterator
Definition: _map.h:86
iterator end()
Definition: _set.h:152
iterator begin()
Definition: _set.h:151
pair< iterator, bool > insert(const value_type &__x)
Definition: _set.h:168
void clear()
Definition: _set.h:185
_Rep_type::const_iterator const_iterator
Definition: _set.h:74
size_type size() const
Definition: _set.h:160
_Rep_type::iterator iterator
Definition: _set.h:73
static HWND hwndParent
Definition: cryptui.c:300
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDI_DOT
Definition: resource.h:10
unsigned int idx
Definition: utils.c:41
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
#define pt(x, y)
Definition: drawing.c:79
#define PM_REFRESH_CONFIG
Definition: explorer.h:70
#define PM_RESIZE_CHILDREN
Definition: explorer.h:66
#define PM_REFRESH
Definition: explorer.h:69
#define PM_GET_WIDTH
Definition: explorer.h:67
unsigned long DWORD
Definition: ntddk_ex.h:95
time_t now
Definition: finger.c:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint buffer
Definition: glext.h:5915
GLenum mode
Definition: glext.h:6217
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
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
Definition: glfuncs.h:52
#define _tcscmp
Definition: tchar.h:1424
#define _tcscpy
Definition: tchar.h:623
uint32_t entry
Definition: isohybrid.c:63
#define TEXT(s)
Definition: k32.h:26
void Refresh(void)
Definition: magnifier.c:317
void SetWindowIcon(HWND hwnd, UINT nid)
set big and small icons out of the resources for a window
Definition: explorer.cpp:689
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
Definition: explorer.cpp:366
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define IDS_HIDE_ICONS
Definition: resource.h:48
#define IDC_NOTIFY_HIDE
Definition: resource.h:169
#define IDC_LABEL4
Definition: resource.h:171
#define IDS_ITEMS_CONFIGURED
Definition: resource.h:41
#define IDS_NOTIFY_HIDE
Definition: resource.h:45
#define IDS_ITEMS_CUR
Definition: resource.h:40
#define IDC_NOTIFY_TITLE
Definition: resource.h:151
#define ID_SHOW_ICON_BUTTON
Definition: resource.h:223
#define IDC_LAST_CHANGE
Definition: resource.h:164
#define IDS_NOTIFY_SHOW
Definition: resource.h:44
#define IDS_ITEMS_HIDDEN
Definition: resource.h:43
#define IDM_NOTIFYAREA
Definition: resource.h:97
#define IDC_LABEL3
Definition: resource.h:159
#define IDC_NOTIFY_ICONS
Definition: resource.h:145
#define IDC_LABEL1
Definition: resource.h:155
#define IDI_DOT_RED
Definition: resource.h:117
#define IDS_ITEMS_VISIBLE
Definition: resource.h:42
#define IDC_LABEL2
Definition: resource.h:157
#define IDC_NOTIFY_SHOW
Definition: resource.h:168
#define IDC_NOTIFY_AUTOHIDE
Definition: resource.h:170
#define IDC_PICTURE
Definition: resource.h:167
#define IDI_DOT_TRANS
Definition: resource.h:116
#define IDI_NOTIFY_L
Definition: resource.h:120
#define IDA_TRAYNOTIFY
Definition: resource.h:79
#define IDC_NOTIFY_TOOLTIP
Definition: resource.h:149
#define IDS_NOTIFY_AUTOHIDE
Definition: resource.h:46
#define IDS_SHOW_HIDDEN_ICONS
Definition: resource.h:47
#define ID_CONFIG_NOTIFYAREA
Definition: resource.h:218
#define ID_CONFIG_TIME
Definition: resource.h:219
#define IDD_NOTIFYAREA
Definition: resource.h:103
#define ID_SHOW_HIDDEN_ICONS
Definition: resource.h:217
#define IDC_NOTIFY_MODULE
Definition: resource.h:153
#define IDI_NOTIFY_R
Definition: resource.h:121
#define IDC_LABEL6
Definition: resource.h:162
BOOL launch_cpanel(HWND hwnd, LPCTSTR applet)
Definition: utility.cpp:383
#define COUNTOF(x)
Definition: utility.h:93
#define GET_WINDOW(CLASS, hwnd)
Definition: window.h:88
#define PM_TRANSLATE_MSG
Definition: window.h:266
#define WINDOW_CREATOR(WND_CLASS)
Definition: window.h:202
LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
Definition: window.h:968
@ MOVE_Y
Definition: window.h:462
@ RESIZE_X
Definition: window.h:463
@ RESIZE
Definition: window.h:467
BITMAP bmp
Definition: alphablend.c:62
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static HICON
Definition: imagelist.c:84
Definition: mk_font.cpp:20
unsigned int UINT
Definition: ndis.h:50
void DeinstallNotifyHook()
Definition: notifyhook.c:90
DECL_NOTIFYHOOK int GetWindowModulePathCopyData(LPARAM lparam, HWND *phwnd, LPSTR buffer, int size)
Definition: notifyhook.c:103
static UINT WM_GETMODULEPATH
Definition: notifyhook.c:35
UINT InstallNotifyHook()
Definition: notifyhook.c:83
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define LOCALE_USER_DEFAULT
#define IDI_REACTOS
Definition: osk_res.h:21
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
short SHORT
Definition: pedump.c:59
#define WS_CLIPCHILDREN
Definition: pedump.c:619
static char title[]
Definition: ps.c:92
#define TVN_SELCHANGED
Definition: commctrl.h:3735
#define TVI_LAST
Definition: commctrl.h:3370
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3417
#define TVIF_TEXT
Definition: commctrl.h:3266
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3420
#define TVIF_IMAGE
Definition: commctrl.h:3267
#define LPNMTTDISPINFO
Definition: commctrl.h:1915
#define TVSIL_NORMAL
Definition: commctrl.h:3443
#define TreeView_EnsureVisible(hwnd, hitem)
Definition: commctrl.h:3545
_Out_opt_ int * cx
Definition: commctrl.h:585
#define TTN_GETDISPINFO
Definition: commctrl.h:1878
#define TVE_EXPAND
Definition: commctrl.h:3423
#define TV_INSERTSTRUCT
Definition: commctrl.h:3377
#define NMTREEVIEW
Definition: commctrl.h:3642
#define TV_ITEM
Definition: commctrl.h:3300
#define TVI_SORT
Definition: commctrl.h:3371
#define TVIF_PARAM
Definition: commctrl.h:3268
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3447
#define ILC_COLOR24
Definition: commctrl.h:357
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3412
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3271
#define TTM_SETMAXTIPWIDTH
Definition: commctrl.h:1819
#define WM_CONTEXTMENU
Definition: richedit.h:64
const WCHAR * str
static CHANGE * changes
Definition: io.c:49
#define SHGetFileInfo
Definition: shellapi.h:694
#define SHGFI_LARGEICON
Definition: shellapi.h:172
#define SHGFI_ICON
Definition: shellapi.h:161
#define ExtractIconEx
Definition: shellapi.h:686
#define SHGFI_SMALLICON
Definition: shellapi.h:173
#define NIM_DELETE
Definition: shellapi.h:93
#define ExtractIcon
Definition: shellapi.h:685
#define NIM_MODIFY
Definition: shellapi.h:92
#define NIF_ICON
Definition: shellapi.h:103
#define NIF_MESSAGE
Definition: shellapi.h:102
#define NIM_ADD
Definition: shellapi.h:91
#define NIF_TIP
Definition: shellapi.h:104
@ REST_HIDECLOCK
Definition: shlobj.h:1787
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:146
& rect
Definition: startmenu.cpp:1413
window class with gray background color
Definition: window.h:249
window for displaying the time in the tray notification area
Definition: traynotify.h:239
TCHAR _time[16]
Definition: traynotify.h:255
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
void TimerTick()
bool FormatTime()
ClockWindow(HWND hwnd)
int Notify(int id, NMHDR *pnmh)
static HWND Create(HWND hwndParent)
ToolTip _tooltip
Definition: traynotify.h:256
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0)
Definition: window.cpp:701
HINSTANCE _hInstance
Definition: globals.h:270
XMLPos get_cfg()
Definition: explorer.cpp:119
tray notification area aka "tray"
Definition: traynotify.h:131
int _next_idx
Definition: traynotify.h:176
bool DetermineHideState(NotifyInfo &entry)
Definition: traynotify.cpp:837
void show_clock(bool flag)
Definition: traynotify.cpp:332
bool _show_button
Definition: traynotify.h:150
size_t _last_icon_count
Definition: traynotify.h:177
void CancelModes()
Definition: traynotify.cpp:572
NotifyIconSet::iterator IconHitTest(const POINT &pos)
search for a icon at a given client coordinate position
Definition: traynotify.cpp:789
NotifyHook _hook
Definition: traynotify.h:146
void Refresh(bool do_refresh=false)
Definition: traynotify.cpp:737
NotifyIconMap _icon_map
Definition: traynotify.h:174
ToolTip _tooltip
Definition: traynotify.h:145
LRESULT ProcessTrayNotification(int notify_code, NOTIFYICONDATA *pnid)
Definition: traynotify.cpp:580
bool _hide_inactive
Definition: traynotify.h:149
NotifyArea(HWND hwnd)
Definition: traynotify.cpp:204
int Notify(int id, NMHDR *pnmh)
Definition: traynotify.cpp:539
void UpdateIcons()
Definition: traynotify.cpp:646
void write_config()
Definition: traynotify.cpp:294
bool _show_hidden
Definition: traynotify.h:148
void read_config()
Definition: traynotify.cpp:243
int _clock_width
Definition: traynotify.h:143
NotifyIconSet _sorted_icons
Definition: traynotify.h:175
NotifyIconCfgList _cfg
Definition: traynotify.h:170
LRESULT Init(LPCREATESTRUCT pcs)
Definition: traynotify.cpp:355
void Paint()
Definition: traynotify.cpp:697
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: traynotify.cpp:378
map< HWND, String > _window_modules
Definition: traynotify.h:172
static HWND Create(HWND hwndParent)
Definition: traynotify.cpp:367
int Command(int id, int code)
Definition: traynotify.cpp:511
WindowHandle _hwndClock
Definition: traynotify.h:142
bool ModulePathCopyData(LPARAM lparam, HWND *phwnd, String &path)
Definition: traynotify.cpp:50
const UINT WM_GETMODULEPATH
Definition: traynotify.h:125
void GetModulePath(HWND hwnd, HWND hwndCallback)
Definition: traynotify.cpp:45
configuration for the display mode of a notification icon
Definition: traynotify.h:72
String _windowTitle
Definition: traynotify.h:80
bool match(const NotifyIconConfig &props) const
Definition: traynotify.cpp:820
String _modulePath
Definition: traynotify.h:81
NOTIFYICONMODE _mode
Definition: traynotify.h:83
structure for maintaining informations about one notification icon
Definition: traynotify.h:94
UINT _uCallbackMessage
Definition: traynotify.h:106
DWORD _dwState
Definition: traynotify.h:105
UINT _version
Definition: traynotify.h:107
bool modify(NOTIFYICONDATA *pnid)
Definition: traynotify.cpp:104
DWORD _lastChange
Definition: traynotify.h:109
HICON _hIcon
Definition: traynotify.h:104
convenient loading of string resources
Definition: globals.h:304
ResizeManager _resize_mgr
Definition: window.h:563
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.h:525
void Resize(int dx, int dy)
Definition: window.cpp:847
void Add(UINT id, int flags)
Definition: window.h:491
convenient loading of small (16x16) icon resources
Definition: globals.h:321
void add(HWND hparent, HWND htool, LPCTSTR txt=LPSTR_TEXTCALLBACK, LPARAM lparam=0)
Definition: window.h:861
void remove(HWND hparent, HWND htool)
Definition: window.h:893
configuration dialog for notification icons
Definition: traynotify.h:199
void SetIconMode(NOTIFYICONMODE mode)
virtual int Notify(int id, NMHDR *pnmh)
NotifyIconDlgInfoMap _info
Definition: traynotify.h:210
HTREEITEM _hitemCurrent_hidden
Definition: traynotify.h:221
void RefreshProperties(const NotifyIconDlgInfo &entry)
TrayNotifyDlg(HWND hwnd)
Definition: traynotify.cpp:878
HTREEITEM _selectedItem
Definition: traynotify.h:223
HTREEITEM _hitemCurrent_visible
Definition: traynotify.h:220
bool _show_hidden_org
Definition: traynotify.h:217
HTREEITEM _hitemConfig
Definition: traynotify.h:222
HIMAGELIST _himl
Definition: traynotify.h:208
HTREEITEM _hitemCurrent
Definition: traynotify.h:219
IconStateMap _icon_states_org
Definition: traynotify.h:216
NotifyIconCfgList _cfg_org
Definition: traynotify.h:215
pair< NOTIFYICONMODE, DWORD > IconStatePair
Definition: traynotify.h:212
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
NotifyArea * _pNotifyArea
Definition: traynotify.h:209
virtual int Command(int id, int code)
HACCEL _haccel
Definition: traynotify.h:207
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo &, HDC)
Definition: window.c:28
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:280
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)
Definition: window.cpp:87
LRESULT SendParent(UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
Definition: window.cpp:657
static void register_pretranslate(HWND hwnd)
Definition: window.cpp:579
static void unregister_pretranslate(HWND hwnd)
Definition: window.cpp:584
virtual LRESULT Init(LPCREATESTRUCT pcs)
Definition: window.cpp:241
UINT uCallbackMessage
Definition: shellapi.h:228
DWORD dwStateMask
Definition: shellapi.h:236
CHAR szTip[128]
Definition: shellapi.h:234
HICON hIcon
Definition: shellapi.h:362
Definition: inflate.c:139
UINT code
Definition: winuser.h:3159
HWND hwndFrom
Definition: winuser.h:3157
__inline int after(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2395
#define NID_SIZE_W6
Definition: traynotify.cpp:95
String string_from_mode(NOTIFYICONMODE mode)
Definition: traynotify.cpp:863
#define NID_SIZE_A5
Definition: traynotify.cpp:101
#define NID_SIZE_W3
Definition: traynotify.cpp:97
#define NID_SIZE_A6
Definition: traynotify.cpp:100
static bool get_hide_clock_from_registry()
Definition: traynotify.cpp:223
#define NID_SIZE_W5
Definition: traynotify.cpp:96
#define NID_SIZE_A3
Definition: traynotify.cpp:102
#define NOTIFYAREA_SPACE
Definition: traynotify.h:36
#define NOTIFYAREA_WIDTH_DEF
Definition: traynotify.h:34
#define NOTIFYICON_Y
Definition: traynotify.h:39
String string_from_mode(NOTIFYICONMODE mode)
Definition: traynotify.cpp:863
#define NOTIFYICON_X
Definition: traynotify.h:38
NOTIFYICONMODE
Definition: traynotify.h:64
@ NIM_SHOW
Definition: traynotify.h:65
@ NIM_HIDE
Definition: traynotify.h:65
@ NIM_AUTO
Definition: traynotify.h:65
#define CLASSNAME_CLOCKWINDOW
Definition: traynotify.h:32
#define NOTIFYICON_SIZE
Definition: traynotify.h:37
#define ICON_AUTOHIDE_SECONDS
Definition: traynotify.h:41
#define TITLE_TRAYNOTIFY
Definition: traynotify.h:30
#define PM_GET_NOTIFYAREA
Definition: traynotify.h:44
#define NOTIFYICON_DIST
Definition: traynotify.h:35
#define CLASSNAME_TRAYNOTIFY
Definition: traynotify.h:29
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
unsigned char * LPBYTE
Definition: typedefs.h:53
#define MAKELONG(a, b)
Definition: typedefs.h:249
Definition: dlist.c:348
static const WCHAR props[]
Definition: wbemdisp.c:288
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
#define AlphaBlend
Definition: misc.c:293
BOOL WINAPI AllowSetForegroundWindow(DWORD dwProcessId)
Definition: window.c:49
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO * pdi
Definition: winddi.h:3554
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define GetStockBrush(i)
Definition: windowsx.h:307
#define GetStockFont(i)
Definition: windowsx.h:308
#define AC_SRC_OVER
Definition: wingdi.h:1369
#define ANSI_VAR_FONT
Definition: wingdi.h:907
#define DI_NORMAL
Definition: wingdi.h:72
#define TRANSPARENT
Definition: wingdi.h:950
#define WHITE_BRUSH
Definition: wingdi.h:902
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define GetTimeFormat
Definition: winnls.h:1189
#define TIME_NOSECONDS
Definition: winnls.h:278
#define DATE_LONGDATE
Definition: winnls.h:197
#define GetDateFormat
Definition: winnls.h:1184
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegQueryValueEx
Definition: winreg.h:524
#define RegOpenKey
Definition: winreg.h:519
#define WM_PAINT
Definition: winuser.h:1620
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
#define WS_EX_STATICEDGE
Definition: winuser.h:403
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define MF_BYCOMMAND
Definition: winuser.h:202
#define DT_NOPREFIX
Definition: winuser.h:537
#define WM_MOUSEFIRST
Definition: winuser.h:1774
#define WM_MOUSELAST
Definition: winuser.h:1801
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define STM_SETICON
Definition: winuser.h:2092
#define IDCANCEL
Definition: winuser.h:831
#define BST_UNCHECKED
Definition: winuser.h:199
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WM_SIZE
Definition: winuser.h:1611
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define HWND_BROADCAST
Definition: winuser.h:1204
#define WM_CANCELMODE
Definition: winuser.h:1635
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1778
#define WM_COMMAND
Definition: winuser.h:1740
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define SM_CYSMICON
Definition: winuser.h:1013
#define MF_CHECKED
Definition: winuser.h:132
#define SWP_NOSIZE
Definition: winuser.h:1245
#define WM_MOUSEMOVE
Definition: winuser.h:1775
#define CS_DBLCLKS
Definition: winuser.h:651
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1987
#define MF_UNCHECKED
Definition: winuser.h:204
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define DrawText
Definition: winuser.h:5771
#define WM_RBUTTONDOWN
Definition: winuser.h:1779
#define SM_CXSMICON
Definition: winuser.h:1012
#define WM_TIMER
Definition: winuser.h:1742
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2028
BOOL WINAPI UpdateWindow(_In_ HWND)
#define WM_COPYDATA
Definition: winuser.h:1664
#define SendMessage
Definition: winuser.h:5843
#define GetWindowText
Definition: winuser.h:5798
#define DT_VCENTER
Definition: winuser.h:543
#define PostMessage
Definition: winuser.h:5832
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define BN_CLICKED
Definition: winuser.h:1925
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define SWP_NOZORDER
Definition: winuser.h:1247
#define DT_CALCRECT
Definition: winuser.h:526
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define TranslateAccelerator
Definition: winuser.h:5860
BOOL WINAPI DestroyWindow(_In_ HWND)
#define MAKEINTRESOURCE
Definition: winuser.h:591
int WINAPI GetSystemMetrics(_In_ int)
#define SetDlgItemText
Definition: winuser.h:5849
#define LoadAccelerators
Definition: winuser.h:5810
#define WM_MBUTTONDOWN
Definition: winuser.h:1782
#define BST_CHECKED
Definition: winuser.h:197
#define COLOR_BTNFACE
Definition: winuser.h:928
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2053
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
char TCHAR
Definition: xmlstorage.h:189
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define _tcsstr
Definition: xmlstorage.h:199
#define _tcsicmp
Definition: xmlstorage.h:205