improved the presentation of the decoded information
[zxing.git] / symbian / ZXingBarcodeReader / inc / ZXingBarcodeReaderAppView.h
1 /*\r
2  * Copyright (c) 2009 Nokia Corporation.\r
3  */\r
4 \r
5 #ifndef __CAMERAWRAPPEREXAMPLEAPPVIEW_h__\r
6 #define __CAMERAWRAPPEREXAMPLEAPPVIEW_h__\r
7 \r
8 // INCLUDES\r
9 #include <coecntrl.h>\r
10 #include <fbs.h>\r
11 \r
12 #include <cameraengine.h>\r
13 #include <cameraengineobserver.h>\r
14 #include <akninfopopupnotecontroller.h>\r
15 #include <e32base.h>  \r
16 #include <string>\r
17 \r
18 class CZXingBarcodeReaderAppUi;\r
19 \r
20 // CLASS DECLARATION\r
21 class CZXingBarcodeReaderAppView : \r
22 public CCoeControl, public MCameraEngineObserver\r
23     {\r
24     public: \r
25         // Constructors\r
26         static CZXingBarcodeReaderAppView* NewL (const TRect& aRect );\r
27         static CZXingBarcodeReaderAppView* NewLC (const TRect& aRect );\r
28         virtual ~CZXingBarcodeReaderAppView ();\r
29     \r
30     private: \r
31         // Functions from base classes\r
32         void Draw (const TRect& aRect ) const;\r
33         void DrawTexts(CWindowGc& gc) const;\r
34         void SizeChanged ();\r
35         void HandlePointerEventL (const TPointerEvent& aPointerEvent );\r
36         void SetTitle(const TDesC& aTitle);\r
37         void SetError( const TDesC& aMsg, TInt aVal );\r
38         void SetError( const TDesC& aMsg, TInt aVal1, TInt aVal2 );\r
39         void StartFocusing();\r
40         void StorePicture( TDesC8* aData );\r
41 \r
42     public:\r
43         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);\r
44         CCameraEngine* CameraEngine(){return iCameraWrapper;};\r
45         void CancelCapturedPicture(TBool aCleanTexts=ETrue);\r
46         void Capture();        \r
47         \r
48     private: // From MCameraEngineObserver\r
49         void MceoCameraReady();\r
50         void MceoFocusComplete();\r
51         void MceoCapturedDataReady( TDesC8* aData );\r
52         void MceoCapturedBitmapReady( CFbsBitmap* aBitmap );\r
53         void MceoViewFinderFrameReady( CFbsBitmap& aFrame );\r
54         void MceoHandleError( TCameraEngineError aErrorType, TInt aError );\r
55         void MceoHandleOtherEvent( const TECAMEvent& /*aEvent*/ );\r
56     \r
57     private: \r
58         // Constructors\r
59         void ConstructL (const TRect& aRect );\r
60         CZXingBarcodeReaderAppView ();\r
61 \r
62     public:\r
63         void decodeBackbufferImage();\r
64     \r
65     private:\r
66         void CreateBackBufferL();\r
67         void ReleaseBackBuffer();\r
68         void ShowResultL(TDesC16& message);\r
69         \r
70         //timer\r
71         void StartTimer();\r
72         void StopTimer();\r
73         static TInt Tick(TAny* aObject);\r
74     \r
75     private: \r
76         // Data\r
77         \r
78         CZXingBarcodeReaderAppUi*         iAppUi;\r
79 \r
80         // CameraWrapper class\r
81         CCameraEngine*                      iCameraWrapper;\r
82 \r
83         TSize                               iViewFinderSize;\r
84         TSize                               iCaptureSize;\r
85     \r
86         CFbsBitmap*                         iBackBuffer;\r
87         CFbsBitmapDevice*                   iBackBufferDevice;\r
88         CFbsBitGc*                          iBackBufferContext;\r
89         \r
90         const CFont*                        iTitleFont;\r
91         TBuf<50>                            iTitle;\r
92         TRect                               iFocusRect;\r
93         \r
94         // Is new picture focused whit camera shutter key\r
95         TBool                               iCameraShutterFocusing;\r
96         \r
97         HBufC8*                             iData;\r
98        \r
99  \r
100 // Set the note as the member variable of your application view (for example, CAknView)\r
101 private:\r
102     CAknInfoPopupNoteController*        iNote;\r
103     CPeriodic*                                                  iPeriodic;\r
104     \r
105     };\r
106 \r
107 #endif // __CAMERAWRAPPEREXAMPLEAPPVIEW_h__\r
108 \r
109 // End of File\r