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 IMAGECONVERTERCONTAINER_H
00031 #define IMAGECONVERTERCONTAINER_H
00032
00033
00034 #include <coecntrl.h>
00035
00036 #ifdef __TUI_SUPPORTED__
00037 #include <touchfeedback.h>
00038 #include <touchlogicalfeedback.h>
00039 #include <aknlongtapdetector.h>
00040 #endif
00041
00042
00043 const TInt KMIN_POINTER_COUNT = 10;
00044
00045 #define DELAY 30000
00046 #define SLEEP_DELAY 1*1000*1000
00047
00048
00049
00050 class CEikLabel;
00051 class CImageConverterAppUi;
00052
00053 enum EPointerEvents
00054 {
00055 ENoValidPointerEvent = 0,
00056 EZoomIn,
00057 EZoomOut,
00058 ENextImage,
00059 EPrevImage,
00060 ERotateRight,
00061 ERotateLeft
00062 };
00063
00064 enum ETitleState
00065 {
00066 ETitleNo = 0,
00067 ETitleZoomIn,
00068 ETitleZoomOut,
00069 ETitleNextImage,
00070 ETitlePrevImage,
00071 ETitleRotateRight,
00072 ETitleRotateLeft
00073 };
00074
00075 enum EAnimationEvents
00076 {
00077 ENoAnimation = 0,
00078 EAnimateToRight,
00079 EAnimateToLeft,
00080 EAnimateFromRight,
00081 EAnimateFromLeft
00082 };
00083
00084
00085
00090 class CImageConverterContainer : public CCoeControl,
00091 MCoeControlObserver
00092 #ifdef __TUI_SUPPORTED__
00093 , MAknLongTapDetectorCallBack
00094 #endif
00095 {
00096 public:
00097
00102 void ConstructL(const TRect& aRect);
00103
00107 ~CImageConverterContainer();
00108
00109 public:
00110 void SetBitmap(CFbsBitmap* aBitmap);
00111 void StartAnimateL();
00112 void StartNewPictureAnimate();
00113 TBool IsAnimating();
00114 void SetNextAnimationWaiting(TBool aValue);
00115
00116 void ChangeNextPictureL();
00117 void ChangePrevPictureL();
00118 void SetPictureScreenCenter(TBool aDraw);
00119
00120 public:
00121 void DrawToBackBuffer();
00122 void SetTitleText(ETitleState aState, TBool aDrawNow);
00123 void ResetTitleText(TBool aDrawNow);
00124
00125 private:
00126
00130 void SizeChanged();
00131
00135 void HandleResourceChange(TInt aType);
00136
00140 TInt CountComponentControls() const;
00141
00145 CCoeControl* ComponentControl(TInt aIndex) const;
00146
00150 void Draw(const TRect& aRect) const;
00151
00159 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00160
00161 #ifdef __TUI_SUPPORTED__
00162 void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00163 void MovePicture(const TPoint& aPoint);
00164 #endif
00165
00166 TBool IsZooming();
00167
00168 TBool IsChangingPicture();
00169
00170 TBool IsRotate();
00171
00172 TPoint FindCenterPointInRotate(TPoint& aFirstPoint);
00173
00174 void FindPointsForRotate(TPoint& aTopPoint, TPoint& aCenterPoint, TPoint& aBottomPoint, TBool& aDrawDirectionIsFromTop);
00175
00176 void StopAnimate();
00177
00178 static TInt Animate(TAny* aObj);
00179 static TInt Sleep(TAny* aObj);
00180
00181 void DoFrame();
00182
00183 void CreateBackBufferL();
00184 void ReleaseBackBuffer();
00185
00186
00187
00188
00189 #ifdef __TUI_SUPPORTED__
00190 private:
00191 void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
00192 #endif
00193
00194 private:
00195 CFbsBitmap* iBitmap;
00196 TPoint iPicturePoint;
00197 TBuf<100> iPictureInfo;
00198 TBuf<100> iStateInfo;
00199 CFont* iFont;
00200 CFont* iCbaFont;
00201
00202
00203 RArray<TPoint> iDragPoints;
00204 EPointerEvents iPointerEvent;
00205
00206
00207 CPeriodic* iPeriodic;
00208 TInt iAnimateX;
00209 TInt iPixelsToMove;
00210 TBool iNextAnimationWaiting;
00211 EAnimationEvents iAnimationEvent;
00212
00213 #ifdef __TUI_SUPPORTED__
00214
00215 CAknLongTapDetector* iLongTapDetector;
00216 TBool iLongTapDetected;
00217 TPoint iLongTapPoint;
00218
00219 MTouchFeedback* iTouchFeedBack;
00220 #endif
00221
00222 CImageConverterAppUi* iAppUi;
00223
00224 TRect iOptionsRect;
00225 TRect iExitRect;
00226
00227
00228 CFbsBitmap* iBackBuffer;
00229 CFbsBitmapDevice* iBackBufferDevice;
00230 CFbsBitGc* iBackBufferContext;
00231 TSize iBackBufferSize;
00232
00233 ETitleState iTitleState;
00234 };
00235
00236 #endif
00237
00238