28 #include <akntabgrp.h> |
28 #include <akntabgrp.h> |
29 #include <akntoolbarextension.h> |
29 #include <akntoolbarextension.h> |
30 #include <aknquerydialog.h> |
30 #include <aknquerydialog.h> |
31 #include <barsread.h> |
31 #include <barsread.h> |
32 #include <akntitle.h> |
32 #include <akntitle.h> |
|
33 #include <akniconarray.h> |
|
34 #include <EIKCLBD.H> |
33 |
35 |
34 #include "buildno.h" |
36 #include "buildno.h" |
35 |
37 |
36 const TInt KDefaultGran = 5; |
38 const TInt KDefaultGran = 5; |
37 |
39 |
38 CPodcastListContainer::CPodcastListContainer() |
40 CPodcastListContainer::CPodcastListContainer() |
39 { |
41 { |
40 } |
42 } |
41 |
43 |
42 void CPodcastListContainer::SetKeyEventListener(MKeyEventListener *aKeyEventListener) |
44 void CPodcastListContainer::SetContainerListener(MContainerListener *aContainerListener) |
43 { |
45 { |
44 iKeyEventListener = aKeyEventListener; |
46 iContainerListener = aContainerListener; |
45 } |
47 } |
46 |
48 |
47 TKeyResponse CPodcastListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
49 TKeyResponse CPodcastListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
48 { |
50 { |
49 TKeyResponse response = iListbox->OfferKeyEventL(aKeyEvent, aType); |
51 TKeyResponse response = iListbox->OfferKeyEventL(aKeyEvent, aType); |
50 if (iKeyEventListener) |
52 if (iContainerListener) |
51 iKeyEventListener->OfferKeyEventL(aKeyEvent, aType); |
53 iContainerListener->OfferKeyEventL(aKeyEvent, aType); |
52 |
54 |
53 return response; |
55 return response; |
54 } |
56 } |
55 |
57 |
56 void CPodcastListContainer::ConstructL( const TRect& aRect, TInt aListboxFlags ) |
58 void CPodcastListContainer::ConstructL( const TRect& aRect, TInt aListboxFlags ) |
57 { |
59 { |
|
60 DP("CPodcastListContainer::ConstructL BEGIN"); |
58 CreateWindowL(); |
61 CreateWindowL(); |
59 |
62 |
60 iBgContext = |
63 iBgContext = |
61 CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
64 CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
62 aRect, |
65 aRect, |
63 ETrue ); |
66 ETrue ); |
64 |
67 |
|
68 iListboxLandscape = new (ELeave) CAknSingleLargeStyleListBox; |
|
69 iListboxLandscape->ConstructL(this, aListboxFlags); |
|
70 iListboxLandscape->SetMopParent( this ); |
|
71 iListboxLandscape->SetContainerWindowL(*this); |
|
72 iListboxLandscape->CreateScrollBarFrameL(ETrue); |
|
73 iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
74 iListboxLandscape->SetSize(aRect.Size()); |
|
75 iListboxLandscape->MakeVisible(EFalse); |
|
76 |
|
77 iListboxPortrait = new (ELeave) CAknDoubleLargeStyleListBox; |
|
78 iListboxPortrait->ConstructL(this, aListboxFlags); |
|
79 iListboxPortrait->SetMopParent( this ); |
|
80 iListboxPortrait->SetContainerWindowL(*this); |
|
81 iListboxPortrait->CreateScrollBarFrameL(ETrue); |
|
82 iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
83 iListboxPortrait->SetSize(aRect.Size()); |
|
84 iListboxPortrait->MakeVisible(EFalse); |
|
85 |
|
86 if (aRect.Width() > aRect.Height()) |
|
87 { |
|
88 iLandscape = ETrue; |
|
89 iListbox = iListboxLandscape; |
|
90 iListboxLandscape->MakeVisible(ETrue); |
|
91 } |
|
92 else |
|
93 { |
|
94 iLandscape = EFalse; |
|
95 iListboxPortrait->MakeVisible(ETrue); |
|
96 iListbox = (CEikColumnListBox*) iListboxPortrait; |
|
97 } |
|
98 |
|
99 MakeVisible(EFalse); |
|
100 |
65 // Set the windows size |
101 // Set the windows size |
66 SetRect( aRect ); |
102 SetRect( aRect ); |
67 iListbox =static_cast<CEikFormattedCellListBox*>( new (ELeave) CAknDoubleLargeStyleListBox); |
103 |
68 iListbox->ConstructL(this, aListboxFlags); |
|
69 iListbox->SetMopParent( this ); |
|
70 iListbox->SetContainerWindowL(*this); |
|
71 iListbox->CreateScrollBarFrameL(ETrue); |
|
72 iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
73 |
|
74 iListbox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue ); |
|
75 |
|
76 iListbox->SetSize(aRect.Size()); |
|
77 iListbox->MakeVisible(ETrue); |
|
78 MakeVisible(EFalse); |
|
79 |
|
80 // Activate the window, which makes it ready to be drawn |
104 // Activate the window, which makes it ready to be drawn |
81 ActivateL(); |
105 ActivateL(); |
|
106 DP("CPodcastListContainer::ConstructL END"); |
82 } |
107 } |
83 |
108 |
84 TInt CPodcastListContainer::CountComponentControls() const |
109 TInt CPodcastListContainer::CountComponentControls() const |
85 { |
110 { |
86 return 1; // return number of controls inside this container |
111 return 1; // return number of controls inside this container |
110 void CPodcastListContainer::ScrollToVisible() { |
138 void CPodcastListContainer::ScrollToVisible() { |
111 if (iListbox != NULL) { |
139 if (iListbox != NULL) { |
112 iListbox->ScrollToMakeItemVisible(iListbox->CurrentItemIndex()); |
140 iListbox->ScrollToMakeItemVisible(iListbox->CurrentItemIndex()); |
113 } |
141 } |
114 } |
142 } |
|
143 |
115 void CPodcastListContainer::SizeChanged() |
144 void CPodcastListContainer::SizeChanged() |
116 { |
145 { |
117 DP2("CPodcastListContainer::SizeChanged(), width=%d, height=%d",Size().iWidth, Size().iHeight); |
146 DP2("CPodcastListContainer::SizeChanged() BEGIN, width=%d, height=%d",Size().iWidth, Size().iHeight); |
118 if(iListbox != NULL) |
147 |
119 { |
148 iLandscape = Size().iWidth > Size().iHeight; |
120 iListbox->SetSize(Size()); |
149 |
121 } |
150 if (iContainerListener) |
122 } |
151 iContainerListener->SizeChanged(); |
123 |
152 |
124 CEikFormattedCellListBox* CPodcastListContainer::Listbox() |
153 if (iLandscape) |
|
154 { |
|
155 iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
156 iListboxPortrait->UpdateScrollBarsL(); |
|
157 iListboxPortrait->MakeVisible(EFalse); |
|
158 |
|
159 iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
160 iListboxLandscape->MakeVisible(ETrue); |
|
161 iListboxLandscape->SetFocus(ETrue, EDrawNow); |
|
162 iListbox = iListboxLandscape; |
|
163 } |
|
164 else |
|
165 { |
|
166 iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
167 iListboxLandscape->UpdateScrollBarsL(); |
|
168 iListboxLandscape->MakeVisible(EFalse); |
|
169 |
|
170 iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
171 iListboxPortrait->MakeVisible(ETrue); |
|
172 iListboxPortrait->SetFocus(ETrue, EDrawNow); |
|
173 iListbox = (CEikColumnListBox*) iListboxPortrait; |
|
174 } |
|
175 |
|
176 iListbox->SetSize(Size()); |
|
177 ActivateL(); |
|
178 DrawNow(); |
|
179 DP("CPodcastListContainer::SizeChanged END"); |
|
180 } |
|
181 |
|
182 CEikColumnListBox* CPodcastListContainer::Listbox() |
125 { |
183 { |
126 return iListbox; |
184 return iListbox; |
127 } |
185 } |
128 |
186 |
|
187 void CPodcastListContainer::SetListboxObserver(MEikListBoxObserver *aObserver) |
|
188 { |
|
189 iListboxLandscape->SetListBoxObserver(aObserver); |
|
190 iListboxPortrait->SetListBoxObserver(aObserver); |
|
191 } |
|
192 |
|
193 void CPodcastListContainer::SetListboxIcons(CArrayPtr< CGulIcon >* aIcons) |
|
194 { |
|
195 iListboxLandscape->ItemDrawer()->ColumnData()->SetIconArray(aIcons); |
|
196 iListboxPortrait->ItemDrawer()->FormattedCellData()->SetIconArrayL(aIcons); |
|
197 } |
|
198 |
|
199 CArrayPtr<CGulIcon>* CPodcastListContainer::ListboxIcons() |
|
200 { |
|
201 if (iListboxLandscape == iListbox) |
|
202 return iListboxLandscape->ItemDrawer()->ColumnData()->IconArray(); |
|
203 else |
|
204 return iListboxPortrait->ItemDrawer()->FormattedCellData()->IconArray(); |
|
205 } |
|
206 |
|
207 void CPodcastListContainer::SetListboxTextArrays(CDesCArray* aPortraitArray, CDesCArray* aLandscapeArray) |
|
208 { |
|
209 iListboxLandscape->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
210 iListboxLandscape->Model()->SetItemTextArray(aLandscapeArray); |
|
211 iListboxPortrait->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
212 iListboxPortrait->Model()->SetItemTextArray(aPortraitArray); |
|
213 } |
129 |
214 |
130 CPodcastListContainer::~CPodcastListContainer() |
215 CPodcastListContainer::~CPodcastListContainer() |
131 { |
216 { |
132 delete iListbox; |
217 delete iListbox; |
133 delete iBgContext; |
218 delete iBgContext; |
134 } |
219 } |
135 |
220 |
|
221 void CPodcastListContainer::SetEmptyText(const TDesC &aText) |
|
222 { |
|
223 iListboxPortrait->View()->SetListEmptyTextL(aText); |
|
224 iListboxLandscape->View()->SetListEmptyTextL(aText); |
|
225 } |
136 |
226 |
137 void CPodcastListContainer::Draw(const TRect& aRect) const |
227 void CPodcastListContainer::Draw(const TRect& aRect) const |
138 { |
228 { |
139 CWindowGc& gc = SystemGc(); |
229 CWindowGc& gc = SystemGc(); |
140 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
230 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
158 } |
248 } |
159 |
249 |
160 void CPodcastListView::ConstructL() |
250 void CPodcastListView::ConstructL() |
161 { |
251 { |
162 DP("CPodcastListView::ConstructL BEGIN"); |
252 DP("CPodcastListView::ConstructL BEGIN"); |
|
253 |
163 iListContainer = new (ELeave) CPodcastListContainer; |
254 iListContainer = new (ELeave) CPodcastListContainer; |
164 iListContainer->ConstructL(ClientRect(), iListboxFlags); |
255 TRect rect = ClientRect(); |
|
256 |
|
257 iListContainer->ConstructL(rect, iListboxFlags); |
165 iListContainer->SetMopParent(this); |
258 iListContainer->SetMopParent(this); |
166 iListContainer->ActivateL(); |
259 iListContainer->ActivateL(); |
|
260 |
167 iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran); |
261 iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran); |
168 iListContainer->Listbox()->Model()->SetItemTextArray(iItemArray); |
262 iItemArrayShort = new (ELeave)CDesCArrayFlat(KDefaultGran); |
169 iListContainer->Listbox()->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
263 |
170 |
264 iListContainer->SetListboxTextArrays(iItemArray, iItemArrayShort); |
|
265 iListContainer->SetContainerListener(this); |
|
266 iListContainer->SetListboxObserver(this); |
|
267 |
171 if (Toolbar()) { |
268 if (Toolbar()) { |
172 iToolbar = Toolbar(); |
269 iToolbar = Toolbar(); |
173 iToolbar->SetToolbarObserver(this); |
270 iToolbar->SetToolbarObserver(this); |
174 } |
271 } |
175 |
272 |
176 iListContainer->SetKeyEventListener(this); |
|
177 |
273 |
178 DP("CPodcastListView::ConstructL END"); |
274 DP("CPodcastListView::ConstructL END"); |
179 } |
275 } |
180 |
276 |
181 void CPodcastListView::HandleViewRectChange() |
277 void CPodcastListView::HandleViewRectChange() |
182 { |
278 { |
183 if ( iListContainer ) |
279 TBool wasVisible = iListContainer->IsVisible(); |
|
280 |
|
281 if ( iListContainer ) |
184 { |
282 { |
185 iListContainer->SetRect( ClientRect() ); |
283 iListContainer->SetRect( ClientRect() ); |
186 } |
284 } |
187 } |
285 } |
188 |
286 |
189 void CPodcastListView::HandleStatusPaneSizeChange() |
287 void CPodcastListView::HandleStatusPaneSizeChange() |
190 { |
288 { |
191 DP2("CPodcastListView::HandleStatusPaneSizeChange(), width=%d, height=%d", ClientRect().Width(), ClientRect().Height()); |
289 DP2("CPodcastListView::HandleStatusPaneSizeChange(), width=%d, height=%d", ClientRect().Width(), ClientRect().Height()); |
192 |
290 |
193 if ( iListContainer ) |
291 HandleViewRectChange(); |
194 { |
|
195 iListContainer->SetRect( ClientRect() ); |
|
196 } |
|
197 |
|
198 } |
292 } |
199 |
293 |
200 |
294 |
201 CPodcastListView::~CPodcastListView() |
295 CPodcastListView::~CPodcastListView() |
202 { |
296 { |