Пример #1
0
void ScrollView::Build()
{
	if (nullptr == m_pDelegate)
		return;

	Item* pContent = (Item*)FindChild("Content");
	if (nullptr == pContent)
		return;

	pContent->ClearChildren();


	// create new items
	ScrollViewModel* pModel = (ScrollViewModel*)GetModel();
	int nCnt = pModel->GetCount();
	for (int i = 0; i < nCnt; i++)
	{
		Item* pItem = GenerateDelegateItem();
		if (!pItem->IsInstanceOf("ScrollViewDelegate"))
		{
			GetMgr()->Destroy(pItem->GetID());
			continue;
		}

		ScrollViewDelegate* pDelegateItem = (ScrollViewDelegate*)pItem;
		pDelegateItem->SetName("ScrollViewDelegateItem");
		pDelegateItem->SetWidth(GetWidth());
		pDelegateItem->SetHeight(50);
		pDelegateItem->SetLeft(0);
		pDelegateItem->SetTop(i*50);
		pDelegateItem->SetIndex(i);

		pContent->AddChild(pItem);
	}
}
Пример #2
0
bool Item::operator==(Item &rhs) {

	if (rhs.GetID() == GetID()) {
	
		return true;

	}

	return false;

}
Пример #3
0
bool Item::operator<(const Item &rhs) const {

	if (rhs.GetID() > GetID()) {
	
		return true;

	}

	return false;

}