当前位置: 首页>>代码示例>>C++>>正文


C++ BListView::AddList方法代码示例

本文整理汇总了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;
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:51,代码来源:PListView.cpp

示例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);

}
开发者ID:HaikuArchives,项目名称:BShisen,代码行数:76,代码来源:Hall.cpp


注:本文中的BListView::AddList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。