just extend one filter in the server browser

This commit is contained in:
oy 2015-11-25 10:19:05 +01:00
parent 4b60022268
commit e268371fae
2 changed files with 15 additions and 1 deletions

View file

@ -2256,6 +2256,8 @@ void CMenus::OnConsoleInit()
m_lFilters.add(CBrowserFilter(CBrowserFilter::FILTER_STANDARD, Localize("Teeworlds"), ServerBrowser(), IServerBrowser::FILTER_COMPAT_VERSION|IServerBrowser::FILTER_PURE|IServerBrowser::FILTER_PURE_MAP|IServerBrowser::FILTER_PING, 999, -1, "", ""));
m_lFilters.add(CBrowserFilter(CBrowserFilter::FILTER_FAVORITES, Localize("Favorites"), ServerBrowser(), IServerBrowser::FILTER_FAVORITE|IServerBrowser::FILTER_PING, 999, -1, "", ""));
m_lFilters.add(CBrowserFilter(CBrowserFilter::FILTER_ALL, Localize("All"), ServerBrowser(), IServerBrowser::FILTER_PING, 999, -1, "", ""));
m_lFilters[0].Switch();
}
void CMenus::OnStateChange(int NewState, int OldState)

View file

@ -34,7 +34,7 @@ CMenus::CColumn CMenus::ms_aCols[] = {
CMenus::CBrowserFilter::CBrowserFilter(int Custom, const char* pName, IServerBrowser *pServerBrowser, int Filter, int Ping, int Country, const char* pGametype, const char* pServerAddress)
: m_pServerBrowser(pServerBrowser)
{
m_Extended = true;
m_Extended = false;
m_Custom = Custom;
str_copy(m_aName, pName, sizeof(m_aName));
//Todo: fix Filter
@ -442,7 +442,19 @@ bool CMenus::RenderFilterHeader(CUIRect View, int FilterIndex)
View.VSplitLeft(20.0f, &Button, &View);
Button.Margin(2.0f, &Button);
if(DoButton_SpriteClean(IMAGE_MENUICONS, pFilter->Extended() ? SPRITE_MENU_EXPANDED : SPRITE_MENU_COLLAPSED, &Button))
{
pFilter->Switch();
// retract the other filters
if(pFilter->Extended())
{
for(int i = 0; i < m_lFilters.size(); ++i)
{
if(i != FilterIndex && m_lFilters[i].Extended())
m_lFilters[i].Switch();
}
}
}
// split buttons from label
View.VSplitLeft(Spacing, 0, &View);