UIListCell *MainScreen::CellAtIndex(UIList *list, int32 index) { UIListCell *c = list->GetReusableCell("UI info cell"); //try to get cell from the reusable cells store if(!c) { c = new UIListCell(Rect(0.0f, 0.0f, 2*buttonW, cellH), "UI info cell"); } c->RemoveAllControls(); WideString keyStr = (selectedControl ? selectedControl->GetSpecificInfoKeyText(index) : L""); WideString valueStr = (selectedControl ? selectedControl->GetSpecificInfoValueText(index) : L""); FTFont* font = FTFont::Create("~res:/Fonts/MyriadPro-Regular.otf"); font->SetSize(20.0f); font->SetColor(0.8f, 0.8f, 0.8f, 1.0f); c->SetStateFont(UIControl::STATE_NORMAL, font); UIStaticText* cellKeyText = new UIStaticText(Rect(0.0f, 0.0f, buttonW, cellH)); cellKeyText->SetFont(font); cellKeyText->SetText(keyStr); c->AddControl(cellKeyText); UIStaticText* cellValueText = new UIStaticText(Rect(buttonW, 0.0f, buttonW, cellH)); cellValueText->SetFont(font); cellValueText->SetText(valueStr); c->AddControl(cellValueText); SafeRelease(font); return c;//returns cell }
UIListCell *EditorListDelegate::CellAtIndex(UIList *forList, int32 index) { // Try to get cell from the reusable cells store UIListCell *cell = forList->GetReusableCell("Cell"); if (!cell) { cell = new UIListCell(Rect(0.0f, 0.0f, cellSize.x, cellSize.y), "Cell"); } else { cell->SetSize(Vector2(cellSize.x, cellSize.y)); // Reset reusable cells relative positions - new proper positions will be calculated at UIList::AddCellAtPost() method cell->SetPosition(Vector2(0.0f, 0.0f)); } cell->RemoveAllControls(); // Get aggregator control UIControl *aggregatorControl = GetCurrentAggregatorControl(); if (aggregatorControl) { UIAggregatorControl* control = new UIAggregatorControl(); control->CopyDataFrom(aggregatorControl); // DF-1770 - Reset aggregator's background draw type control->GetBackground()->SetDrawType(UIControlBackground::DRAW_ALIGNED); cell->AddControl(control); SafeRelease(control); } else { cell->SetStateFont(UIControl::STATE_NORMAL, EditorFontManager::Instance()->GetDefaultFont()); cell->SetStateText(UIControl::STATE_NORMAL, StringToWString(Format("Cell %d",index))); cell->SetSelected(true); } return cell; }