void CBatmonContainer::DrawPage(void) const
{
  CWindowGc& gc=SystemGc();
  gc.SetPenStyle(CGraphicsContext::ESolidPen);
  gc.SetPenColor(TRgb::Color4K(0xff0));
  gc.SetBrushStyle(CGraphicsContext::ENullBrush);
  gc.UseFont(LatinPlain12());
  SValue page[]=
  {
    {0,L"Battery capacity",0x0104,&CBatmonContainer::Capacity},
    {4,L"Battery impedance",0x0146,&CBatmonContainer::Impedance},
    {14,L"Standby time",0x0106,&CBatmonContainer::Hour},
    {24,L"Battery type",0x0101,&CBatmonContainer::Common},
    {24,L"Battery",0x014d,&CBatmonContainer::Battery},
    {6,L"Backup battery open",0x0122,&CBatmonContainer::Voltage},
    {6,L"Backup battery close",0x0123,&CBatmonContainer::Voltage},
    {24,L"Present charging state",0x011d,&CBatmonContainer::Common},
    {24,L"Present charger type",0x0117,&CBatmonContainer::Common},
    {6,L"Charging voltage",0x0119,&CBatmonContainer::Voltage},
    {6,L"Charging current",0x011a,&CBatmonContainer::Current}
  };
  TRect value(2,18,174,30);
  TBuf<32> data;
  for(TUint i=0;i<sizeofa(page);i++)
  {
    TPtrC ptr((TUint16*)page[i].iTitle);
    gc.DrawText(ptr,value,10);
    (this->*(page[i].iFunc))(data,page[i].iAddress);
    gc.DrawText(data,value,10,CGraphicsContext::ERight,page[i].iWidth);
    value.Move(0,13);
  }
  gc.DiscardFont();
}
void CBatmonContainer::DrawTitle(void) const
{
  CWindowGc& gc=SystemGc();
  gc.SetPenColor(TRgb::Color4K(0x048));
  gc.SetPenStyle(CGraphicsContext::ESolidPen);
  gc.SetBrushColor(TRgb::Color4K(0x006));
  gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
  TRect rect=Rect();
  rect.SetHeight(14);
  gc.DrawRect(rect);
  TRect value(rect);
  value.Shrink(1,1);
  gc.UseFont(LatinPlain12());
  SValue title[]=
  {
    {32,NULL,0x0102,&CBatmonContainer::Temperature},
    {50,NULL,0x0103,&CBatmonContainer::Voltage},
    {47,NULL,0x0113,&CBatmonContainer::Current},
    {47,NULL,0x0112,&CBatmonContainer::Current}
  };
  TBuf<32> data;
  for(TUint i=0;i<sizeofa(title);i++)
  {
    gc.SetPenStyle(CGraphicsContext::ESolidPen);
    gc.SetPenColor(TRgb::Color4K(0xff0));
    gc.SetBrushStyle(CGraphicsContext::ENullBrush);
    (this->*(title[i].iFunc))(data,title[i].iAddress);
    gc.DrawText(data,value,11,CGraphicsContext::ERight);
    DrawRight(value);
    value.Resize(-title[i].iWidth,0);
  }
  gc.DiscardFont();
}
void CContextMediaBoxDrawer::DrawItemText (TInt aItemIndex, const TRect &aItemTextRect, 
		TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool aItemIsSelected) const 
{	
	CALLSTACKITEM_N(_CL("CContextMediaBoxDrawer"), _CL("DrawItemText"));

	/*CWindowGc& gc=CEikonEnv::Static()->SystemGc();
	gc.SetPenStyle(CGraphicsContext::ENullPen);
	gc.SetBrushColor(KRgbWhite);
	gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	gc.DrawRect(aItemTextRect);*/

	TInt unread = 0;
	TInt64 parentId=CPostStorage::RootId();

	const CCMPost* post=iPostArray->GetPostAt(aItemIndex);

	if (post) {
		unread = post->iUnreadCounter();
		parentId = post->iParentId();
	}

	if (!iStandAlone) {
		if ((parentId != CPostStorage::RootId()) || (unread==0)) {
			itemd->SetSubCellSizeL(1, TSize(124, 20) );
			itemd->SetSubCellPositionL(2, TPoint(176, 0) );
		} else {
			itemd->SetSubCellSizeL(1, TSize(104, 20) );
			itemd->SetSubCellPositionL(2, TPoint(156, 0) );
		}
	}

	TListItemProperties prop;
	if (!post){
		itemd->SetSubCellFontL(1, LatinBold12() );
		prop.SetUnderlined(EFalse);
	} else {
		if (!iStandAlone) {
			prop.SetUnderlined(ETrue);
			if (unread) {
				itemd->SetSubCellFontL(1, LatinBold12() );
			} else {
				itemd->SetSubCellFontL(1, LatinPlain12() );
			}
		} else {
			if (unread) {
				itemd->SetSubCellFontL(0, iEikEnv->NormalFont() );
			} else {
				itemd->SetSubCellFontL(0, iEikEnv->DenseFont() );
			}
		}
	}
	((CFormattedCellListBoxItemDrawer*)this)->SetPropertiesL(aItemIndex, prop);

	CFormattedCellListBoxItemDrawer::DrawItemText(aItemIndex, aItemTextRect,
			aItemIsCurrent, aViewIsEmphasized, aItemIsSelected);
}
CUI176x208::CUI176x208()
	{
	// No implementation required
	iFont = CEikonEnv::Static()->NormalFont();
	iSysFont = LatinPlain12();
	iFontHeight = iFont->HeightInPixels();
	iSysFontHeight = iSysFont->HeightInPixels();
	iScreenWidth = 176;
	iScreenHeight = 208;
	}
