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: Declaration of class CApNetSelectorListboxModel. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef APNETSELECTOR_LISTBOX_MODEL_H |
|
20 #define APNETSELECTOR_LISTBOX_MODEL_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <eikdialg.h> |
|
24 #include <ApNetworkItemList.h> |
|
25 |
|
26 |
|
27 // CONSTANTS |
|
28 // Granularity of the model array. |
|
29 const TInt KGranularity = 8; |
|
30 |
|
31 |
|
32 _LIT( KListItemFormatGraphicOnOff, "%d\t%*S" ); |
|
33 |
|
34 const TInt KMaxFormatSize = sizeof( KListItemFormatGraphicOnOff ); |
|
35 const TInt KMaxListItemNameLength = 50; // = KCommsDbSvrMaxFieldLength |
|
36 |
|
37 |
|
38 /** |
|
39 * Buffer size for formatting listbox text. Maximum item length |
|
40 * plus listbox internals (tabulators for icons etc.) must fit into it. |
|
41 * |
|
42 * Important note: |
|
43 * The model of the listbox is a CAknFilteredTextListBoxModel. |
|
44 * The *itemarray* of that model is this class. That is, whatever is in |
|
45 * the model (this class), it may not be visible, if it is filtered out. |
|
46 * We always must use the listbox's Model() to get visible ones. |
|
47 */ |
|
48 const TInt KMaxApSelectorListboxName = KMaxListItemNameLength+KMaxFormatSize; |
|
49 |
|
50 |
|
51 // CLASS DECLARATION |
|
52 |
|
53 /** |
|
54 * Model for the network group selection listbox. |
|
55 * It is an array of CApNetworkItem pointers; |
|
56 * items are owned. |
|
57 */ |
|
58 NONSHARABLE_CLASS( CApNetSelectorListboxModel ) : |
|
59 public CApNetworkItemList, |
|
60 public MDesCArray |
|
61 { |
|
62 public: // Construct / destruct |
|
63 |
|
64 /** |
|
65 * Constructor. |
|
66 */ |
|
67 CApNetSelectorListboxModel( ); |
|
68 |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 virtual ~CApNetSelectorListboxModel(); |
|
73 |
|
74 public: // from MDesCArray |
|
75 |
|
76 /** |
|
77 * Get number of items in the model. |
|
78 * @return Number of items. |
|
79 */ |
|
80 TInt MdcaCount() const; |
|
81 |
|
82 /** |
|
83 * Text to be displayed for this item. |
|
84 * @param aIndex Index of item. |
|
85 * @return TPtrC for this item text (text owned by the model). |
|
86 */ |
|
87 TPtrC MdcaPoint( TInt aIndex ) const; |
|
88 |
|
89 |
|
90 public: |
|
91 /** |
|
92 * index <--> Uid conversion |
|
93 * @param aUid UID |
|
94 * @param aErr Error code |
|
95 * @return The index for the passed UID |
|
96 */ |
|
97 TInt Item4Uid( TUint32 aUid, TInt& aErr ) const; |
|
98 |
|
99 private: // data |
|
100 /** |
|
101 * Formats the text of the listbox. |
|
102 * @param aIndex Index of item. |
|
103 * @param aBuf Buffer to store formatted text. |
|
104 */ |
|
105 void FormatListboxText( TInt aIndex, TDes& aBuf ) const; |
|
106 |
|
107 /** |
|
108 * MdcaPoint() cannot leave, so this buffer is allocated |
|
109 * to allow formatting. Fortunately, doesn't have to be very |
|
110 * large. |
|
111 * We have to use MUTABLE CAST, as MdcaPoint is const (odd enough), |
|
112 * so wouldn't allow formatting the text in a member... |
|
113 */ |
|
114 __MUTABLE TBuf<KMaxApSelectorListboxName> iBuf; |
|
115 |
|
116 }; |
|
117 |
|
118 |
|
119 #endif |
|
120 |
|
121 // End of file |
|