|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Phonebook 2 names list empty state. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2NAMESLISTEMPTYSTATE_H |
|
20 #define CPBK2NAMESLISTEMPTYSTATE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "MPbk2NamesListState.h" |
|
25 #include <MPbk2CmdItemVisibilityObserver.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CPbk2ContactViewListBox; |
|
29 class CAknSearchField; |
|
30 class CPbk2ThumbnailLoader; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Phonebook 2 names list empty state. |
|
36 * Responsible for: |
|
37 * - implements names list control empty state |
|
38 */ |
|
39 NONSHARABLE_CLASS(CPbk2NamesListEmptyState) : |
|
40 public CBase, |
|
41 public MPbk2NamesListState, |
|
42 public MPbk2CmdItemVisibilityObserver |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 /** |
|
46 * Creates a new instance of this class. |
|
47 * |
|
48 * @param aParent Parent control. |
|
49 * @param aListBox Reference to the list box. |
|
50 * @param aFindBox Reference to the find box. |
|
51 * @param aThumbnailLoader Thumbnail loader. |
|
52 * @return A new instance of this class. |
|
53 */ |
|
54 static CPbk2NamesListEmptyState* NewLC( |
|
55 const CCoeControl* aParent, |
|
56 CPbk2ContactViewListBox& aListBox, |
|
57 CAknSearchField* aFindBox, |
|
58 CPbk2ThumbnailLoader& aThumbnailLoader, |
|
59 RPointerArray<MPbk2UiControlCmdItem>& aCommandItems ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 ~CPbk2NamesListEmptyState(); |
|
65 |
|
66 public: // From MPbk2NamesListState |
|
67 void ActivateStateL(); |
|
68 void DeactivateState(); |
|
69 TInt CountComponentControls() const; |
|
70 CCoeControl* ComponentControl( |
|
71 TInt aIndex ) const; |
|
72 void SizeChanged(); |
|
73 void MakeComponentsVisible( |
|
74 TBool aVisible ); |
|
75 void ActivateL(); |
|
76 void Draw( |
|
77 const TRect& aRect, |
|
78 CWindowGc& aGc ) const; |
|
79 TKeyResponse OfferKeyEventL( |
|
80 const TKeyEvent& aKeyEvent, |
|
81 TEventCode aType ); |
|
82 void HandlePointerEventL( |
|
83 const TPointerEvent& aPointerEvent ); |
|
84 TInt NamesListState() const; |
|
85 void HandleContactViewEventL( |
|
86 TInt aEvent, |
|
87 TInt aIndex ); |
|
88 void HandleCommandEventL(TInt aEvent, TInt aListboxIndex); |
|
89 CCoeControl& CoeControl(); |
|
90 void HandleControlEventL( CCoeControl* aControl, |
|
91 MCoeControlObserver::TCoeEvent aEventType, TInt aParam ); |
|
92 const MVPbkViewContact* TopContactL(); |
|
93 |
|
94 public: // From MPbk2ContactUiControl |
|
95 MPbk2ContactUiControl* ParentControl() const; |
|
96 TInt NumberOfContacts() const; |
|
97 const MVPbkBaseContact* FocusedContactL() const; |
|
98 const MVPbkViewContact* FocusedViewContactL() const; |
|
99 const MVPbkStoreContact* FocusedStoreContact() const; |
|
100 void SetFocusedContactL( |
|
101 const MVPbkBaseContact& aContact ); |
|
102 void SetFocusedContactL( |
|
103 const MVPbkContactBookmark& aContactBookmark ); |
|
104 void SetFocusedContactL( |
|
105 const MVPbkContactLink& aContactLink ); |
|
106 TInt FocusedContactIndex() const; |
|
107 void SetFocusedContactIndexL( |
|
108 TInt aIndex ); |
|
109 TInt NumberOfContactFields() const; |
|
110 const MVPbkBaseContactField* FocusedField() const; |
|
111 TInt FocusedFieldIndex() const; |
|
112 void SetFocusedFieldIndex( |
|
113 TInt aIndex ); |
|
114 TBool ContactsMarked() const; |
|
115 MVPbkContactLinkArray* SelectedContactsL() const; |
|
116 MVPbkContactLinkArray* SelectedContactsOrFocusedContactL() const; |
|
117 MPbk2ContactLinkIterator* SelectedContactsIteratorL() const; |
|
118 CArrayPtr<MVPbkContactStore>* SelectedContactStoresL() const; |
|
119 void ClearMarks(); |
|
120 void SetSelectedContactL( |
|
121 TInt aIndex, |
|
122 TBool aSelected ); |
|
123 void SetSelectedContactL( |
|
124 const MVPbkContactBookmark& aContactBookmark, |
|
125 TBool aSelected ); |
|
126 void SetSelectedContactL( |
|
127 const MVPbkContactLink& aContactLink, |
|
128 TBool aSelected ); |
|
129 |
|
130 void DynInitMenuPaneL( |
|
131 TInt aResourceId, |
|
132 CEikMenuPane* aMenuPane ) const; |
|
133 void ProcessCommandL( |
|
134 TInt aCommandId ) const; |
|
135 void UpdateAfterCommandExecution(); |
|
136 TInt GetMenuFilteringFlagsL() const; |
|
137 CPbk2ViewState* ControlStateL() const; |
|
138 void RestoreControlStateL( |
|
139 CPbk2ViewState* aState ); |
|
140 const TDesC& FindTextL(); |
|
141 void ResetFindL(); |
|
142 void HideThumbnail(); |
|
143 void ShowThumbnail(); |
|
144 void SetBlank( |
|
145 TBool aBlank ); |
|
146 void RegisterCommand( |
|
147 MPbk2Command* aCommand); |
|
148 void SetTextL( |
|
149 const TDesC& aText ); |
|
150 TAny* ContactUiControlExtension(TUid aExtensionUid ); |
|
151 |
|
152 public: // From MPbk2ContactUiControl2 |
|
153 TInt CommandItemCount() const; |
|
154 const MPbk2UiControlCmdItem& CommandItemAt( TInt aIndex ) const; |
|
155 const MPbk2UiControlCmdItem* FocusedCommandItem() const; |
|
156 void DeleteCommandItemL( TInt aIndex ); |
|
157 void AddCommandItemL(MPbk2UiControlCmdItem* aCommand, TInt aIndex); |
|
158 public: // From MPbk2PointerEventInspector |
|
159 TBool FocusedItemPointed(); |
|
160 TBool FocusableItemPointed(); |
|
161 TBool SearchFieldPointed(); |
|
162 |
|
163 public: // From MPbk2FilteredViewStackObserver |
|
164 void TopViewChangedL( MVPbkContactViewBase& aOldView ); |
|
165 void TopViewUpdatedL(); |
|
166 void BaseViewChangedL(); |
|
167 void ViewStackError( TInt aError ); |
|
168 void ContactAddedToBaseView( |
|
169 MVPbkContactViewBase& aBaseView, TInt aIndex, |
|
170 const MVPbkContactLink& aContactLink ); |
|
171 |
|
172 private: // Implementation |
|
173 void CmdItemVisibilityChanged( TInt aCmdItemId, TBool aVisible ); |
|
174 |
|
175 CPbk2NamesListEmptyState( |
|
176 const CCoeControl* aParent, |
|
177 CPbk2ContactViewListBox& aListBox, |
|
178 CAknSearchField* aFindBox, |
|
179 CPbk2ThumbnailLoader& aThumbnailLoader, |
|
180 RPointerArray<MPbk2UiControlCmdItem>& aCommandItems ); |
|
181 TBool IsContactAtListboxIndex( TInt aListboxIndex ) const; |
|
182 void AllowCommandsToShowThemselves( TBool aVisible ); |
|
183 void UpdateCommandEnabled(TInt aCommandId, TBool aEnabled); |
|
184 void UnmarkCommands() const; |
|
185 TBool IsCommandEnabled( TInt aCommandId) const; |
|
186 TInt FindCommand(TInt aCommandId) const; |
|
187 TInt CalculateListboxIndex(TInt aCommandIndex) const; |
|
188 void UnsubscribeCmdItemsVisibility() const; |
|
189 void SubscribeCmdItemsVisibility(); |
|
190 void HandleListboxEventL(TInt aEvent, TInt aListboxIndex, TBool aMantainFocus); |
|
191 |
|
192 private: // Data |
|
193 /// Ref: Parent coecontrol |
|
194 const CCoeControl& iParent; |
|
195 /// Ref: The list box |
|
196 CPbk2ContactViewListBox& iListBox; |
|
197 /// Ref: The find box control |
|
198 CAknSearchField* iFindBox; |
|
199 /// Ref: Thumbnail loader |
|
200 CPbk2ThumbnailLoader& iThumbnailLoader; |
|
201 /// Ref: Command items |
|
202 RPointerArray<MPbk2UiControlCmdItem>& iCommandItems; |
|
203 }; |
|
204 |
|
205 #endif // CPBK2NAMESLISTEMPTYSTATE_H |
|
206 |
|
207 // End of File |