void CContextMediaBox::CreateItemDrawerL(void)
{
	CALLSTACKITEM_N(_CL("CContextMediaBox"), _CL("CreateItemDrawerL"));

	itemd=CFormattedCellListBoxData::NewL();
	CleanupStack::PushL(itemd);

	iItemDrawer=new (ELeave) CContextMediaBoxDrawer(Model(), LatinPlain12(), itemd, iPostArray,
													iStandAlone);
	
	CleanupStack::Pop();	
}
// ---------------------------------------------------------------------------
// CBCTestMix50Case::TestCEikMfneCaseL()
// ( menu item -19- )
// ---------------------------------------------------------------------------
//
void CBCTestMix50Case::TestCEikMfneCaseL()
    {
    CEikMfne* eikMfne = new( ELeave )CEikMfne;
    CleanupStack::PushL( eikMfne );

    TInt result(0);
    eikMfne->GetFeature( 0, result );
    _LIT( KGetFeature, "CEikMfne::GetFeature" );
    AssertTrueL( ETrue, KGetFeature );

    result = eikMfne->SetFeature( 0, 0 );
    _LIT( KSetFeature, "CEikMfne::SetFeature" );
    AssertTrueL( ETrue, KSetFeature );

    result = eikMfne->SupportsFeature( 0 );
    _LIT( KSupportsFeature, "CEikMfne::SupportsFeature" );
    AssertTrueL( ETrue, KSupportsFeature );

    eikMfne->SetUseOverrideColors( ETrue );
    _LIT( KSetUseOverrideColors, "CEikMfne::SetUseOverrideColors" );
    AssertTrueL( ETrue, KSetUseOverrideColors );

    //TC indirectly calling overridden CEikMfne::SizeChanged
    eikMfne->CreateFieldArrayL(3);
    CEikMfneNumber *mfnenum = CEikMfneNumber::NewL(*LatinPlain12(), 0, 99, 55, 0);
    eikMfne->AddField(mfnenum);

    CEikMfneSeparator *mfnesep = CEikMfneSeparator::NewL(_L("xbdf0\x00C1\x00C7:").AllocL());
    eikMfne->AddField(mfnesep);
    
    CEikMfneSeparator *mfnesep1 = CEikMfneSeparator::NewL(_L("FOOBAR").AllocL());
    eikMfne->AddField(mfnesep1);
    
    TSize sizeCtrl = eikMfne->Size();
    sizeCtrl.iHeight +=1;
    sizeCtrl.iWidth +=1;
    eikMfne->SetSize(sizeCtrl);
    _LIT( KSizeChanged, "CEikMfne::SizeChanged()" );
    AssertTrueL( ETrue, KSizeChanged );


    eikMfne->ResetFieldArray();
    _LIT( KResetFieldArray, "CEikMfne::ResetFieldArray()" );
    AssertTrueL( ETrue, KResetFieldArray );
    


    CleanupStack::PopAndDestroy( eikMfne );
    }
