Merge pull request #9078 from ChillerDragon/pr_browser_arrow_left_right

Arrow left and right in browser (internet/lan/favorites)
This commit is contained in:
Robert Müller 2024-09-30 13:23:46 +00:00 committed by GitHub
commit 7abeaf5600
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -660,6 +660,27 @@ void CMenus::RenderMenubar(CUIRect Box, IClient::EClientState ClientState)
}
GameClient()->m_Tooltips.DoToolTip(&s_FavoritesButton, &Button, Localize("Favorites"));
int MaxPage = PAGE_FAVORITES + ServerBrowser()->FavoriteCommunities().size();
if(
!Ui()->IsPopupOpen() &&
CLineInput::GetActiveInput() == nullptr &&
(g_Config.m_UiPage >= PAGE_INTERNET && g_Config.m_UiPage <= MaxPage) &&
(m_MenuPage >= PAGE_INTERNET && m_MenuPage <= PAGE_FAVORITE_COMMUNITY_5))
{
if(Input()->KeyPress(KEY_RIGHT))
{
NewPage = g_Config.m_UiPage + 1;
if(NewPage > MaxPage)
NewPage = PAGE_INTERNET;
}
if(Input()->KeyPress(KEY_LEFT))
{
NewPage = g_Config.m_UiPage - 1;
if(NewPage < PAGE_INTERNET)
NewPage = MaxPage;
}
}
size_t FavoriteCommunityIndex = 0;
static CButtonContainer s_aFavoriteCommunityButtons[5];
static_assert(std::size(s_aFavoriteCommunityButtons) == (size_t)PAGE_FAVORITE_COMMUNITY_5 - PAGE_FAVORITE_COMMUNITY_1 + 1);