|
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 "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 for field container |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMRFIELDCONTAINER_H |
|
19 #define CMRFIELDCONTAINER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <coecntrl.h> |
|
23 #include "mesmrlistobserver.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MESMRFieldStorage; |
|
27 class MMRFieldContainerObserver; |
|
28 |
|
29 // CLASS DECLARATIONS |
|
30 NONSHARABLE_CLASS( CMRFieldContainer ) : |
|
31 public CCoeControl, |
|
32 public MESMRListObserver |
|
33 { |
|
34 public: // Creation and destruction |
|
35 /** |
|
36 * Static constructor. |
|
37 * |
|
38 * @return New instance of this class |
|
39 */ |
|
40 static CMRFieldContainer* NewL( |
|
41 MESMRFieldStorage& aFactory, |
|
42 const CCoeControl& aParent ); |
|
43 /** |
|
44 * Destructor |
|
45 */ |
|
46 ~CMRFieldContainer(); |
|
47 |
|
48 public: // Interface |
|
49 |
|
50 /** |
|
51 * Return focused field. |
|
52 * @return Focused list item or NULL if no focused item |
|
53 */ |
|
54 CESMRField* FocusedField() const; |
|
55 |
|
56 /** |
|
57 * Moves focus up one step. |
|
58 * |
|
59 * @param aHiddenFocus, in case of hidden focus use case, ETrue. |
|
60 * @return TKeyResponse, if key response was used or not |
|
61 */ |
|
62 TKeyResponse MoveFocusUpL( TBool aHiddenFocus ); |
|
63 |
|
64 /** |
|
65 * Moves focus down one step. |
|
66 * |
|
67 * @param aHiddenFocus, in case of hidden focus use case, ETrue. |
|
68 * @return TKeyResponse, if key response was used or not |
|
69 */ |
|
70 TKeyResponse MoveFocusDownL( TBool aHiddenFocus ); |
|
71 |
|
72 /** |
|
73 * Moves focus visible if it is partly or completely out of |
|
74 * viewable area. |
|
75 */ |
|
76 void SetFieldContainerObserver( MMRFieldContainerObserver* aObserver ); |
|
77 |
|
78 public: // From MESMRListObserver |
|
79 void ControlSizeChanged( CESMRField* aField ); |
|
80 void ShowControl( TESMREntryFieldId aFieldId ); |
|
81 void HideControl( TESMREntryFieldId aFieldId ); |
|
82 TBool IsControlVisible( TESMREntryFieldId aFieldId ); |
|
83 void SetControlFocusedL( TESMREntryFieldId aFieldId ); |
|
84 TInt ListHeight(); |
|
85 TBool IsFocusedControlsBottomVisible(); |
|
86 void ScrollControlVisible( TInt aInd ); |
|
87 void RePositionFields( TInt aAmount ); |
|
88 TRect ViewableAreaRect(); |
|
89 |
|
90 public: // From CCoeControl |
|
91 TSize MinimumSize(); |
|
92 |
|
93 private: // From CCoeControl |
|
94 TInt CountComponentControls() const; |
|
95 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
96 void SizeChanged(); |
|
97 |
|
98 private: // Implementation |
|
99 CMRFieldContainer( MESMRFieldStorage& aFactory ); |
|
100 void ConstructL( const CCoeControl& aParent ); |
|
101 void MoveFields( TInt aIndex, TPoint& aTl ); |
|
102 void LayoutField( CESMRField& aField, const TPoint& aTl ); |
|
103 TInt LastVisibleField( TESMREntryFieldId aFieldId ); |
|
104 void DoSetFocusL( TInt aNewFocusIndex ); |
|
105 TKeyResponse MoveFocusVisibleL(); |
|
106 |
|
107 private: // Data |
|
108 // Own: Informs listapane about needed position changes |
|
109 MMRFieldContainerObserver* iObserver; |
|
110 /// Ref: Storage for list items. |
|
111 MESMRFieldStorage& iFactory; |
|
112 /// Own: Current focus index |
|
113 TInt iFocusedFieldIndex; |
|
114 |
|
115 }; |
|
116 |
|
117 #endif // CMRFIELDCONTAINER_H |
|
118 |
|
119 // End of file |