00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "CImageAppView.h"
00018
00019
00020 void CImageAppView::ConstructL(const TRect& )
00021 {
00022 CreateWindowL();
00023 #if defined(__WINS__)
00024 Window().SetRequiredDisplayMode(EColor256);
00025 #endif
00026 Window().SetBackgroundColor(KRgbDarkBlue);
00027 SetExtentToWholeScreen();
00028 ActivateL();
00029 }
00030
00031
00032 TDisplayMode CImageAppView::DisplayMode() const
00033 {
00034 return Window().DisplayMode();
00035 }
00036
00037
00038 void CImageAppView::Draw(const TRect& ) const
00039 {
00040 CWindowGc& gc = SystemGc();
00041
00042 if (iBitmap && iBitmap->Handle())
00043 {
00044 TSize bitmapSize(iBitmap->SizeInPixels());
00045 TPoint pt;
00046 pt.iX = (Rect().Width() - bitmapSize.iWidth) / 2;
00047 pt.iY = (Rect().Height() - bitmapSize.iHeight) / 2;
00048 gc.BitBlt(pt,iBitmap);
00049 }
00050 else
00051 gc.Clear();
00052 }
00053
00054
00055 void CImageAppView::DrawBitmapNow()
00056 {
00057 CWindowGc& gc = SystemGc();
00058 gc.Activate(Window());
00059 Draw(Rect());
00060 gc.Deactivate();
00061 ControlEnv()->WsSession().Flush();
00062 }
00063
00064
00065 void CImageAppView::Clear()
00066 {
00067 CWindowGc& gc = SystemGc();
00068 gc.Activate(Window());
00069 gc.Clear();
00070 gc.Deactivate();
00071 ControlEnv()->WsSession().Flush();
00072 }
00073
00074
00075 void CImageAppView::SetBitmap(CFbsBitmap* aBitmap)
00076 {
00077 iBitmap = aBitmap;
00078 }