ReactOS 0.4.16-dev-320-g3bd9ddc
TrayNotifyDlg Struct Reference

configuration dialog for notification icons More...

#include <traynotify.h>

Inheritance diagram for TrayNotifyDlg:
Collaboration diagram for TrayNotifyDlg:

Public Types

typedef ResizeController< Dialogsuper
 
- Public Types inherited from ResizeController< Dialog >
typedef Dialog super
 
- Public Types inherited from Dialog
typedef Window super
 
- Public Types inherited from Window
typedef map< HWND, Window * > WindowMap
 
typedef Window *(* CREATORFUNC) (HWND)
 
typedef Window *(* CREATORFUNC_INFO) (HWND, const void *)
 

Public Member Functions

 TrayNotifyDlg (HWND hwnd)
 
 ~TrayNotifyDlg ()
 
- Public Member Functions inherited from ResizeController< Dialog >
 ResizeController (HWND hwnd)
 
LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
virtual void GetClientSpace (PRECT prect)
 
- Public Member Functions inherited from Dialog
 Dialog (HWND)
 
 ~Dialog ()
 
- Public Member Functions inherited from Window
 Window (HWND hwnd)
 
virtual ~Window ()
 
LRESULT SendParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 
LRESULT PostParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 
 Window (INT cx, INT cy, BOOL fAutoHide=FALSE)
 
virtual ~Window ()
 
