本文整理汇总了C++中BListView::AddList方法的典型用法代码示例。如果您正苦于以下问题:C++ BListView::AddList方法的具体用法?C++ BListView::AddList怎么用?C++ BListView::AddList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BListView
的用法示例。
在下文中一共展示了BListView::AddList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BString
int32_t
PListViewAddItems(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *args = static_cast<PArgs*>(in), *outArgs = static_cast<PArgs*>(out);
int32 index;
if (args->FindInt32("index", &index) != B_OK)
index = -1;
if (backend->Window())
backend->Window()->Lock();
BList list;
BString itemName;
int32 nameIndex = 0;
while (args->FindString("items", &itemName, nameIndex) == B_OK)
{
list.AddItem(new BString(itemName));
nameIndex++;
}
bool outValue = true;
if (list.CountItems() > 0)
{
if (index >= 0)
outValue = backend->AddList(&list, index);
else
outValue = backend->AddList(&list);
}
if (backend->Window())
backend->Window()->Unlock();
for (int32 i = 0; i < list.CountItems(); i++)
delete ((BString*)list.ItemAt(i));
list.MakeEmpty();
outArgs->MakeEmpty();
outArgs->AddBool("value", outValue);
return B_OK;
}
示例2: BWindow
HighScores::HighScores(Hall& H, BMessage *m, BLooper *l):
BWindow(BRect(100, 100, 820, 500), "BShisen High Scores",
B_TITLED_WINDOW,
B_NOT_RESIZABLE | /*B_NOT_CLOSABLE |*/ B_NOT_ZOOMABLE)
{
BView *back;
BListView *LV;
BScrollView *SV;
BRect r;
BStringView *str;
loop = l;
msg = m;
back = new BView(Bounds(), "BackGround", B_FOLLOW_ALL, B_WILL_DRAW);
back->SetViewColor(216, 216, 216);
AddChild(back);
str = new BStringView(BRect(10, 10, 190, 25), "", "Name");
str->SetHighColor(0, 0, 0);
str->SetFontSize(14);
str->SetFont(be_bold_font);
back->AddChild(str);
str = new BStringView(BRect(200, 10, 290, 25), "", "Time");
str->SetHighColor(0, 0, 0);
str->SetFontSize(14);
str->SetFont(be_bold_font);
back->AddChild(str);
str = new BStringView(BRect(300, 10, 390, 25), "", "Game Size");
str->SetHighColor(0, 0, 0);
str->SetFontSize(14);
str->SetFont(be_bold_font);
back->AddChild(str);
str = new BStringView(BRect(400, 10, 490, 25), "", "Game Number");
str->SetHighColor(0, 0, 0);
str->SetFontSize(14);
str->SetFont(be_bold_font);
back->AddChild(str);
str = new BStringView(BRect(500, 10, 590, 25), "", "Date");
str->SetHighColor(0, 0, 0);
str->SetFontSize(14);
str->SetFont(be_bold_font);
back->AddChild(str);
str = new BStringView(BRect(600, 10, 720, 25), "", "Tiles Per Minute");
str->SetHighColor(0, 0, 0);
str->SetFontSize(14);
str->SetFont(be_bold_font);
back->AddChild(str);
r = Bounds();
r.right -= 14;
r.top += 30;
LV = new BListView(r, "");
SV = new BScrollView("", LV, B_FOLLOW_ALL, 0, false, true);
LV->AddList(H.List);
LV->AddList(H.List1);
LV->AddList(H.List2);
LV->AddList(H.List3);
LV->AddList(H.List4);
LV->AddList(H.List5);
back->AddChild(SV);
}