TBool CUI176x208::ChangeFontSize(const TInt aSize)
	{
	if (aSize == iFontSize)
		return EFalse;
	
	iFontSize = aSize;
	switch(aSize)
		{
		case KFontSizeSmall:
			iFont = LatinPlain12();;
			break;
		case KFontSizeMiddle:
			iFont = CEikonEnv::Static()->NormalFont();
			break;
		case KFontSizeBig:
			iFont = CEikonEnv::Static()->TitleFont();
			break;
		}
	iFontHeight = iFont->HeightInPixels();
	return ETrue;
	}
void CContextMediaBox::LayoutSubcells()
{
	CEikonEnv* iEikEnv=CEikonEnv::Static();
	
	TFontSpec fontSpec = LatinPlain12()->FontSpecInTwips();
	fontSpec.iFontStyle.SetPosture(EPostureItalic );
	iEikEnv->ScreenDevice()->GetNearestFontInTwips(iLatinPlainItalic12, fontSpec);

	//Thumbnail (image size = 48*36)
	if (!iStandAlone) {
		TMargins no_marg, image_marg, text_marg, text_marg_2;
		
		no_marg.iBottom=no_marg.iTop=no_marg.iLeft=no_marg.iRight=0;
		
		image_marg.iTop = 5;
		image_marg.iLeft = 2;
		image_marg.iRight = 2;
		image_marg.iBottom=4;
		
		text_marg.iBottom=2;
		text_marg.iTop=0;
		text_marg.iLeft=2;
		text_marg.iRight=3;
		
		text_marg_2.iBottom=2;
		text_marg_2.iTop=0;
		text_marg_2.iLeft=0;
		text_marg_2.iRight=2;
		

	    // not supported for scalable layout
		AddSubCell(image_marg, TSize(52, 48), iEikEnv->DenseFont(), TPoint(0, 0),
			0, CGraphicsContext::ECenter, ETrue);

		AddSubCell(text_marg, TSize(104, 15), LatinPlain12(), TPoint(52, 0), 13);

		AddSubCell(text_marg, TSize(20, 15), LatinBold12(), TPoint(156, 0), 13,
			CGraphicsContext::ERight);


		//text line 1 box 1
		AddSubCell(text_marg_2, TSize(94, 16), iLatinPlainItalic12,
			TPoint(50, 18), 29, CGraphicsContext::ERight);

		//text line 1 box 2
		AddSubCell(text_marg_2, TSize(32, 16), iLatinPlainItalic12,
			TPoint(144, 18), 29, CGraphicsContext::ERight);

		//text line 2 box 1
		AddSubCell(text_marg_2, TSize(94, 14), iLatinPlainItalic12,
			TPoint(50, 33), 43, CGraphicsContext::ERight);

		//text line 2 box 2
		AddSubCell(text_marg_2, TSize(32, 14), iLatinPlainItalic12,
			TPoint(144, 33), 43, CGraphicsContext::ERight);
	}
	else 
		{
			TSize itemSize = View()->ItemSize();
			TJuikLayoutItem parent( TRect(TPoint(0,0), itemSize) );
			// Text
			{				
				TMargins marg = Juik::FromMargins8( Layout().GetLayoutItemL( LG_medialistbox, LI_medialistbox__name_margins ).Margins() );
				TJuikLayoutItem subL = parent.Combine( Layout().GetLayoutItemL( LG_medialistbox, LI_medialistbox__name ) );
				AddSubCell(marg, subL.Size(), subL.Font(), subL.Rect().iTl, subL.Baseline() );
			}

			// count
			{
				TMargins marg = Juik::FromMargins8( Layout().GetLayoutItemL( LG_medialistbox, LI_medialistbox__count_margins ).Margins() );
				TJuikLayoutItem subL = parent.Combine( Layout().GetLayoutItemL( LG_medialistbox, LI_medialistbox__count ) );
				AddSubCell(marg, subL.Size(), subL.Font(), subL.Rect().iTl, subL.Baseline(), CGraphicsContext::ERight );
			}
		}
}