本文整理汇总了C++中ListItem::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ ListItem::IsValid方法的具体用法?C++ ListItem::IsValid怎么用?C++ ListItem::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListItem
的用法示例。
在下文中一共展示了ListItem::IsValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSelectionChanged
void InfoTreeView::OnSelectionChanged(ListItem Item, ESelectInfo::Type SelectInfo)
{
if (GetVisibility() != EVisibility::Visible)
return;
if (!Item.IsValid() || !Item->P4Item)
return;
auto bm = GP4Engine()->getBuildingMenu();
auto p = Item->P4Item;
if (!p->object)
{
bm->getText() = p->text;
return;
}
switch (p->object->getType())
{
case polygon4::detail::EObjectType::Message:
bm->showMessage((polygon4::detail::Message*)p->object);
break;
case polygon4::detail::EObjectType::JournalRecord:
bm->showMessage(((polygon4::detail::JournalRecord*)p->object)->message);
break;
#define PRINT_DESCRIPTION(t) \
case polygon4::detail::EObjectType::t: \
if (((polygon4::detail::t*)p->object)->description) \
bm->showText(p->object->getName(), ((polygon4::detail::t*)p->object)->description->string); \
else \
bm->showText(p->object->getName()); \
break
PRINT_DESCRIPTION(Building);
PRINT_DESCRIPTION(Glider);
PRINT_DESCRIPTION(Good);
PRINT_DESCRIPTION(Equipment);
PRINT_DESCRIPTION(Weapon);
PRINT_DESCRIPTION(Projectile);
PRINT_DESCRIPTION(Modificator);
#define PRINT_DESCRIPTION_VAR(t, v) \
case polygon4::detail::EObjectType::t: \
do { \
auto o = (polygon4::detail::t*)p->object; \
if (o->v->description) \
bm->showText(o->getName(), o->v->description->string); \
else \
bm->showText(o->getName()); \
break; \
} while (0)
PRINT_DESCRIPTION_VAR(ConfigurationEquipment, equipment);
PRINT_DESCRIPTION_VAR(ConfigurationGood, good);
PRINT_DESCRIPTION_VAR(ConfigurationProjectile, projectile);
PRINT_DESCRIPTION_VAR(ConfigurationWeapon, weapon);
PRINT_DESCRIPTION_VAR(ConfigurationModificator, modificator);
PRINT_DESCRIPTION_VAR(MapBuildingGlider, glider);
PRINT_DESCRIPTION_VAR(MapBuildingEquipment, equipment);
PRINT_DESCRIPTION_VAR(MapBuildingGood, good);
PRINT_DESCRIPTION_VAR(MapBuildingProjectile, projectile);
PRINT_DESCRIPTION_VAR(MapBuildingWeapon, weapon);
PRINT_DESCRIPTION_VAR(MapBuildingModificator, modificator);
}
}