|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 */ |
|
9 |
|
10 |
|
11 #ifndef __FREESTYLEEMAILUI_AKN_STATUS_INDICATOR_H__ |
|
12 #define __FREESTYLEEMAILUI_AKN_STATUS_INDICATOR_H__ |
|
13 |
|
14 #include <coecntrl.h> |
|
15 |
|
16 #include "FreestyleEmailUiUtilities.h" // FSEmailUiGenericTimer |
|
17 |
|
18 const TInt KStatusIndicatorAutomaticHidingDuration = 3000; |
|
19 const TInt KStatusIndicatorDefaultDuration = -1; |
|
20 |
|
21 class CFreestyleEmailUiAknStatusIndicator : public CCoeControl, |
|
22 protected MFSEmailUiGenericTimerCallback |
|
23 { |
|
24 public: |
|
25 IMPORT_C static CFreestyleEmailUiAknStatusIndicator* NewL( const TRect& aRect, const CCoeControl* aParent = NULL ); |
|
26 |
|
27 IMPORT_C static CFreestyleEmailUiAknStatusIndicator* NewLC( const TRect& aRect, const CCoeControl* aParent = NULL ); |
|
28 |
|
29 ~CFreestyleEmailUiAknStatusIndicator(); |
|
30 |
|
31 // The ownships of aBitmap, aMaskBitmap and aText are transferred in. |
|
32 // The status indicator is display for aDuration millisecond if aDuration is not negative; |
|
33 // otherwise, it is diplayed forever until it is manually hidden. |
|
34 void ShowIndicatorL( CFbsBitmap* aBitmap, |
|
35 CFbsBitmap* aMaskBitmap, |
|
36 TDesC* aText, |
|
37 TInt aDuration ); |
|
38 |
|
39 void HideIndicator( TInt aDelayBeforeHidingInMs = 0 ); |
|
40 |
|
41 // The ownship of aText is transferred in. |
|
42 void SetTextL( TDesC* aText ); |
|
43 |
|
44 // CCoeControl |
|
45 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
46 TInt CountComponentControls() const; |
|
47 void Draw( const TRect& aRect ) const; |
|
48 void SizeChanged(); |
|
49 |
|
50 inline const CFbsBitmap* Image() const |
|
51 { |
|
52 return iBitmap; |
|
53 } |
|
54 |
|
55 inline const CFbsBitmap* ImageMask() const |
|
56 { |
|
57 return iMaskBitmap; |
|
58 } |
|
59 |
|
60 inline const TDesC* Text() const |
|
61 { |
|
62 return iText; |
|
63 } |
|
64 |
|
65 protected: |
|
66 CFreestyleEmailUiAknStatusIndicator(); |
|
67 void ConstructL( const TRect& aRect, const CCoeControl* aParent ); |
|
68 |
|
69 void TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer ); |
|
70 |
|
71 private: |
|
72 void CalculateLayout( const TRect& aRect ) const; |
|
73 |
|
74 void SetTextFont() const; |
|
75 void CalculateVisualText() const; |
|
76 |
|
77 void DrawBoundary( const TRect& aRect ) const; |
|
78 void DrawImage( const TRect& aRect ) const; |
|
79 void DrawText( const TRect& aRect ) const; |
|
80 |
|
81 void SetImage( CFbsBitmap* aBitmap, CFbsBitmap* aMaskBitmap ); |
|
82 void ScaleImage() const; |
|
83 |
|
84 void ClearImage(); |
|
85 void ClearText(); |
|
86 |
|
87 private: |
|
88 CFbsBitmap* iBitmap; |
|
89 CFbsBitmap* iMaskBitmap; |
|
90 TDesC* iText; |
|
91 |
|
92 CFSEmailUiGenericTimer* iTimer; |
|
93 |
|
94 mutable TRect iImageRect; |
|
95 mutable TRect iTextRect; |
|
96 |
|
97 mutable HBufC* iVisualText; |
|
98 mutable CFont* iTextFont; |
|
99 }; |
|
100 |
|
101 #endif // __FREESTYLEEMAILUI_AKN_STATUS_INDICATOR_H__ |