|
1 /******************************************************************************* |
|
2 * Copyright (c) 2007, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - S60 implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 |
|
13 #ifndef SWTROTATEIMAGE_H |
|
14 #define SWTROTATEIMAGE_H |
|
15 |
|
16 |
|
17 #include <e32base.h> |
|
18 |
|
19 |
|
20 class MSwtControl; |
|
21 class CBitmapRotator; |
|
22 class CFbsBitmap; |
|
23 |
|
24 |
|
25 /** |
|
26 * CAORotateImage |
|
27 * This class is an active object which make an asynchronous rotation |
|
28 * on several images. Used in CSwtSlider and CSwtProgressBar. |
|
29 * @lib eswt.dll |
|
30 */ |
|
31 NONSHARABLE_CLASS(CAORotateImage) |
|
32 : public CActive |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * The 1st and 2nd phase constructor wrapper. |
|
37 */ |
|
38 static CAORotateImage* NewL(); |
|
39 |
|
40 private: |
|
41 /** |
|
42 * Contructor. |
|
43 */ |
|
44 CAORotateImage(); |
|
45 |
|
46 /** |
|
47 * Second phase constructor |
|
48 */ |
|
49 void ConstructL(); |
|
50 |
|
51 public: |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 ~CAORotateImage(); |
|
56 |
|
57 /** |
|
58 * Remove all images previously added with the AddImage() or AddImages() methods. |
|
59 */ |
|
60 void RemoveAllImages(); |
|
61 |
|
62 /** |
|
63 * Add a image which will be rotate after a call to the method Start(). |
|
64 */ |
|
65 void AddImage(CFbsBitmap* aImage); |
|
66 |
|
67 /** |
|
68 * Add images which will be rotate after a call to the method Start(). |
|
69 */ |
|
70 void AddImages(const RArray<CFbsBitmap*>& aImages); |
|
71 |
|
72 /** |
|
73 * Indicate if a redraw should be make when the rotation of all images is finih, |
|
74 * the redraw works only if a Control is passed to the Start() method. |
|
75 * @param aRedrawAfterRotation If equal ETrue so a redraw will be make |
|
76 * when the rotation is finish, if EFalse no redraw will be make at the |
|
77 * end of the rotation. |
|
78 */ |
|
79 void SetRedrawAfterRotation(TBool aRedrawAfterRotation); |
|
80 |
|
81 /** |
|
82 * Start the rotation of all images added with the AddImage() or AddImages() methods. |
|
83 * @param aControl The control which should be redraw after the images rotation. |
|
84 * See SetRedrawAfterRotation() method. |
|
85 */ |
|
86 void Start(MSwtControl* aControl = NULL); |
|
87 |
|
88 /** |
|
89 * Indicate if the rotation of all images id finish. |
|
90 * @return Returns Etrue if the rotation is started and finish. |
|
91 */ |
|
92 TBool IsFinish() const; |
|
93 |
|
94 protected: |
|
95 void DoCancel(); |
|
96 void RunL(); |
|
97 void Queue(); |
|
98 private: |
|
99 |
|
100 /** |
|
101 * Indicate the step in the rotation process. |
|
102 */ |
|
103 TInt iStep; |
|
104 |
|
105 /** |
|
106 * Indicate if the rotation process is finish. |
|
107 */ |
|
108 TBool iIsFinish; |
|
109 |
|
110 /** |
|
111 * Indicate if a redraw should be make after the rotation. |
|
112 */ |
|
113 TBool iRedraw; |
|
114 |
|
115 /** |
|
116 * The Control will can be redraw after the rotation. |
|
117 */ |
|
118 MSwtControl* iControl; |
|
119 |
|
120 /** |
|
121 * ASP for the image rotation. |
|
122 */ |
|
123 CBitmapRotator* iBitmapRotator; |
|
124 |
|
125 /** |
|
126 * Contains the images will should be rotate. |
|
127 */ |
|
128 RArray<CFbsBitmap*> iImages; |
|
129 }; |
|
130 |
|
131 |
|
132 #endif // SWTROTATEIMAGE_H |