00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00022 #include "CameraExample.h"
00023
00024 CCameraAppView::CCameraAppView()
00025 {
00026 }
00027 CCameraAppView* CCameraAppView::NewL(const TRect& aRect)
00028 {
00029 CCameraAppView* self = new(ELeave) CCameraAppView();
00030 CleanupStack::PushL(self);
00031 self->ConstructL(aRect);
00032 CleanupStack::Pop();
00033 return self;
00034 }
00035
00036 CCameraAppView::~CCameraAppView()
00037 {
00038 delete iCameraText;
00039 }
00040
00044 void CCameraAppView::ConstructL( const TRect& aRect )
00045 {
00046
00047
00048 iCameraText= iEikonEnv->AllocReadResourceL( R_EXAMPLE_TEXT_BASICCAMERA );
00049
00050
00051 CreateWindowL();
00052
00053
00054 SetRect(aRect);
00055
00056
00057 ActivateL();
00058 }
00059
00063 void CCameraAppView::DrawImage(CFbsBitmap* aImage) const
00064 {
00065 CWindowGc& gc = SystemGc();
00066
00067 gc.Activate(Window());
00068 TRect drawRect=Rect();
00069 TPoint pos;
00070 pos.iX = (3 * drawRect.iBr.iX / 4) - (aImage->SizeInPixels().iWidth / 2);
00071 pos.iY = (drawRect.iBr.iY - aImage->SizeInPixels().iWidth) / 2;
00072
00073 gc.BitBlt(pos,aImage);
00074 TRect border(pos,aImage->SizeInPixels());
00075
00076 border.Grow(1,1);
00077
00078 gc.DrawRect(border);
00079 gc.Deactivate();
00080 iCoeEnv->WsSession().Flush();
00081 }
00082
00086 void CCameraAppView::Draw(const TRect& ) const
00087 {
00088
00089 CWindowGc& gc = SystemGc();
00090
00091
00092 TRect drawRect = Rect();
00093
00094
00095 const CFont* fontUsed;
00096
00097 gc.Clear();
00098
00099
00100 fontUsed = iEikonEnv->TitleFont();
00101 gc.UseFont( fontUsed );
00102
00103
00104 gc.DrawText( *iCameraText,drawRect,60 + fontUsed->HeightInPixels(),CGraphicsContext::ECenter, 0 );
00105
00106
00107 gc.DiscardFont();
00108 }
00109
00113 TPoint CCameraAppView::DrawBorders(const TSize& aSize) const
00114 {
00115 CWindowGc& gc = SystemGc();
00116
00117 gc.Activate(Window());
00118 TRect drawRect(Rect());
00119 TPoint pos;
00120 pos.iX = (drawRect.iBr.iX / 4) - (aSize.iWidth / 2);
00121 pos.iY = (drawRect.iBr.iY - aSize.iWidth) / 2;
00122 TRect border(pos,aSize);
00123
00124 border.Grow(1,1);
00125 gc.SetPenColor(KRgbBlack);
00126 gc.DrawRect(border);
00127 gc.Deactivate();
00128 iCoeEnv->WsSession().Flush();
00129 return pos;
00130 }