fix tray icon config dialog for the first icon

svn path=/trunk/; revision=14439
This commit is contained in:
Martin Fuchs 2005-04-02 11:40:58 +00:00
parent c5c1a87719
commit 11fe38608b
3 changed files with 44 additions and 41 deletions

View file

@ -47,7 +47,7 @@ DesktopBar::DesktopBar(HWND hwnd)
WM_TASKBARCREATED(RegisterWindowMessage(WINMSG_TASKBARCREATED))
#endif
{
SetWindowIcon(hwnd, IDI_REACTOS/*IDI_SEARCH*/); // icon in for TrayNotifyDlg
SetWindowIcon(hwnd, IDI_REACTOS);
SystemParametersInfo(SPI_GETWORKAREA, 0, &_work_area_org, 0);
}

View file

@ -905,7 +905,7 @@ TrayNotifyDlg::TrayNotifyDlg(HWND hwnd)
_show_hidden_org = _pNotifyArea->_show_hidden;
}
SetWindowIcon(hwnd, IDI_REACTOS/*IDI_SEARCH*/);
SetWindowIcon(hwnd, IDI_REACTOS);
_haccel = LoadAccelerators(g_Globals._hInstance, MAKEINTRESOURCE(IDA_TRAYNOTIFY));
@ -1053,7 +1053,7 @@ void TrayNotifyDlg::InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyI
void TrayNotifyDlg::InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyIconDlgInfo& entry,
HDC hdc, HICON hicon, NOTIFYICONMODE mode)
{
int idx = _info.size();
int idx = _info.size() + 1;
_info[idx] = entry;
String mode_str = string_from_mode(mode);
@ -1163,11 +1163,27 @@ int TrayNotifyDlg::Notify(int id, NMHDR* pnmh)
switch(pnmh->code) {
case TVN_SELCHANGED: {
NMTREEVIEW* pnmtv = (NMTREEVIEW*)pnmh;
LPARAM lparam = pnmtv->itemNew.lParam;
int idx = pnmtv->itemNew.lParam;
if (lparam) {
const NotifyIconDlgInfo& entry = _info[lparam];
if (idx) {
RefreshProperties(_info[idx]);
_selectedItem = pnmtv->itemNew.hItem;
} else {
/*
SetDlgItemText(_hwnd, IDC_NOTIFY_TOOLTIP, NULL);
SetDlgItemText(_hwnd, IDC_NOTIFY_TITLE, NULL);
SetDlgItemText(_hwnd, IDC_NOTIFY_MODULE, NULL);
*/
CheckRadioButton(_hwnd, IDC_NOTIFY_SHOW, IDC_NOTIFY_AUTOHIDE, 0);
}
break;}
}
return 0;
}
void TrayNotifyDlg::RefreshProperties(const NotifyIconDlgInfo& entry)
{
SetDlgItemText(_hwnd, IDC_NOTIFY_TOOLTIP, entry._tipText);
SetDlgItemText(_hwnd, IDC_NOTIFY_TITLE, entry._windowTitle);
SetDlgItemText(_hwnd, IDC_NOTIFY_MODULE, entry._modulePath);
@ -1198,30 +1214,16 @@ int TrayNotifyDlg::Notify(int id, NMHDR* pnmh)
DestroyIcon(hicon);
} else
SendMessage(GetDlgItem(_hwnd, IDC_PICTURE), STM_SETICON, 0, 0);
_selectedItem = pnmtv->itemNew.hItem;
} else {
/*
SetDlgItemText(_hwnd, IDC_NOTIFY_TOOLTIP, NULL);
SetDlgItemText(_hwnd, IDC_NOTIFY_TITLE, NULL);
SetDlgItemText(_hwnd, IDC_NOTIFY_MODULE, NULL);
*/
CheckRadioButton(_hwnd, IDC_NOTIFY_SHOW, IDC_NOTIFY_AUTOHIDE, 0);
}
break;}
}
return 0;
}
void TrayNotifyDlg::SetIconMode(NOTIFYICONMODE mode)
{
LPARAM lparam = TreeView_GetItemData(_tree_ctrl, _selectedItem);
int idx = TreeView_GetItemData(_tree_ctrl, _selectedItem);
if (!lparam)
if (!idx)
return;
NotifyIconConfig& entry = _info[lparam];
NotifyIconConfig& entry = _info[idx];
if (entry._mode != mode) {
entry._mode = mode;

View file

@ -230,6 +230,7 @@ protected:
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);
};