|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Phonebook contact view listbox model. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CPbkContactViewListModelBase_H__ |
|
21 #define __CPbkContactViewListModelBase_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> // CBase |
|
25 #include <bamdesca.h> // MDesCArray |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CContactViewBase; |
|
29 class CViewContact; |
|
30 |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Base class CContactViewBase-attached listbox models. |
|
36 */ |
|
37 NONSHARABLE_CLASS(CPbkContactViewListModelBase) : |
|
38 public CBase, |
|
39 public MDesCArray |
|
40 { |
|
41 protected: // Constructors and destructor |
|
42 /** |
|
43 * Constructor. |
|
44 * @param aView contact view to which this listbox model is |
|
45 * attached |
|
46 * @param aBuffer buffer where to format listbox model texts |
|
47 */ |
|
48 CPbkContactViewListModelBase(CContactViewBase& aView, TDes& aBuffer); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 ~CPbkContactViewListModelBase(); |
|
54 |
|
55 public: // Interface |
|
56 /** |
|
57 * Returns the group label's field index in iView's sort order. |
|
58 * Returns -1 if iView doesn't contain groups. |
|
59 */ |
|
60 TInt GroupLabelFieldIndexL() const; |
|
61 |
|
62 public: // from MDesCArray |
|
63 TInt MdcaCount() const; |
|
64 TPtrC MdcaPoint(TInt aIndex) const; |
|
65 |
|
66 private: // Implementation interface |
|
67 /** |
|
68 * Formats aBuffer to contain listbox model text for a contact. |
|
69 * @param aViewContact view's data for the contact. |
|
70 * @precond aViewContact.ContactType()==CViewContact::EContactItem |
|
71 */ |
|
72 virtual void FormatBufferForContactL |
|
73 (const CViewContact& aViewContact) const = 0; |
|
74 |
|
75 /** |
|
76 * Formats iBuffer to contain listbox model text for a group. |
|
77 * @param aViewContact view's data for the group. |
|
78 * @precond aViewContact.ContactType()==CViewContact::EContactGroup |
|
79 */ |
|
80 virtual void FormatBufferForGroupL |
|
81 (const CViewContact& aViewContact) const = 0; |
|
82 |
|
83 /** |
|
84 * Adds dynamic icon index to iBuffer. Default implementation does |
|
85 * nothing. |
|
86 * @param aViewContact view's data for the contact. |
|
87 * @precond aViewContact.ContactType()==CViewContact::EContactItem |
|
88 */ |
|
89 virtual void AddDynamicIconL |
|
90 (const CViewContact& aViewContact) const; |
|
91 |
|
92 /** |
|
93 * Formats an empty listbox model text in case of an error. |
|
94 * Default implementation makes the buffer empty. |
|
95 */ |
|
96 virtual void FormatEmptyBuffer() const; |
|
97 |
|
98 /** |
|
99 * Handles any leave occuring in MdcaCount() or MdcaPoint(). |
|
100 * Default implementation calls |
|
101 * CEikonEnv::NotifyIdleErrorWhileRedrawing(aError). |
|
102 * @param aError @see CEikonEnv::NotifyIdleErrorWhileRedrawing(aError) |
|
103 */ |
|
104 virtual void HandleError(TInt aError) const; |
|
105 |
|
106 private: // Implementation |
|
107 void FormatBufferL(TInt aIndex) const; |
|
108 |
|
109 protected: // data |
|
110 /// Ref: contact view this listbox model is attached to |
|
111 CContactViewBase& iView; |
|
112 /// Ref: buffer where to format listbox texts |
|
113 TDes& iBuffer; |
|
114 /// Own: previous iView.CountL() |
|
115 mutable TInt iPreviousCount; |
|
116 }; |
|
117 |
|
118 #endif // __CPbkContactViewListModelBase_H__ |
|
119 |
|
120 // End of File |