CUIListBoxItem* CUIListBox::AddTextItem(LPCSTR text) { CUIListBoxItem* pItem = AddItem(); pItem->SetWndSize (Fvector2().set(GetDesiredChildWidth(), m_def_item_height)); pItem->SetTextColor (m_text_color); pItem->SetText (CStringTable().translate(text).c_str()); pItem->GetTextItem()->SetWidth (GetDesiredChildWidth()); return pItem; }
void CUIListBox::AddExistingItem(CUIListBoxItem* item) { item->InitFrameLineWnd (Fvector2().set(0,0), Fvector2().set(GetDesiredChildWidth()-5, m_def_item_height)); item->SetWidth (GetDesiredChildWidth()); if(m_selection_texture.size()) item->InitTexture (m_selection_texture.c_str(), "hud\\default"); else item->InitDefault (); item->SetSelected (false); item->SetMessageTarget (this); AddWindow (item, true); }
void CUIStatsPlayerList::InitTeamHeader(CUIXml& xml_doc, LPCSTR path){ string256 _path; m_header_team = new CUIWindow(); m_header_team->SetAutoDelete(true); CUIXmlInit::InitWindow(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header"), 0, m_header_team); m_header_team->SetWidth(this->GetDesiredChildWidth()); CUIStatic* logo = new CUIStatic(); logo->SetAutoDelete(true); CUIXmlInit::InitStatic(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header:logo"), 0, logo); m_header_team->AttachChild(logo); if (1 == m_CurTeam) logo->InitTexture(pSettings->r_string("team_logo_small", "team1")); else if (2 == m_CurTeam) logo->InitTexture(pSettings->r_string("team_logo_small", "team2")); else R_ASSERT2(false, "invalid team"); S_ELEMENT t; CUIXmlInit::InitFont(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header:text_format"), 0, t.c, t.f); t.h = m_header_team->GetHeight(); m_header_text = new CUIStatic(); m_header_text->SetAutoDelete(true); CUIXmlInit::InitStatic(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header:header"), 0, m_header_text); m_header_text->SetWidth(GetDesiredChildWidth()); m_header_text->SetVTextAlignment(valCenter); m_header_team->AttachChild(m_header_text); if (t.f) m_header_text->SetFont(t.f); m_header_text->SetTextColor(t.c); }
CUIListBoxItem* CUIListBox::AddItem() { CUIListBoxItem* item = xr_new<CUIListBoxItem>(m_def_item_height); item->InitFrameLineWnd (Fvector2().set(0,0), Fvector2().set(GetDesiredChildWidth()-5, m_def_item_height)); item->GetTextItem()->SetWidth (GetDesiredChildWidth()); item->SetWidth (GetDesiredChildWidth()); if(m_selection_texture.size()) item->InitTexture (m_selection_texture.c_str(), "hud\\default"); else item->InitDefault (); item->SetFont (GetFont()); item->SetSelected (false); item->SetMessageTarget (this); AddWindow (item, true); return item; }
// warning: initialization of item is incomplete! // initialization of item's height, text static and icon still necessary CUIPdaMsgListItem* CUIGameLog::AddPdaMessage(LPCSTR msg, float delay){ CUIPdaMsgListItem* pItem = xr_new<CUIPdaMsgListItem>(); pItem->Init (0,0, GetDesiredChildWidth(), 10); //fake height pItem->UIMsgText.SetTextST (msg); pItem->SetClrAnimDelay (delay); pItem->SetClrLightAnim (CHAT_LOG_ITEMS_ANIMATION, false, true, true, true); AddWindow (pItem, true); return pItem; }
CUIPdaKillMessage* CUIGameLog::AddLogMessage(KillMessageStruct& msg){ CUIPdaKillMessage* pItem = pItem = xr_new<CUIPdaKillMessage>(); pItem->SetFont(GetFont()); pItem->SetWidth(GetDesiredChildWidth()); pItem->SetHeight(kill_msg_height); pItem->Init(msg); pItem->SetClrAnimDelay(5000.0f); pItem->SetClrLightAnim(CHAT_LOG_ITEMS_ANIMATION, false, true, true, true); AddWindow(pItem, true); return pItem; }