18 #ifndef CMRLISTPANE_H |
18 #ifndef CMRLISTPANE_H |
19 #define CMRLISTPANE_H |
19 #define CMRLISTPANE_H |
20 |
20 |
21 // INCLUDES |
21 // INCLUDES |
22 #include <coecntrl.h> |
22 #include <coecntrl.h> |
23 #include "mesmrlistobserver.h" |
23 #include <aknlongtapdetector.h> |
|
24 #include "mmrphysicsobserver.h" |
|
25 #include "mmrfieldcontainerobserver.h" |
24 |
26 |
25 // FORWARD DECLARATIONS |
27 // FORWARD DECLARATIONS |
26 class MESMRFieldStorage; |
28 class MESMRFieldStorage; |
27 class TAknDoubleSpanScrollBarModel; |
29 class TAknDoubleSpanScrollBarModel; |
28 class MFsTextViewerObserver; |
30 class CMRFieldContainer; |
|
31 class CMRListPanePhysics; |
|
32 class CAknDoubleSpanScrollBar; |
|
33 class MMRScrollBarObserver; |
|
34 class CESMRField; |
|
35 class MESMRCalEntry; |
29 |
36 |
30 // CLASS DECLARATIONS |
37 // CLASS DECLARATIONS |
31 NONSHARABLE_CLASS( CMRListPane ) : public CCoeControl, |
38 NONSHARABLE_CLASS( CMRListPane ) : |
32 public MESMRListObserver |
39 public CCoeControl, |
|
40 public MAknLongTapDetectorCallBack, |
|
41 public MMRPhysicsObserver, |
|
42 public MMRFieldContainerObserver |
33 { |
43 { |
34 public: |
44 public: // Creation and destruction |
35 /** |
45 /** |
36 * Static constructor. |
46 * Static constructor. |
37 * |
47 * |
38 * @return New instance of this class |
48 * @return New instance of this class |
39 */ |
49 */ |
40 static CMRListPane* NewL( const CCoeControl& aParent, |
50 static CMRListPane* NewL( const CCoeControl& aParent, |
41 MESMRFieldStorage& aFactory, |
51 MESMRFieldStorage& aFactory, |
42 TAknDoubleSpanScrollBarModel& aScrollModel ); |
52 TAknDoubleSpanScrollBarModel& aScrollModel, |
43 /** |
53 CAknDoubleSpanScrollBar& aScroll, |
44 * Destructor |
54 MMRScrollBarObserver& aScrollBarObserver ); |
45 */ |
55 /** |
46 ~CMRListPane(); |
56 * Destructor |
|
57 */ |
|
58 ~CMRListPane(); |
|
59 |
|
60 public: // Interface |
|
61 |
|
62 /** |
|
63 * Initializes all fields. Needed when theme changes |
|
64 */ |
|
65 void InitializeL(); |
|
66 |
|
67 /** |
|
68 * InternalizeL is used to obtain the data from current CCalEntry. |
|
69 * CCalEntry is wrapped inside MESMRCalEntry object. This call is |
|
70 * propagated to all list items in the list. |
|
71 * |
|
72 * @param aEntry Current entry |
|
73 * @see MESMRCalEntry |
|
74 */ |
|
75 void InternalizeL( MESMRCalEntry& aEntry ); |
|
76 |
|
77 /** |
|
78 * ExternalizeL is used to store the list item data into current |
|
79 * CCalEntry. CCalEntry is wrapped inside the MESMRCalEntry object. |
|
80 * |
|
81 * @param aEntry Current entry. |
|
82 * @param aForceValidation ETrue if force validation should be used |
|
83 * @see MESMRCalEntry |
|
84 */ |
|
85 void ExternalizeL( MESMRCalEntry& aEntry, TBool aForceValidation = EFalse ); |
|
86 |
|
87 /** |
|
88 * Disables or enables relayouting. |
|
89 * |
|
90 * @param aDisable. If ETrue, disables relayouting. |
|
91 */ |
|
92 void DisableSizeChange(TBool aDisable ); |
|
93 |
|
94 /** |
|
95 * Scroll the list to put the responeArea at the top and |
|
96 * set the focus on it |
|
97 */ |
|
98 void InitialScrollL(); // TODO: Fix me. |
|
99 |
|
100 /** |
|
101 * Return focused field. |
|
102 * @return Focused list item or NULL if no focused item |
|
103 */ |
|
104 CESMRField* FocusedField() const; |
|
105 |
|
106 /** |
|
107 * Sets the field focused based on the given field id. |
|
108 * @param aFieldId Id of the field to be focused |
|
109 */ |
|
110 void SetControlFocusedL( TESMREntryFieldId aFieldId ); |
|
111 |
|
112 /** |
|
113 * Return clicked list item. |
|
114 * @return Clicked list item or NULL if no valid clicked item |
|
115 */ |
|
116 CESMRField* ClickedField() const; |
|
117 |
|
118 /** |
|
119 * Sets field to be visible in the list. |
|
120 * |
|
121 * @param aField - id of the field. |
|
122 */ |
|
123 void ShowControl( TESMREntryFieldId aFieldId ); |
|
124 |
|
125 /** |
|
126 * Is field visible or not. |
|
127 * |
|
128 * @return Boolean ETrue/EFalse |
|
129 */ |
|
130 TBool IsControlVisible( TESMREntryFieldId aFieldId ); |
|
131 |
|
132 /** |
|
133 * Get response field type of current event. |
|
134 * @Return TESMREntryFieldId |
|
135 */ |
|
136 TESMREntryFieldId GetResponseFieldsFieldId(); |
|
137 |
|
138 /** |
|
139 * Activates new fields which has been added into the storage |
|
140 * after list pane construction. |
|
141 */ |
|
142 void ReActivateL(); |
|
143 |
|
144 public: // MMRFieldContainerObserver |
|
145 void ScrollFieldsUp( TInt aPx ); |
|
146 void ScrollFieldsDown( TInt aPx ); |
|
147 void UpdateScrollBarAndPhysics(); |
|
148 |
|
149 public: // From CCoeControl |
|
150 TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, |
|
151 TEventCode aType ); |
|
152 void SizeChanged(); |
|
153 |
|
154 private: // From CCoeControl |
|
155 TInt CountComponentControls() const; |
|
156 CCoeControl* ComponentControl( TInt aIndex) const; |
|
157 void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
|
158 void ActivateL(); |
|
159 |
|
160 private: // From MMRPhysicsObserver |
|
161 void PhysicsEmulationEnded(); |
|
162 |
|
163 private: // From MAknLongTapDetectorCallBack |
|
164 void HandleLongTapEventL( |
|
165 const TPoint& aPenEventLocation, |
|
166 const TPoint& aPenEventScreenLocation ); |
47 |
167 |
48 public: // Interface |
168 private: // Implementation |
49 |
169 CMRListPane( MESMRFieldStorage& aFactory, |
50 /** |
170 TAknDoubleSpanScrollBarModel& aScrollModel, |
51 * Return focused list item. |
171 CAknDoubleSpanScrollBar& aScroll, |
52 * @return Focused list item or NULL if no focused item |
172 MMRScrollBarObserver& aScrollBarObserver ); |
53 */ |
173 void ConstructL( const CCoeControl& aParent ); |
54 CESMRField* FocusedItem() const; |
174 void DoUpdateScrollBar( TInt aFocusPosition = KErrNotFound ); |
55 |
175 TInt UpdatedFocusPosition(); |
56 /** |
176 void SetFocusAfterPointerEventL( |
57 * Scrolls the specific field to be fully visible |
177 const TPointerEvent &aPointerEvent ); |
58 * |
178 void UpdateClickedField( const TPointerEvent &aPointerEvent ); |
59 * @param aInd Index of the field that needs to be fully visible |
179 TBool HiddenFocus(); |
60 */ |
180 void ForwardReceivedPointerEventsToChildrenL(); |
61 void ScrollItemVisible( TInt aInd ); |
181 |
62 |
182 private: // Data |
63 /** |
183 /// Ref: Storage for list items. |
64 * Scrolls the view specified amount of pixels |
184 MESMRFieldStorage& iFactory; |
65 * |
185 /// Ref: scrollbar model |
66 * @param aAmount Amount of pixels to move the view |
186 TAknDoubleSpanScrollBarModel& iScrollModel; |
67 */ |
187 /// Ref: List components scroll bar |
68 void ScrollView( TInt aAmount ); |
188 CAknDoubleSpanScrollBar& iScroll; |
69 |
189 /// Own: Long tap detector |
70 /** |
190 CAknLongTapDetector* iLongtapDetector; |
71 * Updates focus position. |
191 /// Own: Field container |
72 */ |
192 CMRFieldContainer* iFieldContainer; |
73 void UpdateFocusPosition(); |
193 /// Own: Physics for kinetic scrolling |
74 |
194 CMRListPanePhysics* iPhysics; |
75 /** |
195 /// Ref: Observer for updating scroll bar revents |
76 * @return center point of the visible part of the pane |
196 MMRScrollBarObserver& iScrollBarObserver; |
77 */ |
197 /// Not owned: A field which got a pointer down event, |
78 TPoint GetViewCenterPosition() const; |
198 /// nulled when focus is changed via keyboard |
79 |
199 CESMRField* iClickedField; |
80 public: // From CCoeControl |
200 /// Own: Boolean for disabling SizeChanged handling |
81 TInt CountComponentControls() const; |
201 TBool iDisableSizeChanged; |
82 CCoeControl* ComponentControl( TInt aIndex) const; |
202 /// Own: Boolean to check, if physics action is ongoing or not |
83 void SizeChanged(); |
203 TBool iPhysicsActionOngoing; |
84 TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, |
204 /// Own: Record if the long tapping event have been comsumed, if yes, |
85 TEventCode aType ); |
205 /// then do not handle signal pointer event anymore. |
86 virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
206 TBool iLongTapEventConsumed; |
87 |
|
88 public: // From MESMRListObserver |
|
89 void ControlSizeChanged( CESMRField* aCtrl ); |
|
90 void InsertControl( TESMREntryFieldId aField ); |
|
91 void RemoveControl( TESMREntryFieldId aField ); |
|
92 TBool IsControlVisible( TESMREntryFieldId aField ); |
|
93 void SetControlFocusedL( TESMREntryFieldId aField ); |
|
94 // SCROLLING_MOD: These two methods are for CESMRRichTextViewer to |
|
95 //be able to control view area |
|
96 void MoveListAreaDownL( TInt aAmount ); |
|
97 void MoveListAreaUpL( TInt aAmount ); |
|
98 TInt ListHeight(); |
|
99 TBool IsFieldBottomVisible(); |
|
100 |
|
101 private: // Implementation |
|
102 CMRListPane( MESMRFieldStorage& aFactory, |
|
103 TAknDoubleSpanScrollBarModel& aScrollModel ); |
|
104 void ConstructL( const CCoeControl& aParent ); |
|
105 TKeyResponse MoveFocusUpL(); |
|
106 TKeyResponse MoveFocusDownL(); |
|
107 void LayoutField( CESMRField& aField, |
|
108 const TPoint& aTl ); |
|
109 void MoveFields( TInt aIndex, |
|
110 TPoint& aTl ); |
|
111 void DoSetFocusL( TInt aFocus ); |
|
112 void ScrollItemsUp( TInt aPx ); |
|
113 void ScrollItemsDown( TInt aPx ); |
|
114 void UpdateScrollBar(); |
|
115 /** |
|
116 * Moves focus to pointed field |
|
117 * @param aNextFieldIndex a new index |
|
118 * @return ETrue if move succeeded |
|
119 */ |
|
120 TBool MoveFocusL( TInt aNextFieldIndex ); |
|
121 |
|
122 |
|
123 private: // Data |
|
124 /// Ref: Storage for list items. |
|
125 MESMRFieldStorage& iFactory; |
|
126 /// Ref: scrollbar model |
|
127 TAknDoubleSpanScrollBarModel& iScrollModel; |
|
128 /// Own: Current focus index |
|
129 TInt iFocus; |
|
130 /// Own: List top visible field index |
|
131 TInt iTopVisibleIndex; |
|
132 }; |
207 }; |
133 |
208 |
134 #endif // CMRLISTPANE_H |
209 #endif // CMRLISTPANE_H |
135 // End of file |
210 // End of file |