mirror of
https://github.com/reactos/reactos.git
synced 2024-09-22 02:30:33 +00:00
[RAPPS] Refreshing the Installed list should restore the selected item (#5676)
This commit is contained in:
parent
3b73d62eaa
commit
0e0f99744f
|
@ -1980,6 +1980,41 @@ CApplicationView::AppendTabOrderWindow(int Direction, ATL::CSimpleArray<HWND> &T
|
||||||
m_AppsInfo->AppendTabOrderWindow(Direction, TabOrderList);
|
m_AppsInfo->AppendTabOrderWindow(Direction, TabOrderList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
CApplicationView::GetRestoreListSelectionData(RESTORELISTSELECTION &Restore)
|
||||||
|
{
|
||||||
|
LVITEMW &Item = Restore.Item;
|
||||||
|
Item.mask = LVIF_TEXT|LVIF_STATE;
|
||||||
|
Item.iItem = -1, Item.iSubItem = 0;
|
||||||
|
Item.stateMask = LVIS_FOCUSED|LVIS_SELECTED;
|
||||||
|
Item.pszText = Restore.Name, Item.cchTextMax = _countof(Restore.Name);
|
||||||
|
|
||||||
|
HWND hList = m_ListView ? m_ListView->m_hWnd : NULL;
|
||||||
|
if (hList)
|
||||||
|
{
|
||||||
|
Item.iItem = ListView_GetNextItem(hList, -1, LVNI_FOCUSED);
|
||||||
|
ListView_GetItem(hList, &Item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
CApplicationView::RestoreListSelection(const RESTORELISTSELECTION &Restore)
|
||||||
|
{
|
||||||
|
const LVITEMW &Item = Restore.Item;
|
||||||
|
int index = Item.iItem;
|
||||||
|
if (index != -1) // Was there a selected item?
|
||||||
|
{
|
||||||
|
LVFINDINFOW fi;
|
||||||
|
fi.flags = LVFI_STRING;
|
||||||
|
fi.psz = Item.pszText;
|
||||||
|
index = ListView_FindItem(m_ListView->m_hWnd, -1, &fi);
|
||||||
|
}
|
||||||
|
if (index != -1) // Is it still in the list?
|
||||||
|
{
|
||||||
|
ListView_SetItemState(m_ListView->m_hWnd, index, Item.state, Item.stateMask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// this function is called when a item of listview get focus.
|
// this function is called when a item of listview get focus.
|
||||||
// CallbackParam is the param passed to listview when adding the item (the one getting focus now).
|
// CallbackParam is the param passed to listview when adding the item (the one getting focus now).
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -624,9 +624,14 @@ CMainWindow::UpdateApplicationsList(AppsCategories EnumType, BOOL bReload, BOOL
|
||||||
if (bCheckAvailable)
|
if (bCheckAvailable)
|
||||||
CheckAvailable();
|
CheckAvailable();
|
||||||
|
|
||||||
|
BOOL TryRestoreSelection = SelectedEnumType == EnumType;
|
||||||
if (SelectedEnumType != EnumType)
|
if (SelectedEnumType != EnumType)
|
||||||
SelectedEnumType = EnumType;
|
SelectedEnumType = EnumType;
|
||||||
|
|
||||||
|
CApplicationView::RESTORELISTSELECTION RestoreSelection;
|
||||||
|
if (TryRestoreSelection)
|
||||||
|
m_ApplicationView->GetRestoreListSelectionData(RestoreSelection);
|
||||||
|
|
||||||
if (bReload)
|
if (bReload)
|
||||||
m_Selected.RemoveAll();
|
m_Selected.RemoveAll();
|
||||||
|
|
||||||
|
@ -667,6 +672,9 @@ CMainWindow::UpdateApplicationsList(AppsCategories EnumType, BOOL bReload, BOOL
|
||||||
{
|
{
|
||||||
ATLASSERT(0 && "This should be unreachable!");
|
ATLASSERT(0 && "This should be unreachable!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TryRestoreSelection)
|
||||||
|
m_ApplicationView->RestoreListSelection(RestoreSelection);
|
||||||
m_ApplicationView->SetRedraw(TRUE);
|
m_ApplicationView->SetRedraw(TRUE);
|
||||||
m_ApplicationView->RedrawWindow(0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN); // force the child window to repaint
|
m_ApplicationView->RedrawWindow(0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN); // force the child window to repaint
|
||||||
UpdateStatusBarText();
|
UpdateStatusBarText();
|
||||||
|
|
|
@ -406,6 +406,15 @@ class CApplicationView : public CUiWindow<CWindowImpl<CApplicationView>>
|
||||||
VOID
|
VOID
|
||||||
AppendTabOrderWindow(int Direction, ATL::CSimpleArray<HWND> &TabOrderList);
|
AppendTabOrderWindow(int Direction, ATL::CSimpleArray<HWND> &TabOrderList);
|
||||||
|
|
||||||
|
struct RESTORELISTSELECTION {
|
||||||
|
LVITEMW Item;
|
||||||
|
WCHAR Name[MAX_PATH];
|
||||||
|
};
|
||||||
|
VOID
|
||||||
|
GetRestoreListSelectionData(RESTORELISTSELECTION &Restore);
|
||||||
|
VOID
|
||||||
|
RestoreListSelection(const RESTORELISTSELECTION &Restore);
|
||||||
|
|
||||||
// this function is called when a item of listview get focus.
|
// this function is called when a item of listview get focus.
|
||||||
// CallbackParam is the param passed to listview when adding the item (the one getting focus now).
|
// CallbackParam is the param passed to listview when adding the item (the one getting focus now).
|
||||||
VOID
|
VOID
|
||||||
|
|
Loading…
Reference in a new issue