|
1 /* |
|
2 * Copyright (c) 2009-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: Interface definition for GUI List pane component |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMRLISTPANE_H |
|
19 #define CMRLISTPANE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <coecntrl.h> |
|
23 #include "mesmrlistobserver.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MESMRFieldStorage; |
|
27 class TAknDoubleSpanScrollBarModel; |
|
28 class MFsTextViewerObserver; |
|
29 |
|
30 // CLASS DECLARATIONS |
|
31 NONSHARABLE_CLASS( CMRListPane ) : public CCoeControl, |
|
32 public MESMRListObserver |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * Static constructor. |
|
37 * |
|
38 * @return New instance of this class |
|
39 */ |
|
40 static CMRListPane* NewL( const CCoeControl& aParent, |
|
41 MESMRFieldStorage& aFactory, |
|
42 TAknDoubleSpanScrollBarModel& aScrollModel ); |
|
43 /** |
|
44 * Destructor |
|
45 */ |
|
46 ~CMRListPane(); |
|
47 |
|
48 public: // Interface |
|
49 |
|
50 /** |
|
51 * Return focused list item. |
|
52 * @return Focused list item or NULL if no focused item |
|
53 */ |
|
54 CESMRField* FocusedItem() const; |
|
55 |
|
56 /** |
|
57 * Scrolls the specific field to be fully visible |
|
58 * |
|
59 * @param aInd Index of the field that needs to be fully visible |
|
60 */ |
|
61 void ScrollItemVisible( TInt aInd ); |
|
62 |
|
63 /** |
|
64 * Scrolls the view specified amount of pixels |
|
65 * |
|
66 * @param aAmount Amount of pixels to move the view |
|
67 */ |
|
68 void ScrollView( TInt aAmount ); |
|
69 |
|
70 /** |
|
71 * Updates focus position. |
|
72 */ |
|
73 void UpdateFocusPosition(); |
|
74 |
|
75 /** |
|
76 * @return center point of the visible part of the pane |
|
77 */ |
|
78 TPoint GetViewCenterPosition() const; |
|
79 |
|
80 public: // From CCoeControl |
|
81 TInt CountComponentControls() const; |
|
82 CCoeControl* ComponentControl( TInt aIndex) const; |
|
83 void SizeChanged(); |
|
84 TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, |
|
85 TEventCode aType ); |
|
86 virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
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 }; |
|
133 |
|
134 #endif // CMRLISTPANE_H |
|
135 // End of file |