Skip to content

Commit

Permalink
[EXPLORER] review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Getequ committed Mar 5, 2018
1 parent c692008 commit f8bcf37
Showing 1 changed file with 40 additions and 42 deletions.
82 changes: 40 additions & 42 deletions base/shell/explorer/notifyiconscust.cpp
Expand Up @@ -58,8 +58,11 @@ VOID ShowBehaviorCombo(HWND hwnd, LPNMITEMACTIVATE itemdata)

ComboBox_SetCurSel(hCombo, lvItem.lParam);

int iNameWidth = ListView_GetColumnWidth(hListView, 0);
int iBehaviorWidth = ListView_GetColumnWidth(hListView, 1);

ComboBox_SetItemData(hCombo, 0, iItem);
SetWindowPos(hCombo, HWND_TOP, 190 + lv.x, pt.y + lv.y, 135, 20, SWP_SHOWWINDOW);
SetWindowPos(hCombo, HWND_TOP, iNameWidth + lv.x, pt.y + lv.y, iBehaviorWidth, 20, SWP_SHOWWINDOW);
}
else
{
Expand All @@ -73,26 +76,25 @@ VOID SetItemBehavior(HWND hwnd, HWND hCombo)
int iItem = (int)ComboBox_GetItemData(hCombo, 0);
HWND hListView = GetDlgItem(hwnd, IDC_NOTIFICATION_LIST);

WCHAR sState[100];
WCHAR szBehavior[100];
int resId = iState == 0 ? IDS_NOTIF_BEH_SHOW : (iState == 1 ? IDS_NOTIF_BEH_HIDE : IDS_NOTIF_BEH_HIDE_INACTIVE);
LoadStringW(NULL, resId, sState, _countof(sState));
LoadStringW(NULL, resId, szBehavior, _countof(szBehavior));

LVITEM lvItem;
ZeroMemory(&lvItem, sizeof(lvItem));
lvItem.mask = LVIF_TEXT;
lvItem.iItem = iItem;
lvItem.iSubItem = 1;
lvItem.cchTextMax = 100;
lvItem.pszText = sState;
lvItem.pszText = szBehavior;
ListView_SetItem(hListView, &lvItem);

LVITEM lvItem2;
ZeroMemory(&lvItem2, sizeof(lvItem2));
lvItem2.mask = LVIF_PARAM;
lvItem2.iSubItem = 0;
lvItem2.lParam = iState;
lvItem2.iItem = iItem;
ListView_SetItem(hListView, &lvItem2);
ZeroMemory(&lvItem, sizeof(lvItem));
lvItem.mask = LVIF_PARAM;
lvItem.iSubItem = 0;
lvItem.lParam = iState;
lvItem.iItem = iItem;
ListView_SetItem(hListView, &lvItem);

ShowWindow(hCombo, SW_HIDE);
}
Expand All @@ -101,29 +103,29 @@ VOID ResetBehaviors(HWND hwnd)
{
HWND hListView = GetDlgItem(hwnd, IDC_NOTIFICATION_LIST);
int count = ListView_GetItemCount(hListView);
WCHAR state[100];
LoadStringW(NULL, IDS_NOTIF_BEH_HIDE_INACTIVE, state, _countof(state));

LVITEM lvItem;
ZeroMemory(&lvItem, sizeof(lvItem));
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 1;
lvItem.cchTextMax = 100;
lvItem.pszText = state;

LVITEM lvItem2;
ZeroMemory(&lvItem2, sizeof(lvItem));
lvItem2.mask = LVIF_PARAM;
lvItem2.iSubItem = 0;
lvItem2.lParam = 2;

for(int i = 0; i< count; i++)
WCHAR szBehavior[100];
LoadStringW(NULL, IDS_NOTIF_BEH_HIDE_INACTIVE, szBehavior, _countof(szBehavior));

LVITEM lviBehavior;
ZeroMemory(&lviBehavior, sizeof(lviBehavior));
lviBehavior.mask = LVIF_TEXT;
lviBehavior.iSubItem = 1;
lviBehavior.cchTextMax = 100;
lviBehavior.pszText = szBehavior;

LVITEM lviName;
ZeroMemory(&lviName, sizeof(lviName));
lviName.mask = LVIF_PARAM;
lviName.iSubItem = 0;
lviName.lParam = 2;

for (int i = 0; i < count; i++)
{
lvItem2.iItem = i;
ListView_SetItem(hListView, &lvItem2);
lviName.iItem = i;
ListView_SetItem(hListView, &lviName);

lvItem.iItem = i;
ListView_SetItem(hListView, &lvItem);
lviBehavior.iItem = i;
ListView_SetItem(hListView, &lviBehavior);
}
}

Expand Down Expand Up @@ -176,13 +178,11 @@ INT_PTR CALLBACK CustomizeNotifyIconsProc(HWND hwnd, UINT Message, WPARAM wParam
InitializeListView(hwnd);
break;
case WM_NOTIFY:
if (LOWORD(wParam) == IDC_NOTIFICATION_LIST && ((LPNMHDR)lParam)->code == NM_CLICK)
{
if (LOWORD(wParam) == IDC_NOTIFICATION_LIST && ((LPNMHDR)lParam)->code == NM_CLICK)
{
ShowBehaviorCombo(hwnd, (LPNMITEMACTIVATE)lParam);
}
else return FALSE;
ShowBehaviorCombo(hwnd, (LPNMITEMACTIVATE)lParam);
}
else return FALSE;
break;
case WM_COMMAND:
switch(LOWORD(wParam))
Expand All @@ -194,11 +194,9 @@ INT_PTR CALLBACK CustomizeNotifyIconsProc(HWND hwnd, UINT Message, WPARAM wParam
EndDialog(hwnd, IDCANCEL);
break;
case IDC_NOTIFICATION_BEHAVIOUR:
if (HIWORD(wParam) == CBN_SELCHANGE)
{
if (HIWORD(wParam) == CBN_SELCHANGE)
{
SetItemBehavior(hwnd, (HWND)lParam);
}
SetItemBehavior(hwnd, (HWND)lParam);
}
break;
case IDC_TASKBARPROP_NOTIREST:
Expand All @@ -218,7 +216,7 @@ VOID SetNotifyIcons(HWND hDialog, HWND hTrayNotify)
HWND hSysPager = FindWindowEx(hTrayNotify, NULL, L"SysPager", NULL);
HWND hToolbar = FindWindowEx(hSysPager, NULL, L"ToolbarWindow32", NULL);

HIMAGELIST tbImageList = (HIMAGELIST )SendMessage(hToolbar, TB_GETIMAGELIST, 0, 0);
HIMAGELIST tbImageList = (HIMAGELIST)SendMessage(hToolbar, TB_GETIMAGELIST, 0, 0);
HIMAGELIST lvImageList = ImageList_Duplicate(tbImageList);
ListView_SetImageList(hListView, lvImageList, LVSIL_SMALL);

Expand Down

0 comments on commit f8bcf37

Please sign in to comment.