コード例 #1
0
ファイル: PListView.cpp プロジェクト: HaikuArchives/PDesigner
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
0
ファイル: Hall.cpp プロジェクト: HaikuArchives/BShisen
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);

}