virtual LRESULT CALLBACK WindowProcDx (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void DoAction ()
 

Protected Types

typedef pair< NOTIFYICONMODE, DWORDIconStatePair
 
typedef map< NotifyIconIndex, IconStatePairIconStateMap
 

Protected Member Functions

virtual LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
virtual int Command (int id, int code)
 
virtual int Notify (int id, NMHDR *pnmh)
 
void Refresh ()
 
void InsertItem (HTREEITEM hparent, HTREEITEM after, const NotifyInfo &, HDC)
 
void InsertItem (HTREEITEM hparent, HTREEITEM after, const NotifyIconDlgInfo &, HDC, HICON, NOTIFYICONMODE)
 
void SetIconMode (NOTIFYICONMODE mode)
 
void RefreshProperties (const NotifyIconDlgInfo &entry)
 
- Protected Member Functions inherited from Dialog
LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
int Command (int id, int code)
 
- Protected Member Functions inherited from Window
virtual LRESULT Init (LPCREATESTRUCT pcs)
 
virtual LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
virtual int Command (int id, int code)
 
virtual int Notify (int id, NMHDR *pnmh)
 
void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
void OnPaint (HWND hwnd)
 
void OnRButtonDown (HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
 
void OnKey (HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags)
 
void OnAppBarCallback (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL AppBar_Register (HWND hwnd)
 
BOOL AppBar_UnRegister (HWND hwnd)
 
BOOL AppBar_SetAutoHide (HWND hwnd, BOOL fHide)
 
BOOL AppBar_AutoHide (HWND hwnd)
 
BOOL AppBar_NoAutoHide (HWND hwnd)
 
BOOL AppBar_SetSide (HWND hwnd, UINT uSide)
 
void AppBar_SetAlwaysOnTop (HWND hwnd, BOOL fOnTop)
 
void AppBar_Hide (HWND hwnd)
 
void AppBar_UnHide (HWND hwnd)
 
void AppBar_SetAutoHideTimer (HWND hwnd)
 
void AppBar_SetAutoUnhideTimer (HWND hwnd)
 
void AppBar_Size (HWND hwnd)
 
void AppBar_QueryPos (HWND hwnd, LPRECT lprc)
 
void AppBar_QuerySetPos (UINT uEdge, LPRECT lprc, PAPPBARDATA pabd, BOOL fMove)
 
void AppBar_PosChanged (PAPPBARDATA pabd)
 
BOOL OnCreate (HWND hwnd, LPCREATESTRUCT lpCreateStruct)
 
void OnActivate (HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized)
 
void OnWindowPosChanged (HWND hwnd, const LPWINDOWPOS lpwpos)
 
void OnSize (HWND hwnd, UINT state, int cx, int cy)
 
void OnMove (HWND hwnd, int x, int y)
 
void OnNCDestroy (HWND hwnd)
 
void OnTimer (HWND hwnd, UINT id)
 
UINT OnNCHitTest (HWND hwnd, int x, int y)
 
void OnLButtonDown (HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
 
void OnMouseMove (HWND hwnd, int x, int y, UINT keyFlags)
 
void OnLButtonUp (HWND hwnd, int x, int y, UINT keyFlags)
 
void GetWorkArea (LPRECT prc) const
 

Protected Attributes

HWND _tree_ctrl
 
HACCEL _haccel
 
HIMAGELIST _himl
 
NotifyArea_pNotifyArea
 
NotifyIconDlgInfoMap _info
 
NotifyIconCfgList _cfg_org
 
IconStateMap _icon_states_org
 
bool _show_hidden_org
 
HTREEITEM _hitemCurrent
 
HTREEITEM _hitemCurrent_visible
 
HTREEITEM _hitemCurrent_hidden
 
HTREEITEM _hitemConfig
 
HTREEITEM _selectedItem
 
- Protected Attributes inherited from ResizeController< Dialog >
ResizeManager _resize_mgr
 
- Protected Attributes inherited from Window
HWND m_hwnd
 
BOOL m_fAutoHide
 
BOOL m_fOnTop
 
BOOL m_fHiding
 
UINT m_uSide
 
LONG m_cxWidth
 
LONG m_cyHeight
 
LONG m_cxSave
 
LONG m_cySave
 
BOOL m_fAppBarRegd
 
BOOL m_fMoving
 
BOOL m_bDragged
 
POINT m_ptDragOn
 
RECT m_rcAppBar
 
RECT m_rcDrag
 

Additional Inherited Members

- Static Public Member Functions inherited from Dialog
static int DoModal (UINT nid, CREATORFUNC creator, HWND hwndParent=0)
 
static int DoModal (UINT nid, CREATORFUNC_INFO creator, const void *info, HWND hwndParent=0)
 
- Static Public Member Functions inherited from Window
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)
 
static HWND Create (CREATORFUNC_INFO creator, const void *info, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
 
static Windowcreate_mdi_child (const ChildWndInfo &info, const MDICREATESTRUCT &mcs, CREATORFUNC_INFO creator)
 
static LRESULT CALLBACK WindowWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK DialogProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static Windowget_window (HWND hwnd)
 get window controller from window handle
 
template<typename CLASS >
static CLASS * get_window (HWND hwnd)
 
static void register_pretranslate (HWND hwnd)
 
static void unregister_pretranslate (HWND hwnd)
 
static BOOL pretranslate_msg (LPMSG pmsg)
 
static void register_dialog (HWND hwnd)
 
static void unregister_dialog (HWND hwnd)
 
static BOOL dispatch_dialog_msg (LPMSG pmsg)
 
static int MessageLoop ()
 
static void CancelModes ()
 
static BOOL DoRegisterClass (HINSTANCE hInstance)
 
static HWND DoCreateMainWnd (HINSTANCE hInstance, LPCTSTR pszText, INT cx, INT cy, DWORD style=WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN, DWORD exstyle=WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_TOPMOST, BOOL fAutoHide=FALSE)
 
static INT DoMainLoop ()
 
static WindowGetAppbarData (HWND hwnd)
 
static LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static DWORD WINAPI ActionThreadFunc (LPVOID args)
 
- Public Attributes inherited from Window
IAccessible IAccessible_iface
 
IOleWindow IOleWindow_iface
 
IEnumVARIANT IEnumVARIANT_iface
 
LONG ref
 
- Static Protected Member Functions inherited from Window
static Windowcreate_controller (HWND hwnd)
 create controller for a new window
 
static StaticWindowDataGetStaticWindowData ()
 
static LRESULT CALLBACK MDICBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK PropSheetCBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 
- Static Protected Attributes inherited from Window
static WindowMap s_wnd_map
 
static const voids_new_info = NULL
 
static CREATORFUNC s_window_creator = NULL
 
static HHOOK s_hcbtHook = 0
 
static WindowSet s_pretranslate_windows
 
static WindowSet s_dialogs
 

Detailed Description

configuration dialog for notification icons

Definition at line 198 of file traynotify.h.

Member Typedef Documentation

◆ IconStateMap

Definition at line 213 of file traynotify.h.

◆ IconStatePair

Definition at line 212 of file traynotify.h.

◆ super

Definition at line 200 of file traynotify.h.

Constructor & Destructor Documentation

◆ TrayNotifyDlg()

TrayNotifyDlg::TrayNotifyDlg ( HWND  hwnd)

Definition at line 878 of file traynotify.cpp.

879 : super(hwnd),
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}
#define MOVE(x, y)
iterator end()
Definition: _map.h:165
iterator begin()
Definition: _map.h:163
_Rep_type::const_iterator const_iterator
Definition: _map.h:86
#define NULL
Definition: types.h:112
#define IDI_DOT
Definition: resource.h:10
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
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 IDC_NOTIFY_HIDE
Definition: resource.h:169
#define IDC_LABEL4
Definition: resource.h:171
#define IDC_NOTIFY_TITLE
Definition: resource.h:151
#define IDC_LAST_CHANGE
Definition: resource.h:164
#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 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 IDA_TRAYNOTIFY
Definition: resource.h:79
#define IDC_NOTIFY_TOOLTIP
Definition: resource.h:149
#define ID_SHOW_HIDDEN_ICONS
Definition: resource.h:217
#define IDC_NOTIFY_MODULE
Definition: resource.h:153
#define IDC_LABEL6
Definition: resource.h:162
@ MOVE_Y
Definition: window.h:462
@ RESIZE_X
Definition: window.h:463
@ RESIZE
Definition: window.h:467
#define IDI_REACTOS
Definition: osk_res.h:21
#define TVSIL_NORMAL
Definition: commctrl.h:3448
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3452
#define ILC_COLOR24
Definition: commctrl.h:357
HINSTANCE _hInstance
Definition: globals.h:270
HWND _hwndDesktopBar
Definition: globals.h:287
tray notification area aka "tray"
Definition: traynotify.h:131
NotifyIconMap _icon_map
Definition: traynotify.h:174
bool _show_hidden
Definition: traynotify.h:148
NotifyIconCfgList _cfg
Definition: traynotify.h:170
ResizeManager _resize_mgr
Definition: window.h:563
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
HTREEITEM _selectedItem
Definition: traynotify.h:223
bool _show_hidden_org
Definition: traynotify.h:217
HIMAGELIST _himl
Definition: traynotify.h:208
IconStateMap _icon_states_org
Definition: traynotify.h:216
NotifyIconCfgList _cfg_org
Definition: traynotify.h:215
pair< NOTIFYICONMODE, DWORD > IconStatePair
Definition: traynotify.h:212
NotifyArea * _pNotifyArea
Definition: traynotify.h:209
ResizeController< Dialog > super
Definition: traynotify.h:200
HACCEL _haccel
Definition: traynotify.h:207
static void register_pretranslate(HWND hwnd)
Definition: window.cpp:579
#define PM_GET_NOTIFYAREA
Definition: traynotify.h:44
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define GetStockBrush(i)
Definition: windowsx.h:307
#define WHITE_BRUSH
Definition: wingdi.h:902
#define IDCANCEL
Definition: winuser.h:834
#define SM_CYSMICON
Definition: winuser.h:1016
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:833
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define SM_CXSMICON
Definition: winuser.h:1015
#define SendMessage
Definition: winuser.h:5855
#define MAKEINTRESOURCE
Definition: winuser.h:591
int WINAPI GetSystemMetrics(_In_ int)
#define LoadAccelerators
Definition: winuser.h:5822

◆ ~TrayNotifyDlg()

TrayNotifyDlg::~TrayNotifyDlg ( )

Definition at line 940 of file traynotify.cpp.

941{
942 KillTimer(_hwnd, 0);
945}
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
static void unregister_pretranslate(HWND hwnd)
Definition: window.cpp:584
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Member Function Documentation

◆ Command()

int TrayNotifyDlg::Command ( int  id,
int  code 
)
protectedvirtual

Reimplemented from Window.

Definition at line 1092 of file traynotify.cpp.

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}
#define ID_REFRESH
Definition: resource.h:16
#define PM_REFRESH
Definition: explorer.h:69
structure for maintaining informations about one notification icon
Definition: traynotify.h:94
void SetIconMode(NOTIFYICONMODE mode)
Definition: inflate.c:139
@ NIM_SHOW
Definition: traynotify.h:65
@ NIM_HIDE
Definition: traynotify.h:65
@ NIM_AUTO
Definition: traynotify.h:65
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
#define WM_COMMAND
Definition: winuser.h:1743
#define BN_CLICKED
Definition: winuser.h:1928
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

◆ InsertItem() [1/2]

void TrayNotifyDlg::InsertItem ( HTREEITEM  hparent,
HTREEITEM  after,
const NotifyIconDlgInfo entry,
HDC  hdc,
HICON  hicon,
NOTIFYICONMODE  mode 
)
protected

Definition at line 1040 of file traynotify.cpp.

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}
size_type size() const
Definition: _map.h:172
unsigned int idx
Definition: utils.c:41
GLenum mode
Definition: glext.h:6217
uint32_t entry
Definition: isohybrid.c:63
#define TEXT(s)
Definition: k32.h:26
#define IDS_NOTIFY_HIDE
Definition: resource.h:45
#define IDS_NOTIFY_SHOW
Definition: resource.h:44
#define IDS_NOTIFY_AUTOHIDE
Definition: resource.h:46
HDC hdc
Definition: main.c:9
#define TVIF_TEXT
Definition: commctrl.h:3271
#define TVIF_IMAGE
Definition: commctrl.h:3272
#define TV_INSERTSTRUCT
Definition: commctrl.h:3382
#define TV_ITEM
Definition: commctrl.h:3305
#define TVIF_PARAM
Definition: commctrl.h:3273
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3417
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3276
convenient loading of string resources
Definition: globals.h:304
NotifyIconDlgInfoMap _info
Definition: traynotify.h:210
__inline int after(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2395
String string_from_mode(NOTIFYICONMODE mode)
Definition: traynotify.cpp:863
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
LONG_PTR LPARAM
Definition: windef.h:208

◆ InsertItem() [2/2]

void TrayNotifyDlg::InsertItem ( HTREEITEM  hparent,
HTREEITEM  after,
const NotifyInfo entry,
HDC  hdc 
)
protected

Definition at line 1035 of file traynotify.cpp.

1036{
1037 InsertItem(hparent, after, entry, hdc, entry._hIcon, entry._mode);
1038}
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo &, HDC)

Referenced by InsertItem(), and Refresh().

◆ Notify()

int TrayNotifyDlg::Notify ( int  id,
NMHDR pnmh 
)
protectedvirtual

Reimplemented from Window.

Definition at line 1148 of file traynotify.cpp.

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}
#define TVN_SELCHANGED
Definition: commctrl.h:3740
#define NMTREEVIEW
Definition: commctrl.h:3647
void RefreshProperties(const NotifyIconDlgInfo &entry)
UINT code
Definition: winuser.h:3162
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)

