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 * CCbsUiTopicViewContainer is container for CCbsUiTopicView. |
|
16 * It has one control, a list box, which is showing information |
|
17 * about messages in one topic. |
|
18 * |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 #ifndef CCBSUITOPICVIEWCONTAINER_H |
|
24 #define CCBSUITOPICVIEWCONTAINER_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <AknIconArray.h> // CAknIconArray |
|
28 #include <coecntrl.h> |
|
29 #include <eiklbo.h> |
|
30 #include <CbsCommon.h> |
|
31 |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 |
|
35 class CSelectionList; |
|
36 class CEikColumnListBox; |
|
37 class CListBoxNumbers; |
|
38 class CFbsBitmap; |
|
39 class CCbsUiTopicView; |
|
40 |
|
41 |
|
42 // CLASS DEFINITIONS |
|
43 |
|
44 /** |
|
45 * Container for CCbsUiTopicView. |
|
46 */ |
|
47 class CCbsUiTopicViewContainer : public CCoeControl, |
|
48 public MEikListBoxObserver |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Creates an instance of the class. |
|
54 * |
|
55 * @param aTopicView For handling key events. |
|
56 * @param aRect An area ment for container. |
|
57 */ |
|
58 static CCbsUiTopicViewContainer* NewL( |
|
59 CCbsUiTopicView& aTopicView, |
|
60 const TRect& aRect ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 ~CCbsUiTopicViewContainer(); |
|
66 |
|
67 public: // New functions |
|
68 |
|
69 /** |
|
70 * Resets list box items. This should be called before ReloadOfferL. |
|
71 */ |
|
72 void ReloadStarts() const; |
|
73 |
|
74 /** |
|
75 * During reloading offers the view a single message and the |
|
76 * beginning of it. |
|
77 * |
|
78 * Note that the text part must be less than 100 characters |
|
79 * (Well, there is only room for 20 characters, I suppose). |
|
80 * |
|
81 * @param aMessage It is the message. |
|
82 * @param aBuffer It is the beginning of the contents. |
|
83 */ |
|
84 void ReloadOfferL( const TCbsMessage& aMessage, const TDesC& aBuffer ) const; |
|
85 |
|
86 /** |
|
87 * Handles a list box item addition. This should be called |
|
88 * when reload is done. |
|
89 */ |
|
90 void ReloadEndsL(); |
|
91 |
|
92 /** |
|
93 * Returns the current position. |
|
94 * |
|
95 * @return Current position in the list. |
|
96 */ |
|
97 TInt CurrentPosition() const; |
|
98 |
|
99 /** |
|
100 * Sets current item index and draws. |
|
101 * |
|
102 * @param aItemIndex index to be focused |
|
103 */ |
|
104 void SetCurrentItemIndex( TInt aItemIndex ) const; |
|
105 |
|
106 /** |
|
107 * Returns the list box |
|
108 * |
|
109 * @return list box |
|
110 */ |
|
111 CEikColumnListBox* GetListBox(); |
|
112 |
|
113 public: // from CCoeControl |
|
114 |
|
115 /** |
|
116 * Return the amount of controls. |
|
117 * |
|
118 * @return amount of controls. |
|
119 */ |
|
120 TInt CountComponentControls() const; |
|
121 |
|
122 /** |
|
123 * Return a control. |
|
124 * |
|
125 * @param aIndex It is the index to the control. |
|
126 * @return It returns the control. |
|
127 */ |
|
128 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
129 |
|
130 /** |
|
131 * Sets a new size to the list box. |
|
132 */ |
|
133 void SizeChanged(); |
|
134 |
|
135 /** |
|
136 * Informs that the focus is changed. |
|
137 * @param aDrawNow Contains the value that was passed to it by SetFocus() |
|
138 */ |
|
139 void FocusChanged( TDrawNow aDrawNow ); |
|
140 |
|
141 /** |
|
142 * Offers a key to the view for handling. |
|
143 * |
|
144 * @param aKeyEvent what kind of key produced this event |
|
145 * @param aType Which kind of action produced this event |
|
146 * @return It tells whether the view consumed the keypress or not. |
|
147 */ |
|
148 TKeyResponse OfferKeyEventL( |
|
149 const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
150 |
|
151 /** |
|
152 * Gets the control's help context. |
|
153 * |
|
154 * @param aContext The control's help context |
|
155 */ |
|
156 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
157 |
|
158 public: |
|
159 /** |
|
160 * |
|
161 */ |
|
162 void HandleResourceChange( TInt aType ); |
|
163 |
|
164 public: // From MEikListBoxObserver |
|
165 |
|
166 /** |
|
167 * Handles list box events. |
|
168 * |
|
169 * @param aEventType The event identifier. |
|
170 */ |
|
171 void HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
172 TListBoxEvent aEventType ); |
|
173 |
|
174 private: |
|
175 |
|
176 /** |
|
177 * Constructor. |
|
178 * |
|
179 * @param aTopicView It is the topic view. |
|
180 */ |
|
181 CCbsUiTopicViewContainer( CCbsUiTopicView& aTopicView ); |
|
182 |
|
183 /** |
|
184 * Finalizes the construction. |
|
185 * |
|
186 * @param aRect It is the client rectangle. |
|
187 */ |
|
188 void ConstructL( const TRect& aRect ); |
|
189 |
|
190 /** |
|
191 * LoadIconsL |
|
192 * |
|
193 * Loads icons to CAknIconArray and set this iconarray |
|
194 * to list iListBox(CEikColumnListBox) |
|
195 */ |
|
196 void LoadIconsL(); |
|
197 |
|
198 /** |
|
199 * Append icon to icon array. |
|
200 * |
|
201 * @param aId Icon id |
|
202 * @param aIcons Icon array |
|
203 * @param aIconFileWithPath Icon file name with path |
|
204 * @param aIconGraphicsIndex Picture index. |
|
205 * @param aIconGraphicsMaskIndex Mask index. |
|
206 */ |
|
207 void AddIconL( TAknsItemID aId, CAknIconArray* aIcons, |
|
208 const TDesC& aIconFileWithPath, |
|
209 TInt aIconGraphicsIndex, |
|
210 TInt aIconGraphicsMaskIndex, |
|
211 TBool aColorIcon = EFalse ); |
|
212 |
|
213 /** |
|
214 * Change bitmaps when skin changes. |
|
215 */ |
|
216 void SkinBitmapChangesL( ); |
|
217 |
|
218 /** |
|
219 * Construct icon |
|
220 * |
|
221 * @param aColourIcon Is icon a colour icon |
|
222 * @param aInstance Current skin instance |
|
223 * @param aID Icon ID |
|
224 * @param aFilename Icon file name with path |
|
225 * @param aFileBitmapId ID of the bitmap in the file |
|
226 * @param aFileMaskId ID of the mask in the file |
|
227 * |
|
228 * @return The constructed icon |
|
229 */ |
|
230 CGulIcon* ConstructIconL( TBool& aColourIcon, |
|
231 MAknsSkinInstance* aInstance, |
|
232 const TAknsItemID& aID, |
|
233 const TDesC& aFilename, |
|
234 const TInt aFileBitmapId, |
|
235 const TInt aFileMaskId ); |
|
236 |
|
237 private: // Data |
|
238 |
|
239 // It is the listbox. |
|
240 CEikColumnListBox* iListBox; |
|
241 |
|
242 // For handling some key pressures and for marking a current |
|
243 // topic handle. |
|
244 CCbsUiTopicView& iTopicView; |
|
245 |
|
246 }; |
|
247 |
|
248 #endif // CCBSUITOPICVIEWCONTAINER_H |
|
249 |
|
250 // End of File |
|