[RAPPS] Show the user that there are no search results

CORE-17944
This commit is contained in:
Mark Jansen 2021-12-30 20:17:32 +01:00
parent d59f5ae2a5
commit acc25ce914
30 changed files with 84 additions and 1 deletions

View file

@ -1127,6 +1127,30 @@ CAppsListView::~CAppsListView()
}
}
LRESULT
CAppsListView::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
{
LRESULT lRes = this->DefWindowProc(uMsg, wParam, lParam);
if (!m_Watermark.IsEmpty())
{
RECT rc;
GetClientRect(&rc);
HGDIOBJ oldFont = SelectFont(HDC(wParam), GetStockFont(DEFAULT_GUI_FONT));
DrawShadowText(
HDC(wParam), m_Watermark.GetString(), m_Watermark.GetLength(), &rc,
DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, GetSysColor(COLOR_GRAYTEXT),
GetSysColor(COLOR_GRAYTEXT), 1, 1);
SelectFont(HDC(wParam), oldFont);
}
return lRes;
}
VOID CAppsListView::SetWatermark(const CStringW& Text)
{
m_Watermark = Text;
}
VOID CAppsListView::SetCheckboxesVisible(BOOL bIsVisible)
{
if (bIsVisible)
@ -1279,6 +1303,12 @@ HWND CAppsListView::Create(HWND hwndParent)
SetImageList(m_hImageListView, LVSIL_SMALL);
SetImageList(m_hImageListView, LVSIL_NORMAL);
#pragma push_macro("SubclassWindow")
#undef SubclassWindow
m_hWnd = NULL;
SubclassWindow(hwnd);
#pragma pop_macro("SubclassWindow")
return hwnd;
}
@ -2015,6 +2045,13 @@ BOOL CApplicationView::AddAvailableApplication(CAvailableApplicationInfo *AvlbAp
return m_ListView->AddAvailableApplication(AvlbAppInfo, InitCheckState, param);
}
VOID CApplicationView::SetWatermark(const CStringW& Text)
{
ATLASSERT(GetItemCount() == 0);
m_ListView->SetWatermark(Text);
}
void CApplicationView::CheckAll()
{
m_ListView->CheckAll();

View file

@ -706,6 +706,14 @@ VOID CMainWindow::UpdateApplicationsList(INT EnumType)
m_ApplicationView->SetRedraw(TRUE);
m_ApplicationView->RedrawWindow(0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN); // force the child window to repaint
UpdateStatusBarText();
CStringW text;
if (m_ApplicationView->GetItemCount() == 0 && !szSearchPattern.IsEmpty())
{
text.LoadString(IDS_NO_SEARCH_RESULTS);
}
m_ApplicationView->SetWatermark(text);
bUpdating = FALSE;
}

View file

@ -201,7 +201,7 @@ public:
};
class CAppsListView :
public CUiWindow<CListView>
public CUiWindow<CWindowImpl<CAppsListView, CListView>>
{
struct SortContext
{
@ -221,11 +221,20 @@ class CAppsListView :
APPLICATION_VIEW_TYPE ApplicationViewType = AppViewTypeEmpty;
HIMAGELIST m_hImageListView = NULL;
CStringW m_Watermark;
BEGIN_MSG_MAP(CAppsListView)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
END_MSG_MAP()
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
public:
CAppsListView();
~CAppsListView();
VOID SetWatermark(const CStringW& Text);
VOID SetCheckboxesVisible(BOOL bIsVisible);
VOID ColumnClick(LPNMLISTVIEW pnmv);
@ -372,6 +381,8 @@ public:
BOOL AddInstalledApplication(CInstalledApplicationInfo *InstAppInfo, LPVOID param);
BOOL AddAvailableApplication(CAvailableApplicationInfo *AvlbAppInfo, BOOL InitCheckState, LPVOID param);
VOID SetWatermark(const CStringW& Text);
void CheckAll();
PVOID GetFocusedItemData();

View file

@ -123,6 +123,7 @@
#define IDS_APP_DISPLAY_DETAILS 133
#define IDS_APP_DISPLAY_LIST 134
#define IDS_APP_DISPLAY_TILE 135
#define IDS_NO_SEARCH_RESULTS 136
/* Tooltips */
#define IDS_TOOLTIP_INSTALL 200

View file

@ -218,6 +218,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -219,6 +219,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -214,6 +214,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "Liste"
IDS_APP_DISPLAY_TILE "Kacheln"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -214,6 +214,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -217,6 +217,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -222,6 +222,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -214,6 +214,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Détails"
IDS_APP_DISPLAY_LIST "Liste"
IDS_APP_DISPLAY_TILE "Tuile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -220,6 +220,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -216,6 +216,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Részletek"
IDS_APP_DISPLAY_LIST "Lista"
IDS_APP_DISPLAY_TILE "Csempe"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -214,6 +214,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -214,6 +214,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -214,6 +214,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -214,6 +214,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -223,6 +223,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Szczegóły"
IDS_APP_DISPLAY_LIST "Lista"
IDS_APP_DISPLAY_TILE "Kafelki"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -216,6 +216,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -216,6 +216,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -223,6 +223,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -214,6 +214,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -219,6 +219,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -218,6 +218,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -221,6 +221,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -216,6 +216,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Detaylar"
IDS_APP_DISPLAY_LIST "Liste"
IDS_APP_DISPLAY_TILE "Karo"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -222,6 +222,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Details"
IDS_APP_DISPLAY_LIST "List"
IDS_APP_DISPLAY_TILE "Tile"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -217,6 +217,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "细节"
IDS_APP_DISPLAY_LIST "列表"
IDS_APP_DISPLAY_TILE "卡片"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -222,6 +222,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "詳細資料"
IDS_APP_DISPLAY_LIST "列表"
IDS_APP_DISPLAY_TILE "並排"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE

View file

@ -222,6 +222,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "詳情"
IDS_APP_DISPLAY_LIST "列表"
IDS_APP_DISPLAY_TILE "卡片"
IDS_NO_SEARCH_RESULTS "No search results"
END
STRINGTABLE