◆ Refresh()

void TrayNotifyDlg::Refresh ( )
protected
Todo:
refresh incrementally

Definition at line 947 of file traynotify.cpp.

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}
_STLP_PRIV _List_iterator< NotifyIconConfig, _Const_traits< NotifyIconConfig > > const_iterator
Definition: _list.h:276
iterator begin()
Definition: _list.h:367
iterator end()
Definition: _list.h:370
void clear()
Definition: _map.h:206
#define IDS_ITEMS_CONFIGURED
Definition: resource.h:41
#define IDS_ITEMS_CUR
Definition: resource.h:40
#define IDS_ITEMS_HIDDEN
Definition: resource.h:43
#define IDS_ITEMS_VISIBLE
Definition: resource.h:42
static HICON
Definition: imagelist.c:80
#define TVI_LAST
Definition: commctrl.h:3375
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3422
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3425
#define TreeView_EnsureVisible(hwnd, hitem)
Definition: commctrl.h:3550
#define TVE_EXPAND
Definition: commctrl.h:3428
#define TVI_SORT
Definition: commctrl.h:3376
#define SHGetFileInfo
Definition: shellapi.h:698
#define SHGFI_ICON
Definition: shellapi.h:165
#define ExtractIconEx
Definition: shellapi.h:690
#define SHGFI_SMALLICON
Definition: shellapi.h:177
configuration for the display mode of a notification icon
Definition: traynotify.h:72
String _modulePath
Definition: traynotify.h:81
NOTIFYICONMODE _mode
Definition: traynotify.h:83
HTREEITEM _hitemCurrent_hidden
Definition: traynotify.h:221
HTREEITEM _hitemCurrent_visible
Definition: traynotify.h:220
HTREEITEM _hitemConfig
Definition: traynotify.h:222
HTREEITEM _hitemCurrent
Definition: traynotify.h:219
HICON hIcon
Definition: shellapi.h:366
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105

