本文整理汇总了C++中GroupList::FindGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ GroupList::FindGroup方法的具体用法?C++ GroupList::FindGroup怎么用?C++ GroupList::FindGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupList
的用法示例。
在下文中一共展示了GroupList::FindGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteGroup
void PeepsWindow::DeleteGroup(GroupItem *item)
{
// We are going to delete the group. All items will be made ungrouped. Because
// it cannot be undone, we will ask the user if it's ok to delete the group
BString alertmsg=TRANSLATE("Are you sure you want to delete this group?");
alertmsg+="\n\n";
alertmsg+=TRANSLATE("All items will be removed from this group, but the items themselves will not"
" be deleted. Once done, this cannot be undone.");
BAlert *alert=new BAlert("Mr. Peeps!", alertmsg.String(), TRANSLATE("Delete Group"),
TRANSLATE("Cancel"));
if(alert->Go()==1)
return;
if(!item)
return;
if(!item->IsExpanded())
fPeopleList->Expand(item);
// First, ensure that we have a group for all these items to go to
GroupData *oldgdata=item->GetData(),
*ungrouped=gGroupData.FindGroup(TRANSLATE("Ungrouped"));
if(!ungrouped)
{
ungrouped=gGroupData.AddGroup(TRANSLATE("Ungrouped"));
fPeopleList->AddItem(ungrouped->GetInstance());
}
if(!ungrouped->GetInstance()->IsExpanded())
fPeopleList->Expand(ungrouped->GetInstance());
int32 groupindex=fPeopleList->FullListIndexOf(ungrouped->GetInstance())+1;
// Now, we iterate through each person in the group to remove the group name
// from their group list strings
for(int32 i=0; i<oldgdata->CountPeople(); i++)
{
PersonData *pdata=oldgdata->PersonAt(i);
if(pdata->CountGroups()==1)
{
pdata->AddToGroup(ungrouped->GetInstance());
fPeopleList->MoveItem(fPeopleList->FullListIndexOf(pdata->InstanceAt(0)),groupindex);
}
else
{
PersonItem *instance=pdata->InstanceForGroup(item->Name());
fPeopleList->RemoveItem(instance);
pdata->DestroyInstance(instance);
}
pdata->RemoveFromGroup((GroupItem*)item);
}
fPeopleList->RemoveItem((GroupItem*)item);
gGroupData.RemoveGroup(item->Name());
fPeopleList->SortItemsUnder(ungrouped->GetInstance(),true,compare_peeps);
fPeopleList->Select(fPeopleList->IndexOf(ungrouped->GetInstance()));
}