result ItemForm::OnDraw(void) { result r = E_SUCCESS; Canvas* pCanvas = GetCanvasN(); Rectangle rt = pCanvas->GetBounds(); Application * app = Application::GetInstance(); AppResource * res = app->GetAppResource(); Bitmap * pBitmap = res->GetBitmapN(L"form_bg.png", BITMAP_PIXEL_FORMAT_ARGB8888); pCanvas->DrawBitmap(rt, *pBitmap); delete pBitmap; delete pCanvas; return r; }
result FeedsListItem::Construct(int width, String & title, String & categories, String & about) { Dimension dimension = Dimension(width, ITEM_HEIGHT); ListAnnexStyle annexStyle = LIST_ANNEX_STYLE_DETAILED; int contentWidth = width - ListItemBase::GetAnnexWidth(annexStyle); result r = CustomItem::Construct(dimension, annexStyle); Application * app = Application::GetInstance(); AppResource * res = app->GetAppResource(); pRowIcon = res->GetBitmapN(L"row-icon.png", BITMAP_PIXEL_FORMAT_ARGB8888); pRowSeparatorBitmap = res->GetBitmapN(L"separator.png", BITMAP_PIXEL_FORMAT_ARGB8888); Rectangle icoDim = Rectangle(ITEM_LEFT_MARGIN, 0, ICON_DIMENSION, ICON_DIMENSION); Rectangle titleDim = Rectangle(ITEM_LEFT_MARGIN + ICON_DIMENSION, 0, contentWidth - ICON_DIMENSION - ITEM_LEFT_MARGIN, ITEM_HEIGHT / 3); Rectangle categoriesDim = Rectangle(titleDim.x, titleDim.y + titleDim.height, titleDim.width, titleDim.height); Rectangle aboutDim = Rectangle(categoriesDim.x, categoriesDim.y + categoriesDim.height, categoriesDim.width, categoriesDim.height); Rectangle separatorDim = Rectangle(0, ITEM_HEIGHT - pRowSeparatorBitmap->GetHeight(), width, pRowSeparatorBitmap->GetHeight()); AddElement(titleDim, TITLE_ELM_ID, title, 28, Color::COLOR_WHITE, Color::COLOR_BLACK, Color::COLOR_BLACK, true); AddElement(categoriesDim, CATEGORIES_ELM_ID, categories, 22, Color::COLOR_GREY, Color::COLOR_BLACK, Color::COLOR_BLACK, true); AddElement(aboutDim, ABOUT_ELM_ID, about, 18, Color::COLOR_GREY, Color::COLOR_BLACK, Color::COLOR_BLACK, true); AddElement(separatorDim, SEPARATOR_ELM_ID, *pRowSeparatorBitmap, pRowSeparatorBitmap, pRowSeparatorBitmap); return r; }