|
1 /* |
|
2 * Copyright (c) 2007-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 "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Contains the implementation of response area |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CESMRRESPONSEFIELD_H |
|
19 #define CESMRRESPONSEFIELD_H |
|
20 |
|
21 // INCLUDES |
|
22 #include "cesmrfield.h" |
|
23 #include "resmrstatic.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CLayoutManager; |
|
27 class MESMRResponseObserver; |
|
28 class CESMRConflictPopup; |
|
29 class CESMRResponseItem; |
|
30 |
|
31 /** |
|
32 * Response field is the actual field that receives focus when scrolling in the |
|
33 * viewer list. This field constructs the items and sets texts, fonts and sizes for those, |
|
34 * This field is also responsible of scrolling between the items and calling the response observer |
|
35 * when answer is selected (e.g. by pressing accept item). |
|
36 */ |
|
37 NONSHARABLE_CLASS( CESMRResponseField ) : public CESMRField |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * Creates new response field. Response field is responsible |
|
42 * of creating all the items needed in the area. |
|
43 * @return New response field object. |
|
44 */ |
|
45 static CESMRResponseField* NewL(MESMRResponseObserver* aResponseObserver); |
|
46 |
|
47 /** |
|
48 * C++ Destructor. |
|
49 */ |
|
50 ~CESMRResponseField(); |
|
51 |
|
52 public: // From CCoeControl |
|
53 TInt CountComponentControls() const; |
|
54 CCoeControl* ComponentControl( TInt aInd ) const; |
|
55 void SizeChanged(); |
|
56 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
57 void FocusChanged( TDrawNow aDrawNow ); |
|
58 TSize MinimumSize(); |
|
59 |
|
60 public: // From CESMRField |
|
61 void InitializeL(); |
|
62 void InternalizeL( MESMRCalEntry& aEntry ); |
|
63 void ExecuteGenericCommandL( TInt aCommand ); |
|
64 void SetLayoutManager( CESMRLayoutManager* aLayout ); |
|
65 void SetOutlineFocusL( TBool aFocus ); |
|
66 |
|
67 public: // New methods |
|
68 /** |
|
69 * Set the response observer for this class. |
|
70 * |
|
71 * @param aResponseObserver - Response observer |
|
72 */ |
|
73 void AddObserver( MESMRResponseObserver* aResponseObserver ); |
|
74 |
|
75 /** |
|
76 * Calls onwards the SetFont() method for all the items in the array |
|
77 * |
|
78 * @param aFont - Font to be set. |
|
79 */ |
|
80 void SetFont( const CFont* aFont ); |
|
81 |
|
82 /** |
|
83 * Selects the current item. |
|
84 * @return ETrue if item is selectable |
|
85 */ |
|
86 TBool ItemSelectedL(); |
|
87 |
|
88 private: // Implementation |
|
89 CESMRResponseField(MESMRResponseObserver* aResponseObserver); |
|
90 void ConstructL(); |
|
91 void Draw( const TRect& aRect ) const; |
|
92 void HandleCancelledEventItemsL( MESMRCalEntry& aEntry ); |
|
93 CCoeControl* ControlItem( TInt aIndex ); |
|
94 |
|
95 private: |
|
96 /// Own: Conflict popup |
|
97 CESMRConflictPopup* iConfPopup ; |
|
98 /// Array for the response items. Owns the items. |
|
99 RPointerArray <CESMRResponseItem> iResponseItemArray; |
|
100 /// Observer for the response |
|
101 MESMRResponseObserver* iResponseObserver; |
|
102 /// Currently selected index |
|
103 TInt iSelectionIndex; |
|
104 /// Layout data |
|
105 CESMRLayoutManager* iLayout; |
|
106 /// Font for the label text |
|
107 const CFont* iFont; |
|
108 /// Own: Static TLS data handler |
|
109 RESMRStatic iESMRStatic; |
|
110 /// iESMRstatic accessed |
|
111 TBool iESMRStaticAccessed; |
|
112 }; |
|
113 |
|
114 |
|
115 #endif // CESMRRESPONSEFIELD_H |