Referenced by Command(), SetIconMode(), TrayNotifyDlg(), and WndProc().

◆ RefreshProperties()

void TrayNotifyDlg::RefreshProperties ( const NotifyIconDlgInfo entry)
protected

Definition at line 1172 of file traynotify.cpp.

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}
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
#define SHGFI_LARGEICON
Definition: shellapi.h:176
#define ExtractIcon
Definition: shellapi.h:689
#define STM_SETICON
Definition: winuser.h:2095
#define SetDlgItemText
Definition: winuser.h:5861

Referenced by Notify().

◆ SetIconMode()

void TrayNotifyDlg::SetIconMode ( NOTIFYICONMODE  mode)
protected
Todo:
select treeview item at new position in tree view -> refresh HTREEITEM in _selectedItem

Definition at line 1206 of file traynotify.cpp.

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}
void push_back(const_reference __x)
Definition: _list.h:509
_STLP_PRIV _List_iterator< NotifyIconConfig, _Nonconst_traits< NotifyIconConfig > > iterator
Definition: _list.h:275
LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
Definition: window.h:968
bool match(const NotifyIconConfig &props) const
Definition: traynotify.cpp:820

Referenced by Command().

◆ WndProc()

LRESULT TrayNotifyDlg::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
protectedvirtual

Reimplemented from Window.

