00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 #ifndef __CAMERAWRAPPEREXAMPLEAPPVIEW_h__
00031 #define __CAMERAWRAPPEREXAMPLEAPPVIEW_h__
00032 
00033 
00034 #include <coecntrl.h>
00035 #include <fbs.h>
00036 
00037 #include <cameraengine.h>
00038 #include <cameraengineobserver.h>
00039 
00040 
00041 
00042 
00043 class CCameraWrapperExampleAppUi;
00044 
00045 
00046 class CCameraWrapperExampleAppView : 
00047 public CCoeControl, public MCameraEngineObserver
00048     {
00049     public: 
00050         
00051         static CCameraWrapperExampleAppView* NewL (const TRect& aRect );
00052         static CCameraWrapperExampleAppView* NewLC (const TRect& aRect );
00053         virtual ~CCameraWrapperExampleAppView ();
00054     
00055     private: 
00056         
00057         void Draw (const TRect& aRect ) const;
00058         void DrawTexts(CWindowGc& gc) const;
00059         void SizeChanged ();
00060         void HandlePointerEventL (const TPointerEvent& aPointerEvent );
00061         void SetTitle(const TDesC& aTitle);
00062         void SetError( const TDesC& aMsg, TInt aVal );
00063         void SetError( const TDesC& aMsg, TInt aVal1, TInt aVal2 );
00064         void StartFocusing();
00065         void StorePicture( TDesC8* aData );
00066 
00067     public:
00068         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00069         CCameraEngine* CameraEngine(){return iCameraWrapper;};
00070         void CancelCapturedPicture(TBool aCleanTexts=ETrue);
00071         void Capture();        
00072         
00073     private: 
00074         void MceoCameraReady();
00075         void MceoFocusComplete();
00076         void MceoCapturedDataReady( TDesC8* aData );
00077         void MceoCapturedBitmapReady( CFbsBitmap* aBitmap );
00078         void MceoViewFinderFrameReady( CFbsBitmap& aFrame );
00079         void MceoHandleError( TCameraEngineError aErrorType, TInt aError );
00080         void MceoHandleOtherEvent( const TECAMEvent&  );
00081     
00082     private: 
00083         
00084         void ConstructL (const TRect& aRect );
00085         CCameraWrapperExampleAppView ();
00086 
00087     public:
00088 
00089     
00090     private:
00091         void CreateBackBufferL();
00092         void ReleaseBackBuffer();
00093 
00094     
00095     private: 
00096         
00097         
00098         CCameraWrapperExampleAppUi*         iAppUi;
00099 
00100         
00101         CCameraEngine*                      iCameraWrapper;
00102 
00103         TSize                               iViewFinderSize;
00104         TSize                               iCaptureSize;
00105     
00106         CFbsBitmap*                         iBackBuffer;
00107         CFbsBitmapDevice*                   iBackBufferDevice;
00108         CFbsBitGc*                          iBackBufferContext;
00109         
00110         const CFont*                        iTitleFont;
00111         TBuf<50>                            iTitle;
00112         TRect                               iFocusRect;
00113         
00114         
00115         TBool                               iCameraShutterFocusing;
00116         
00117         HBufC8*                             iData;
00118     
00119     };
00120 
00121 #endif // __CAMERAWRAPPEREXAMPLEAPPVIEW_h__
00122 
00123