本文整理汇总了C++中CList::GetItemName方法的典型用法代码示例。如果您正苦于以下问题:C++ CList::GetItemName方法的具体用法?C++ CList::GetItemName怎么用?C++ CList::GetItemName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::GetItemName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NameDelete
void CScreenPlayerSelect::NameDelete()
{
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if (pw == nullptr) return;
CList* pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
if (pl == nullptr) return;
int sel = pl->GetSelect();
if (sel == -1)
{
m_sound->Play(SOUND_TZOING);
return;
}
std::string gamer = pl->GetItemName(sel);
m_main->SelectPlayer(gamer);
if (!m_main->GetPlayerProfile()->Delete())
{
m_sound->Play(SOUND_TZOING);
return;
}
pl->SetSelect(-1);
CEdit* pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
if (pe != nullptr)
{
pe->SetText("");
}
ReadNameList();
UpdateNameList();
UpdateNameControl();
}
示例2: NameSelect
void CScreenPlayerSelect::NameSelect()
{
CWindow* pw;
CList* pl;
CEdit* pe;
std::string name;
int sel;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
if ( pl == nullptr ) return;
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
if ( pe == nullptr ) return;
name = pe->GetText(100);
sel = pl->GetSelect();
if ( sel == -1 )
{
NameCreate();
}
else
{
m_main->SelectPlayer(pl->GetItemName(sel));
}
m_main->ChangePhase(PHASE_MAIN_MENU);
}
示例3: UpdateNameList
void CScreenPlayerSelect::UpdateNameList()
{
CWindow* pw;
CList* pl;
CEdit* pe;
std::string name;
int total, i;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
if ( pl == nullptr ) return;
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
if ( pe == nullptr ) return;
name = pe->GetText(100);
total = pl->GetTotal();
for ( i=0 ; i<total ; i++ )
{
// TODO: stricmp?
if ( name == pl->GetItemName(i) )
{
pl->SetSelect(i);
pl->ShowSelect(false);
return;
}
}
pl->SetSelect(-1);
}
示例4: UpdateNameEdit
void CScreenPlayerSelect::UpdateNameEdit()
{
CWindow* pw;
CList* pl;
CEdit* pe;
std::string name;
int sel;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
if ( pl == nullptr ) return;
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
if ( pe == nullptr ) return;
sel = pl->GetSelect();
if ( sel == -1 )
{
pe->SetText("");
pe->SetCursor(0, 0);
}
else
{
name = pl->GetItemName(sel);
pe->SetText(name.c_str());
pe->SetCursor(name.length(), 0);
}
UpdateNameControl();
}
示例5: EventProcess
bool CScreenPlayerSelect::EventProcess(const Event &event)
{
CWindow* pw;
CList* pl;
std::string name;
std::string gamer;
switch( event.type )
{
case EVENT_KEY_DOWN:
{
auto data = event.GetData<KeyEventData>();
if (data->key == KEY(RETURN) || data->key == KEY(ESCAPE))
{
NameSelect();
}
break;
}
case EVENT_INTERFACE_NEDIT:
UpdateNameList();
UpdateNameControl();
break;
case EVENT_INTERFACE_NLIST:
UpdateNameEdit();
break;
case EVENT_INTERFACE_NOK:
NameSelect();
break;
case EVENT_INTERFACE_PERSO:
NameSelect();
m_main->ChangePhase(PHASE_APPERANCE);
break;
case EVENT_INTERFACE_NDELETE:
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) break;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
if ( pl == nullptr ) break;
GetResource(RES_TEXT, RT_DIALOG_DELGAME, name);
gamer = pl->GetItemName(pl->GetSelect());
m_dialog->StartQuestion(
StrUtils::Format(name.c_str(), gamer.c_str()), true, false, false,
[&]()
{
NameDelete();
}
);
break;
default:
return true;
}
return false;
}