Definition at line 1070 of file traynotify.cpp.

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}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define PM_TRANSLATE_MSG
Definition: window.h:266
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.h:525
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define WM_TIMER
Definition: winuser.h:1745
#define TranslateAccelerator
Definition: winuser.h:5872

Member Data Documentation

◆ _cfg_org

NotifyIconCfgList TrayNotifyDlg::_cfg_org
protected

Definition at line 215 of file traynotify.h.

Referenced by Command(), and TrayNotifyDlg().

◆ _haccel

HACCEL TrayNotifyDlg::_haccel
protected

Definition at line 207 of file traynotify.h.

Referenced by TrayNotifyDlg(), and WndProc().

◆ _himl

HIMAGELIST TrayNotifyDlg::_himl
protected

Definition at line 208 of file traynotify.h.

Referenced by InsertItem(), TrayNotifyDlg(), and ~TrayNotifyDlg().

◆ _hitemConfig

HTREEITEM TrayNotifyDlg::_hitemConfig
protected

Definition at line 222 of file traynotify.h.

Referenced by Refresh().

◆ _hitemCurrent

HTREEITEM TrayNotifyDlg::_hitemCurrent
protected

Definition at line 219 of file traynotify.h.

Referenced by Refresh().

◆ _hitemCurrent_hidden

HTREEITEM TrayNotifyDlg::_hitemCurrent_hidden
protected

Definition at line 221 of file traynotify.h.

Referenced by Refresh().

◆ _hitemCurrent_visible

HTREEITEM TrayNotifyDlg::_hitemCurrent_visible
protected

Definition at line 220 of file traynotify.h.

Referenced by Refresh().

◆ _icon_states_org

IconStateMap TrayNotifyDlg::_icon_states_org
protected

Definition at line 216 of file traynotify.h.

Referenced by Command(), and TrayNotifyDlg().

◆ _info

NotifyIconDlgInfoMap TrayNotifyDlg::_info
protected

Definition at line 210 of file traynotify.h.

Referenced by InsertItem(), Notify(), Refresh(), and SetIconMode().

◆ _pNotifyArea

NotifyArea* TrayNotifyDlg::_pNotifyArea
protected

Definition at line 209 of file traynotify.h.

Referenced by Command(), Refresh(), SetIconMode(), and TrayNotifyDlg().

◆ _selectedItem

HTREEITEM TrayNotifyDlg::_selectedItem
protected

Definition at line 223 of file traynotify.h.

Referenced by Notify(), SetIconMode(), and TrayNotifyDlg().

◆ _show_hidden_org

bool TrayNotifyDlg::_show_hidden_org
protected

Definition at line 217 of file traynotify.h.

Referenced by Command(), and TrayNotifyDlg().

◆ _tree_ctrl

HWND TrayNotifyDlg::_tree_ctrl
protected

Definition at line 206 of file traynotify.h.

Referenced by InsertItem(), Refresh(), SetIconMode(), and TrayNotifyDlg().


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