|
1 /* |
|
2 * Name : ARContainer.h |
|
3 * Description : |
|
4 * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser |
|
5 * Website : http://OpenMAR.org |
|
6 * |
|
7 * Copyright (c) 2010 David Caabeiro |
|
8 * |
|
9 * All rights reserved. This program and the accompanying materials are made available |
|
10 * under the terms of the Eclipse Public License v1.0 which accompanies this |
|
11 * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html |
|
12 * |
|
13 */ |
|
14 |
|
15 #ifndef __ARCONTAINER_H__ |
|
16 #define __ARCONTAINER_H__ |
|
17 |
|
18 #include <coecntrl.h> |
|
19 #include <coecobs.h> |
|
20 #include <AknButton.h> |
|
21 |
|
22 #include "POIOverlay.h" |
|
23 #include "Camera.h" |
|
24 #include "Screenshot.h" |
|
25 |
|
26 class CAknView; |
|
27 |
|
28 /** |
|
29 * @brief AR control class |
|
30 * |
|
31 * This class provides the basic view and is in charge of initializing the camera, |
|
32 * which dictates the refresh rate of the overlays |
|
33 */ |
|
34 class CARContainer : public CCoeControl, |
|
35 public MCoeControlObserver, |
|
36 public MCoeForegroundObserver, |
|
37 public CDigitalCamera::MObserver, |
|
38 public CScreenshot::MObserver |
|
39 { |
|
40 public: |
|
41 static CARContainer* NewL(CAknView& aView, const TRect& aRect); |
|
42 ~CARContainer(); |
|
43 |
|
44 private: |
|
45 CARContainer(CAknView& aView); |
|
46 void ConstructL(const TRect& aRect); |
|
47 |
|
48 void CreateButtonGroupL(); |
|
49 void DeleteButtonGroup(); |
|
50 |
|
51 static TInt SensorStart(TAny* aPtr); |
|
52 void DoSensorStart(); |
|
53 |
|
54 static TInt SensorStop(TAny* aPtr); |
|
55 void DoSensorStop(); |
|
56 |
|
57 void ScreenshotStartL(); |
|
58 void ScreenshotStop(); |
|
59 |
|
60 protected: |
|
61 void SizeChanged(); |
|
62 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
63 void HandleResourceChange(TInt aType); |
|
64 void Draw(const TRect& aRect) const; |
|
65 |
|
66 TInt CountComponentControls() const; |
|
67 CCoeControl* ComponentControl(TInt aIndex) const; |
|
68 |
|
69 protected: |
|
70 // From MCoeControlObserver |
|
71 void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); |
|
72 |
|
73 // From MCoeForegroundObserver |
|
74 void HandleGainingForeground(); |
|
75 void HandleLosingForeground(); |
|
76 |
|
77 // From CDigitalCamera::MObserver |
|
78 void CameraReady(TInt aError); |
|
79 void CameraFrame(CFbsBitmap& aFrame); |
|
80 void FocusReady(TInt aError); |
|
81 |
|
82 // From CScreenshot::MObserver |
|
83 void ScreenshotReadyL(TInt aError, const TDesC& aFilename); |
|
84 |
|
85 private: |
|
86 CAknView& iView; |
|
87 CAknButton* iScreenshotButton; |
|
88 |
|
89 CFbsBitmap* iBitmap; |
|
90 CFbsBitmapDevice* iBitmapDevice; |
|
91 CFbsBitGc* iBitmapContext; |
|
92 |
|
93 enum TButtonId { |
|
94 EScreenshot, |
|
95 ETotal |
|
96 }; |
|
97 |
|
98 private: |
|
99 RPointerArray<OpenMAR::CPOIOverlay> iOverlayList; |
|
100 CDigitalCamera* iCamera; |
|
101 CScreenshot* iScreenshot; |
|
102 CIdle* iSensorTask; |
|
103 }; |
|
104 |
|
105 #endif // __ARCONTAINER_H__ |