examples/ForumNokia/CameraExample/inc/CameraWrapperExampleAppView.h

00001 /*
00002  * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003  *    
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are met:
00006  *    
00007  *  * Redistributions of source code must retain the above copyright notice, this
00008  *    list of conditions and the following disclaimer.
00009  *  * Redistributions in binary form must reproduce the above copyright notice,
00010  *    this list of conditions and the following disclaimer in the documentation
00011  *    and/or other materials provided with the distribution.
00012  *  * Neither the name of Nokia Corporation nor the names of its contributors
00013  *    may be used to endorse or promote products derived from this software
00014  *    without specific prior written permission.
00015  *    
00016  *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017  *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018  *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  *    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020  *    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021  *    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022  *    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023  *    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024  *    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025  *    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  *    
00027  *    Description:  
00028  */
00029 
00030 #ifndef __CAMERAWRAPPEREXAMPLEAPPVIEW_h__
00031 #define __CAMERAWRAPPEREXAMPLEAPPVIEW_h__
00032 
00033 // INCLUDES
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 // CLASS DECLARATION
00046 class CCameraWrapperExampleAppView : 
00047 public CCoeControl, public MCameraEngineObserver
00048     {
00049     public: 
00050         // Constructors
00051         static CCameraWrapperExampleAppView* NewL (const TRect& aRect );
00052         static CCameraWrapperExampleAppView* NewLC (const TRect& aRect );
00053         virtual ~CCameraWrapperExampleAppView ();
00054     
00055     private: 
00056         // Functions from base classes
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: // From MCameraEngineObserver
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& /*aEvent*/ );
00081     
00082     private: 
00083         // Constructors
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         // Data
00097         
00098         CCameraWrapperExampleAppUi*         iAppUi;
00099 
00100         // CameraWrapper class
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         // Is new picture focused whit camera shutter key
00115         TBool                               iCameraShutterFocusing;
00116         
00117         HBufC8*                             iData;
00118     
00119     };
00120 
00121 #endif // __CAMERAWRAPPEREXAMPLEAPPVIEW_h__
00122 
00123 // End of File

Generated by  doxygen 1.6.2