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; }
CUIListBoxItem* CUIListBox::AddItem(LPCSTR text) { if (!text) return NULL; CUIListBoxItem* pItem = new CUIListBoxItem(); pItem->InitFrameLineWnd (Fvector2().set(0,0), Fvector2().set(this->GetDesiredChildWidth()-5, m_def_item_height) ); if (!m_selection_texture) pItem->InitDefault (); else pItem->InitTexture (*m_selection_texture,"hud\\default"); pItem->SetSelected (false); pItem->m_text.SetText (*CStringTable().translate(text)); pItem->SetTextColor (m_text_color, m_text_color_s); pItem->SetMessageTarget (this); AddWindow (pItem, true); return pItem; }