84 HandleSizeChanged(aDef, aLayout_1, &windowOwning); |
107 HandleSizeChanged(aDef, aLayout_1, &windowOwning); |
85 } |
108 } |
86 |
109 |
87 |
110 |
88 EXPORT_C |
111 EXPORT_C |
89 void AknPopupLayouts::HandleSizeChanged( TAknPopupWindowLayoutDef& aDef, |
112 void AknPopupLayouts::HandleSizeChanged( TAknPopupWindowLayoutDef &aDef, |
90 TAknPopupLayouts aLayout_1, |
113 TAknPopupLayouts aLayout_1, |
91 TAknPopupLayoutsNode* aNode ) |
114 TAknPopupLayoutsNode *aNode) |
92 { |
115 { |
93 CAknPopupHeadingPane* heading = |
116 CAknPopupHeadingPane *aHeading = (CAknPopupHeadingPane*)FindControl(aNode, EHeadingNode); |
94 static_cast<CAknPopupHeadingPane*>( |
117 CEikListBox *aListBox = (CEikListBox*)FindControl(aNode, EListNode); |
95 FindControl( aNode, EHeadingNode ) ); |
118 CCoeControl *aWindowOwningControl = FindControl(aNode, EWindowOwningNode); |
96 |
119 CAknMessageQueryControl *aMsgQueryCtrl = (CAknMessageQueryControl*)FindControl(aNode, EMessageBoxNode); |
97 CEikListBox* listBox = |
120 |
98 static_cast<CEikListBox*>( FindControl( aNode, EListNode ) ); |
121 TInt aLayout = aLayout_1; |
99 |
122 TInt numofitems = aListBox->Model()->NumberOfItems(); |
100 CCoeControl* windowOwningControl = FindControl( aNode, EWindowOwningNode ); |
123 |
101 |
124 aListBox->View()->ItemDrawer()->SetSkinEnabledL(ETrue); |
102 CAknMessageQueryControl* msgQueryCtrl = |
125 |
103 static_cast<CAknMessageQueryControl*>( |
126 TInt maxListHeight = GetMaxListHeight(); |
104 FindControl( aNode, EMessageBoxNode ) ); |
127 |
105 |
128 // position popup window's bottom correctly |
106 TInt layoutFlags = aLayout_1; |
|
107 TInt numofitems = listBox->Model()->NumberOfItems(); |
|
108 |
|
109 // Position popup window's bottom correctly. |
|
110 TRect clientRect; |
129 TRect clientRect; |
111 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent, |
130 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EPopupParent, clientRect); |
112 clientRect ); |
131 // set windowrect to minimum size - this will be adjusted later |
113 |
132 TAknLayoutRect windowRect; |
114 TInt maxListHeight = GetMaxListHeight( clientRect ); |
133 windowRect.LayoutRect( clientRect, AknLayoutScalable_Avkon::popup_menu_window(8)); |
115 |
134 aDef.iWindowRect = windowRect.Rect(); |
116 TRect nullRect( 0, 0, 0, 0 ); |
135 TRAP_IGNORE( aListBox->View()->ItemDrawer()->SetSkinEnabledL(ETrue) ); |
117 |
136 |
118 TBool isLandscape = Layout_Meta_Data::IsLandscapeOrientation(); |
137 // Popup window when the size does not change based on |
119 |
138 // the number of items. |
120 // Set windowRect to minimum size - this will be adjusted later. |
|
121 TAknLayoutRect windowRectLayout; |
|
122 windowRectLayout.LayoutRect( |
|
123 clientRect, |
|
124 AknLayoutScalable_Avkon::popup_menu_window( isLandscape ? 19 : 8 ) ); |
|
125 aDef.iWindowRect = windowRectLayout.Rect(); |
|
126 |
|
127 TRAP_IGNORE( listBox->View()->ItemDrawer()->SetSkinEnabledL( ETrue ) ); |
|
128 |
|
129 // Popup window when the size does not change based on the number of items. |
|
130 TBool fixedWindowSize = EFalse; |
139 TBool fixedWindowSize = EFalse; |
131 if ( layoutFlags & EAknPopupLayoutsDynamic || |
140 if ( (aLayout & EAknPopupLayoutsDynamic) || numofitems == 0 || |
132 numofitems == 0 || |
141 (aLayout & EAknPopupLayoutsFind) ) |
133 layoutFlags & EAknPopupLayoutsFind ) |
142 { |
134 { |
143 aLayout &= ~EAknPopupLayoutsDynamic; |
135 layoutFlags &= ~EAknPopupLayoutsDynamic; |
|
136 fixedWindowSize = ETrue; |
144 fixedWindowSize = ETrue; |
137 } |
145 } |
138 |
146 |
139 // heading ============================================================= |
147 // heading ============================================================= |
140 TInt spaceForHeading = 0; |
148 TInt spaceForHeading = 0; |
141 if ( heading ) |
149 if (aHeading) |
142 { |
150 { |
143 heading->SetLayout( CAknPopupHeadingPane::EListHeadingPane ); |
151 aHeading->SetLayout( CAknPopupHeadingPane::EListHeadingPane ); |
144 TAknLayoutRect tempHeadingRect; |
152 TAknLayoutRect tempHeadingRect; |
145 tempHeadingRect.LayoutRect( |
153 tempHeadingRect.LayoutRect(clientRect, |
146 clientRect, |
154 AknLayoutScalable_Avkon::heading_pane(0)); |
147 AknLayoutScalable_Avkon::heading_pane( 0 ) ); |
|
148 spaceForHeading = tempHeadingRect.Rect().Height(); |
155 spaceForHeading = tempHeadingRect.Rect().Height(); |
149 maxListHeight -= spaceForHeading; |
156 maxListHeight -= spaceForHeading; |
150 } |
157 } |
151 aDef.iPopupMenuWindowOffset.SetXY( 0, spaceForHeading ); |
158 aDef.iPopupMenuWindowOffset=TPoint(0,spaceForHeading); |
152 |
159 |
153 |
160 |
154 // findbox ============================================================= |
161 // findbox ============================================================= |
155 TBool windowSizeFind = EFalse; |
162 TBool windowSizeFind = EFalse; |
156 TInt spaceForFind = 0; |
163 TInt spaceForFind = 0; |
157 if ( layoutFlags & EAknPopupLayoutsFind ) |
164 if (aLayout & EAknPopupLayoutsFind) |
158 { |
165 { |
159 layoutFlags &= ~EAknPopupLayoutsFind; |
166 aLayout &= ~EAknPopupLayoutsFind; |
160 windowSizeFind = ETrue; |
167 windowSizeFind = ETrue; |
161 // Calculate space needed for find box. |
168 // calculate space needed for find |
162 TAknLayoutRect tempFindRect; |
169 TAknLayoutRect tempFindRect; |
163 tempFindRect.LayoutRect( |
170 tempFindRect.LayoutRect(clientRect,AknLayoutScalable_Avkon::find_popup_pane_cp2(0)); |
164 clientRect, |
|
165 AknLayoutScalable_Avkon::find_popup_pane_cp2( 0 ) ); |
|
166 spaceForFind = tempFindRect.Rect().Height(); |
171 spaceForFind = tempFindRect.Rect().Height(); |
167 maxListHeight -= spaceForFind; |
172 maxListHeight -= spaceForFind; |
168 } |
173 } |
169 |
174 |
170 // messagebox ========================================================== |
175 // messagebox ========================================================== |
171 TRect messageRect; |
176 TRect messageRect; |
172 TInt messageNumOfLines = 0; |
177 TInt messageNumOfLines = 0; |
173 TInt messageBoxItemVariety = 0; |
|
174 TBool messageBox = EFalse; |
178 TBool messageBox = EFalse; |
175 TAknWindowComponentLayout messageBoxItemLayout; |
179 if (aMsgQueryCtrl && aMsgQueryCtrl->Lines() > 0) |
176 if ( msgQueryCtrl && msgQueryCtrl->Lines() > 0 ) |
|
177 { |
180 { |
178 messageBox = ETrue; |
181 messageBox = ETrue; |
179 messageNumOfLines = msgQueryCtrl->Lines(); |
182 messageNumOfLines = aMsgQueryCtrl->Lines(); |
180 |
183 TInt varietyIndex = 0; |
181 switch ( messageNumOfLines ) |
184 switch(messageNumOfLines) |
182 { |
185 { |
183 case 0: |
186 case (0): |
184 case 1: |
187 case (1): varietyIndex = 0; |
185 { |
188 break; |
186 messageBoxItemVariety = 0; |
189 case (2): varietyIndex = 1; |
187 break; |
190 break; |
188 } |
191 default : varietyIndex = 2; |
189 case 2: |
|
190 { |
|
191 messageBoxItemVariety = 1; |
|
192 break; |
|
193 } |
|
194 default: |
|
195 { |
|
196 messageBoxItemVariety = 2; |
|
197 break; |
|
198 } |
|
199 } |
192 } |
200 |
193 TAknWindowLineLayout lay = AknLayoutScalable_Apps::loc_type_pane(varietyIndex).LayoutLine(); |
201 messageBoxItemLayout = |
194 TAknLayoutRect layout; |
202 AknLayoutScalable_Apps::loc_type_pane( messageBoxItemVariety ); |
195 layout.LayoutRect( TRect(0,0,0,0), lay ); |
203 |
196 messageRect = layout.Rect(); |
204 TAknLayoutRect layoutRect; |
|
205 layoutRect.LayoutRect( nullRect, messageBoxItemLayout ); |
|
206 messageRect = layoutRect.Rect(); |
|
207 maxListHeight -= messageRect.Height(); |
197 maxListHeight -= messageRect.Height(); |
208 } |
198 } |
209 |
199 |
210 TInt minItems = 1; |
200 TInt minItems = 1; |
211 |
201 |
212 TRect scrollBarRect( nullRect ); |
202 TRect scrollBarRect(0,0,0,0); |
213 |
203 |
214 TAknWindowLineLayout listLayout; |
204 TAknWindowLineLayout listLayout; |
215 TAknLayoutScalableParameterLimits listLimits; |
205 TAknLayoutScalableParameterLimits listLimits; |
216 |
206 |
217 switch ( layoutFlags ) |
207 switch(aLayout) |
218 { |
208 { |
219 case EPopupSNotePopupWindow: |
209 case EPopupSNotePopupWindow: |
220 case EMenuUnknownColumnWindow: |
210 case EMenuUnknownColumnWindow: |
221 case EMenuUnknownFormattedCellWindow: |
211 case EMenuUnknownFormattedCellWindow: |
222 case EMenuWindow: |
212 case EMenuWindow: |
223 { |
213 { |
224 minItems = heading ? 5 : 6; |
214 minItems = aHeading ? 5 : 6; |
225 listLayout = AknLayoutScalable_Avkon::list_single_pane_cp2( 0 ); |
215 listLayout = AknLayoutScalable_Avkon::list_single_pane_cp2(0); |
226 listLimits = AknLayoutScalable_Avkon::list_single_pane_cp2_ParamLimits(); |
216 listLimits = AknLayoutScalable_Avkon::list_single_pane_cp2_ParamLimits(); |
227 break; |
217 break; |
228 } |
218 } |
229 case EMenuGraphicWindow: |
219 case EMenuGraphicWindow: |
230 { |
220 { |
231 minItems = 5; |
221 minItems = 5; |
232 listLayout = AknLayoutScalable_Avkon::list_single_graphic_pane_cp2( 0 ); |
222 listLayout = AknLayoutScalable_Avkon::list_single_graphic_pane_cp2(0); |
233 listLimits = AknLayoutScalable_Avkon::list_single_graphic_pane_cp2_ParamLimits(); |
223 listLimits = AknLayoutScalable_Avkon::list_single_graphic_pane_cp2_ParamLimits(); |
234 break; |
224 break; |
235 } |
225 } |
236 case EMenuGraphicHeadingWindow: |
226 case EMenuGraphicHeadingWindow: |
237 { |
227 { |
238 minItems = 5; |
228 minItems = 5; |
239 listLayout = AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2( 0 ); |
229 listLayout = AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2(0); |
240 listLimits = AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2_ParamLimits(); |
230 listLimits = AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2_ParamLimits(); |
241 break; |
231 break; |
242 } |
232 } |
243 case EMenuDoubleWindow: |
233 case EMenuDoubleWindow: |
244 { |
234 { |
245 minItems = 3; |
235 minItems = 3; |
246 listLayout = AknLayoutScalable_Avkon::list_double_pane_cp2( 0 ); |
236 listLayout = AknLayoutScalable_Avkon::list_double_pane_cp2(0); |
247 listLimits = AknLayoutScalable_Avkon::list_double_pane_cp2_ParamLimits(); |
237 listLimits = AknLayoutScalable_Avkon::list_double_pane_cp2_ParamLimits(); |
248 break; |
238 break; |
249 } |
239 } |
250 case EMenuDoubleLargeGraphicWindow: |
240 case EMenuDoubleLargeGraphicWindow: |
251 { |
241 { |
252 minItems = 3; |
242 minItems = 3; |
253 listLayout = AknLayoutScalable_Avkon::list_double_large_graphic_pane_cp2( 0 ); |
243 listLayout = AknLayoutScalable_Avkon::list_double_large_graphic_pane_cp2(0); |
254 listLimits = AknLayoutScalable_Avkon::list_double_large_graphic_pane_cp2_ParamLimits(); |
244 listLimits = AknLayoutScalable_Avkon::list_double_large_graphic_pane_cp2_ParamLimits(); |
255 break; |
245 break; |
256 } |
246 } |
257 default: |
247 } |
258 { |
248 |
259 break; |
249 if (!fixedWindowSize) |
260 } |
|
261 } |
|
262 |
|
263 if ( !fixedWindowSize ) |
|
264 { |
250 { |
265 minItems = 1; |
251 minItems = 1; |
266 } |
252 } |
267 |
253 |
268 // Last row is a zero based index, we need num items which is 1 based. |
254 TInt maxLayoutItems = listLimits.LastRow() + 1; // last row is a zero based index, we need num items which is 1 based |
269 TInt maxLayoutItems = listLimits.LastRow() + 1; |
255 |
|
256 //aDef.iVertLineExt1.LayoutRect(TRect(1,1,1,1), 0, 0,0, ELayoutEmpty, ELayoutEmpty, 0,0); |
|
257 //aDef.iVertLineExt2.LayoutRect(TRect(1,1,1,1), 0, 0,0, ELayoutEmpty, ELayoutEmpty, 0,0); |
270 |
258 |
271 TAknLayoutRect listItemRect; |
259 TAknLayoutRect listItemRect; |
272 listItemRect.LayoutRect( aDef.iWindowRect, listLayout ); |
260 listItemRect.LayoutRect( aDef.iWindowRect, listLayout); |
273 TInt listItemHeight = listItemRect.Rect().Height(); |
261 TInt listItemHeight = listItemRect.Rect().Height(); |
274 TInt maxItems = maxListHeight / listItemHeight; |
262 TInt maxItems = maxListHeight / listItemHeight; |
275 |
|
276 // minItems == 1 only if the popuplist is dynamically changeable |
263 // minItems == 1 only if the popuplist is dynamically changeable |
277 if ( ( numofitems > 1 ) && ( minItems == 1 ) ) |
264 if ( (numofitems > 1) && (minItems == 1) ) |
278 { |
265 { |
279 minItems = numofitems; |
266 minItems = numofitems; |
280 } |
267 } |
281 |
268 if (minItems > maxItems) |
282 if ( minItems > maxItems ) |
|
283 { |
269 { |
284 minItems = maxItems; |
270 minItems = maxItems; |
285 } |
271 } |
286 |
272 // maxItems might be greater than max items from layout -> use layout's maximum |
287 // maxItems might be greater than max items from layout -> |
273 if (minItems > maxLayoutItems) |
288 // use layout's maximum. |
|
289 if ( minItems > maxLayoutItems ) |
|
290 { |
274 { |
291 minItems = maxLayoutItems; |
275 minItems = maxLayoutItems; |
292 } |
276 } |
293 |
277 |
294 TRect windowRect( AknPopupLayouts::MenuRect( aDef ) ); |
278 TRect window_rect = AknPopupLayouts::MenuRect(aDef); |
295 |
279 |
296 TAknLayoutRect temp; |
280 TAknLayoutRect temp, layout; |
297 TAknLayoutRect layout; |
|
298 TRect screenRect; |
281 TRect screenRect; |
299 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
282 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
300 TAknWindowLineLayout lineLayout( |
283 TAknWindowLineLayout lineLayout = AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine(); |
301 AknLayoutScalable_Avkon::listscroll_menu_pane( 0 ).LayoutLine() ); |
|
302 |
284 |
303 temp.LayoutRect( windowRect, lineLayout ); |
285 // Layout data of listscroll_menu_pane are changed for CR 417-35260. |
304 |
286 // The change is just for QHD landscape model. |
305 layout.LayoutRect( temp.Rect(), |
287 // The CR makes listscroll_menu_pane's ir or il bigger than normal, |
306 AknLayoutScalable_Avkon::list_menu_pane( 0 ) ); |
288 // so that width of list item is smaller than needs. Then, first cell |
307 |
289 // of list item can not be drawn on proper position. |
308 // This is list's rect for the whole window. |
290 // Adjustment of layout is a solution for this problem. This is not a perfect idea, but |
309 TRect tempListRect( layout.Rect() ); |
291 // creating a new layout for popuplist is too complex to do that. Adjustment is a must. |
310 |
292 if(Layout_Meta_Data::IsLandscapeOrientation()) |
311 // Subtract heading, find box and message box from tempListRect. |
293 { |
|
294 TInt offset = AknListBoxLayouts::AdjustPopupLayoutData( screenRect ); |
|
295 if (!AknLayoutUtils::LayoutMirrored()) |
|
296 { |
|
297 lineLayout.ir -= offset; |
|
298 } |
|
299 else |
|
300 { |
|
301 lineLayout.il -= offset; |
|
302 } |
|
303 } |
|
304 temp.LayoutRect( window_rect, lineLayout); |
|
305 |
|
306 layout.LayoutRect( temp.Rect(), AknLayoutScalable_Avkon::list_menu_pane(0)); |
|
307 TRect tempListRect = layout.Rect(); // this is list's rect for the whole window |
|
308 |
|
309 // subtract heading, findbox and messagebox from tempListRect |
312 tempListRect.iBr.iY -= spaceForFind; |
310 tempListRect.iBr.iY -= spaceForFind; |
313 tempListRect.iTl.iY += spaceForHeading; |
311 tempListRect.iTl.iY += spaceForHeading; |
314 tempListRect.iTl.iY += messageRect.Height(); |
312 tempListRect.iTl.iY += messageRect.Height(); |
315 |
313 |
316 // We really don't want parent relative list layout here because find box |
314 // We really don't want parent relative list layout here because findbox will be overwritten. |
317 // will be overwritten. Just calculate list height and use that. |
315 // Just calculate list height and use that. |
318 listLayout.iH = (TInt16)( minItems * listItemHeight ); |
316 TRect nullRect(0,0,0,0); |
|
317 listLayout.iH = (TInt16)(minItems * listItemHeight); |
319 listLayout.ib = ELayoutEmpty; |
318 listLayout.ib = ELayoutEmpty; |
320 |
319 |
321 aDef.iListRect.LayoutRect( tempListRect, listLayout ); |
320 aDef.iListRect.LayoutRect(tempListRect, |
322 |
321 listLayout); |
323 // We have to scale iWindowRect to list rect - layout is not (yet) correct. |
322 |
|
323 // we have to scale iWindowRect to list rect - layout is not (yet) correct |
324 TInt usedHeight = aDef.iListRect.Rect().Height() |
324 TInt usedHeight = aDef.iListRect.Rect().Height() |
325 + spaceForFind |
325 + spaceForFind |
326 + spaceForHeading |
326 + spaceForHeading |
327 + messageRect.Height(); |
327 + messageRect.Height(); |
328 |
328 |
329 if ( layout.Rect().Height() < usedHeight ) |
329 // popupwindow's inside area |
330 { |
330 TInt varietyIndex = Layout_Meta_Data::IsLandscapeOrientation(); |
331 aDef.iWindowRect.iTl.iY -= (usedHeight - layout.Rect().Height() ); |
331 |
|
332 TAknLayoutRect insideArea; |
|
333 insideArea.LayoutRect( |
|
334 window_rect, |
|
335 AknLayoutScalable_Avkon::bg_popup_window_pane_g1(varietyIndex) ); |
|
336 |
|
337 if (layout.Rect().Height() < usedHeight) |
|
338 { |
|
339 aDef.iWindowRect.iTl.iY -= (usedHeight - layout.Rect().Height()); |
332 } |
340 } |
333 |
341 |
334 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); |
342 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); |
335 |
343 |
336 // In landscape we have to center (on y-axis) popup window |
344 // In landscape we have to center (on y-axis) popup window (but not with bottom CBA) |
337 // (but not with bottom CBA). |
345 if (varietyIndex == 1 && cbaLocation != AknLayoutUtils::EAknCbaLocationBottom) |
338 if ( isLandscape && |
346 { |
339 cbaLocation != AknLayoutUtils::EAknCbaLocationBottom ) |
347 TRect mainPane; |
340 { |
348 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent, mainPane ); |
341 TInt diff = ( clientRect.Height() - aDef.iWindowRect.Height() ) / 2; |
349 TInt diff = (mainPane.Height()-aDef.iWindowRect.Height()) / 2; |
342 aDef.iWindowRect.iTl.iY -= diff; |
350 aDef.iWindowRect.iTl.iY -= diff; |
343 aDef.iWindowRect.iBr.iY -= diff; |
351 aDef.iWindowRect.iBr.iY -= diff; |
344 |
352 |
345 // With right CBA, move window to the right side of the screen. |
353 // with right CBA, move window to the right side of the screen |
346 if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight ) |
354 if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight) |
347 { |
355 { |
348 TInt offset = clientRect.Width() - aDef.iWindowRect.iBr.iX; |
356 TInt offset = mainPane.Width()-aDef.iWindowRect.iBr.iX; |
349 aDef.iWindowRect.iTl.iX += offset; |
357 aDef.iWindowRect.iTl.iX += offset; |
350 aDef.iWindowRect.iBr.iX += offset; |
358 aDef.iWindowRect.iBr.iX += offset; |
351 } |
359 } |
352 } |
360 |
353 |
361 //should this be uncommented?? |
|
362 // If we have left CBA, we move window to left side of screen (on x-axis). |
|
363 /*else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft) |
|
364 { |
|
365 TInt xOffset = aDef.iWindowRect.iTl.iX; |
|
366 if ( xOffset > 0 ) |
|
367 { |
|
368 aDef.iWindowRect.iTl.iX = 0; |
|
369 aDef.iWindowRect.iBr.iX -= xOffset; |
|
370 } |
|
371 }*/ |
|
372 } |
|
373 |
|
374 TRect screen; |
|
375 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
|
376 |
354 TAknLayoutRect cbaRect; |
377 TAknLayoutRect cbaRect; |
355 cbaRect.LayoutRect( |
378 cbaRect.LayoutRect( screen, |
356 screenRect, |
379 AknLayoutScalable_Avkon::popup_sk_window( 0 ).LayoutLine() ); |
357 AknLayoutScalable_Avkon::popup_sk_window( 0 ).LayoutLine() ); |
|
358 |
380 |
359 TSize size( aDef.iWindowRect.Size() ); |
381 if ( AknLayoutUtils::PenEnabled() ) |
360 |
382 { |
361 // Add softkey height. |
383 TSize size( aDef.iWindowRect.Size() ); |
362 size.iHeight += cbaRect.Rect().Height(); |
384 // add softkey height |
363 |
385 size.iHeight += cbaRect.Rect().Height(); |
364 // Reduce listbox's and popup's height if total height is more than |
386 |
365 // screen height. |
387 // Reduce listbox's and popup's height if total height is more than |
366 if ( size.iHeight > screenRect.Height() ) |
388 // screen height. |
367 { |
389 if ( size.iHeight > screen.Height() ) |
368 listLayout.iH -= ( size.iHeight - screenRect.Height() ); |
390 { |
369 aDef.iListRect.LayoutRect( tempListRect, listLayout ); |
391 listLayout.iH -= ( size.iHeight - screen.Height() ); |
370 |
392 aDef.iListRect.LayoutRect( tempListRect, listLayout ); |
371 size.iHeight = screenRect.Height(); |
393 |
372 } |
394 size.iHeight = screen.Height(); |
373 |
395 } |
374 aDef.iWindowRect.SetRect( AknPopupUtils::Position( size, ETrue ), size ); |
396 |
375 |
397 aDef.iWindowRect.SetRect( AknPopupUtils::Position( size, ETrue ), size ); |
376 // Now we finally know the window rect: first setup heading. |
398 } |
377 if ( heading ) |
399 |
378 { |
400 // now we finally know the window rect: first setup heading |
379 aDef.iHeadingRect.LayoutRect( |
401 if (aHeading) |
380 AknPopupLayouts::MenuRect( aDef ), |
402 { |
381 AknLayoutScalable_Avkon::heading_pane( 0 ) ); |
403 aDef.iHeadingRect.LayoutRect(AknPopupLayouts::MenuRect(aDef), |
382 } |
404 AknLayoutScalable_Avkon::heading_pane(0)); |
383 |
405 } |
384 MenuPopupWindowGraphics( aDef ); |
406 |
385 windowOwningControl->SetRect( WindowRect( aDef ) ); |
407 MenuPopupWindowGraphics(aDef); |
386 HandleSizeAndPositionOfComponents( aDef, listBox, heading ); |
408 aWindowOwningControl->SetRect(WindowRect(aDef)); |
387 |
409 HandleSizeAndPositionOfComponents(aDef, aListBox, aHeading); |
388 layout.LayoutRect( MenuRect( aDef ), lineLayout ); |
410 |
389 TRect scrollBarClientRect( layout.Rect() ); |
411 layout.LayoutRect(MenuRect(aDef), lineLayout); |
390 |
412 TRect scrollBarClientRect(layout.Rect()); |
391 // Remove softkey height that was added earlier so that |
413 |
392 // scroll bar doesn't get behind the softkey. |
414 if ( AknLayoutUtils::PenEnabled() ) |
393 scrollBarClientRect.iBr.iY -= cbaRect.Rect().Height(); |
415 { |
394 |
416 // remove softkey height that was added earlier so that |
395 if ( heading ) |
417 // scroll bar doesn't get behind the softkey |
|
418 scrollBarClientRect.iBr.iY -= cbaRect.Rect().Height(); |
|
419 } |
|
420 |
|
421 if (aHeading) |
396 { |
422 { |
397 scrollBarClientRect.iTl.iY += spaceForHeading; |
423 scrollBarClientRect.iTl.iY += spaceForHeading; |
398 } |
424 } |
399 |
425 |
400 if ( windowSizeFind ) |
426 if (windowSizeFind) |
401 { |
427 { |
402 scrollBarClientRect.iBr.iY -= spaceForFind; |
428 scrollBarClientRect.iBr.iY -= spaceForFind; |
403 } |
429 } |
404 |
430 |
405 if ( messageBox ) |
431 if (messageBox) |
406 { |
432 { |
407 scrollBarClientRect.iTl.iY += messageRect.Height(); |
433 scrollBarClientRect.iTl.iY += messageRect.Height(); |
408 } |
434 } |
409 |
435 varietyIndex = 0; |
410 AknLayoutUtils::LayoutVerticalScrollBar( |
436 AknLayoutUtils::LayoutVerticalScrollBar( |
411 listBox->ScrollBarFrame(), |
437 aListBox->ScrollBarFrame(), |
412 scrollBarClientRect, |
438 scrollBarClientRect, |
413 AknLayoutScalable_Avkon::scroll_pane_cp25( 0 ).LayoutLine() ); |
439 AknLayoutScalable_Avkon::scroll_pane_cp25(varietyIndex).LayoutLine() ) ; |
414 |
440 |
415 if ( messageBox ) |
441 if (messageBox) |
416 { |
442 { |
417 TAknLayoutRect msgQuery; |
443 TAknLayoutRect msgQuery; |
418 msgQuery.LayoutRect( AknPopupLayouts::MenuRect( aDef ), |
444 |
419 messageBoxItemLayout ); |
445 TInt varietyIndex = 0; |
420 msgQueryCtrl->SetRect( msgQuery.Rect() ); |
446 switch(messageNumOfLines) |
421 } |
447 { |
422 |
448 case (0): |
423 windowRect = WindowRect( aDef ); |
449 case (1): varietyIndex = 0; |
424 MAknsControlContext* cc = AknsDrawUtils::ControlContext( listBox ); |
450 break; |
|
451 case (2): varietyIndex = 1; |
|
452 break; |
|
453 default : varietyIndex = 2; |
|
454 } |
|
455 msgQuery.LayoutRect( AknPopupLayouts::MenuRect(aDef), |
|
456 AknLayoutScalable_Apps::loc_type_pane(varietyIndex).LayoutLine() ); |
|
457 aMsgQueryCtrl->SetRect(msgQuery.Rect()); |
|
458 } |
|
459 |
|
460 window_rect = WindowRect(aDef); |
|
461 MAknsControlContext *cc = AknsDrawUtils::ControlContext( aListBox ); |
425 TBool defaultContext = EFalse; |
462 TBool defaultContext = EFalse; |
426 if ( !cc ) |
463 if (!cc) |
427 { |
464 { |
428 cc = listBox->View()->ItemDrawer()->SkinBackgroundControlContext(); |
465 cc = aListBox->View()->ItemDrawer()->SkinBackgroundControlContext(); |
429 defaultContext = ETrue; |
466 defaultContext = ETrue; |
430 } |
467 } |
431 if ( cc ) |
468 if (cc) |
432 { |
469 { |
433 CAknsBasicBackgroundControlContext* bcc = |
470 CAknsBasicBackgroundControlContext *bcc = (CAknsBasicBackgroundControlContext*)cc; |
434 static_cast<CAknsBasicBackgroundControlContext*>( cc ); |
471 TAknLayoutRect popupBgRect; |
435 bcc->SetBitmap( KAknsIIDQsnFrPopupCenter ); |
472 popupBgRect.LayoutRect(window_rect, |
436 |
473 SkinLayout::Popup_windows_skin_placing__background_slice__Line_1(window_rect)); |
437 if ( defaultContext ) |
474 bcc->SetBitmap(KAknsIIDQsnFrPopupCenter); |
438 { |
475 if (defaultContext) bcc->SetRect(popupBgRect.Rect()); |
439 bcc->SetRect( windowRect ); |
476 bcc->SetParentPos(aWindowOwningControl->PositionRelativeToScreen()); |
440 bcc->SetParentPos( TPoint( 0, 0 ) ); |
477 if (defaultContext) |
441 } |
478 bcc->SetParentPos(TPoint(0,0)); |
442 else |
479 } |
443 { |
480 // handled in CFormattedCellListBoxDataExtension, since listbox does not always cover whole |
444 bcc->SetParentPos( windowOwningControl->PositionRelativeToScreen() ); |
481 // window rect (listquery/popup list), especially when items are added after construction |
445 } |
482 /* |
446 } |
483 // note, that cleanup is done in ~CFormattedCellListBoxData() |
447 } |
484 // or ( shudder ) in ~CColumnListBoxData() |
448 |
485 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
486 if( feedback ) |
|
487 { |
|
488 feedback->SetFeedbackArea( aListBox, 0, aListBox->Rect(), |
|
489 ETouchFeedbackBasic, ETouchEventStylusDown ); |
|
490 } |
|
491 */ |
|
492 } |
449 |
493 |
450 EXPORT_C void AknPopupLayouts::HandleSizeAndPositionOfComponents(const TAknPopupWindowLayoutDef &aDef, |
494 EXPORT_C void AknPopupLayouts::HandleSizeAndPositionOfComponents(const TAknPopupWindowLayoutDef &aDef, |
451 CCoeControl *aContent, |
495 CCoeControl *aContent, |
452 CAknPopupHeadingPane *aHeading) |
496 CAknPopupHeadingPane *aHeading) |
453 { |
497 { |
467 { |
511 { |
468 if (aValue > aMax) aValue = aMax; |
512 if (aValue > aMax) aValue = aMax; |
469 if (aValue < aMin) aValue = aMin; |
513 if (aValue < aMin) aValue = aMin; |
470 } |
514 } |
471 |
515 |
472 |
|
473 // Disable "unreferenced formal parameter" for when aEikEnv is not used in the AKN_LAF_COLOR_ENV macro. |
516 // Disable "unreferenced formal parameter" for when aEikEnv is not used in the AKN_LAF_COLOR_ENV macro. |
474 #pragma warning(disable : 4100) |
517 #pragma warning(disable : 4100) |
475 EXPORT_C void AknPopupLayouts::HandleDraw( CEikonEnv* /*aEikEnv*/, |
518 EXPORT_C void AknPopupLayouts::HandleDraw(CEikonEnv* /*aEikEnv*/, |
476 CWindowGc& aGc, |
519 CWindowGc &aGc, |
477 const TAknPopupWindowLayoutDef& aDef, |
520 const TAknPopupWindowLayoutDef &aDef, |
478 CEikListBox* aListBox, |
521 CEikListBox* aListBox, |
479 CAknPopupHeadingPane* aHeading ) |
522 CAknPopupHeadingPane* aHeading) |
480 { |
523 { |
481 TRect windowRect( |
524 TRect windowRect = MenuRect(const_cast<TAknPopupWindowLayoutDef&>(aDef)); |
482 MenuRect( const_cast<TAknPopupWindowLayoutDef&>( aDef ) ) ); |
525 MAknsSkinInstance *skin = AknsUtils::SkinInstance(); |
483 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
526 MAknsControlContext *cc = AknsDrawUtils::ControlContext( aListBox ); |
484 MAknsControlContext* cc = AknsDrawUtils::ControlContext( aListBox ); |
|
485 TBool windowFrameDrawn = EFalse; |
527 TBool windowFrameDrawn = EFalse; |
486 |
528 if (!cc) cc = aListBox->View()->ItemDrawer()->SkinBackgroundControlContext(); |
487 if ( !cc ) |
|
488 { |
|
489 cc = aListBox->View()->ItemDrawer()->SkinBackgroundControlContext(); |
|
490 } |
|
491 |
529 |
492 TRegionFix<5> dontDrawRegion; |
530 TRegionFix<5> dontDrawRegion; |
493 TRegionFix<22> drawRegion; |
531 TRegionFix<22> drawRegion; |
494 if ( aListBox ) |
532 if ( aListBox ) |
495 { |
533 { |
496 dontDrawRegion.AddRect( aListBox->Rect() ); |
534 dontDrawRegion.AddRect( aListBox->Rect() ); |
497 |
535 |
498 // If there are scroll bars and they draw their own background, take |
536 // If there are scroll bars and they draw their own background, take |
499 // them out of clipping region |
537 // them out of clipping region |
500 CEikScrollBarFrame* scrollBarFrame = aListBox->ScrollBarFrame(); |
538 CEikScrollBarFrame* scrollBarFrame = aListBox->ScrollBarFrame(); |
501 if ( scrollBarFrame ) |
539 if (scrollBarFrame) |
502 { |
540 { |
503 CEikScrollBar* hBar = scrollBarFrame->GetScrollBarHandle( |
541 CEikScrollBar* hBar = scrollBarFrame->GetScrollBarHandle( |
504 CEikScrollBar::EHorizontal ); |
542 CEikScrollBar::EHorizontal); |
505 CEikScrollBar* vBar = scrollBarFrame->GetScrollBarHandle( |
543 CEikScrollBar* vBar = scrollBarFrame->GetScrollBarHandle( |
506 CEikScrollBar::EVertical ); |
544 CEikScrollBar::EVertical); |
507 TBool drawHorizontal = ETrue; |
545 TBool drawHorizontal = ETrue; |
508 TBool drawVertical = ETrue; |
546 TBool drawVertical = ETrue; |
509 scrollBarFrame->DrawBackgroundState( drawHorizontal, drawVertical ); |
547 scrollBarFrame->DrawBackgroundState(drawHorizontal, drawVertical); |
510 drawHorizontal = drawHorizontal && hBar && hBar->IsVisible(); |
548 drawHorizontal = drawHorizontal && hBar && hBar->IsVisible(); |
511 drawVertical = drawVertical && vBar && vBar->IsVisible(); |
549 drawVertical = drawVertical && vBar && vBar->IsVisible(); |
512 |
550 if (drawHorizontal) |
513 if ( drawHorizontal ) |
|
514 { |
551 { |
515 TRect scrollBarRect( hBar->Rect() ); |
552 TRect scrollBarRect(hBar->Rect()); |
516 if ( hBar->OwnsWindow() ) |
553 if (hBar->OwnsWindow()) |
517 { |
554 { |
518 TPoint windowPos( aDef.iWindowRect.iTl ); |
555 TPoint windowPos = aDef.iWindowRect.iTl; |
519 TPoint scrollBarPos( hBar->PositionRelativeToScreen() ); |
556 TPoint scrollBarPos = hBar->PositionRelativeToScreen(); |
520 scrollBarRect.Move( scrollBarPos - windowPos ); |
557 scrollBarRect.Move(scrollBarPos - windowPos); |
521 } |
558 } |
522 dontDrawRegion.AddRect( scrollBarRect ); |
559 dontDrawRegion.AddRect(scrollBarRect); |
523 } |
560 } |
524 |
561 if (drawVertical) |
525 if ( drawVertical ) |
|
526 { |
562 { |
527 TRect scrollBarRect( vBar->Rect() ); |
563 TRect scrollBarRect(vBar->Rect()); |
528 if ( vBar->OwnsWindow() ) |
564 if (vBar->OwnsWindow()) |
529 { |
565 { |
530 TPoint windowPos( aDef.iWindowRect.iTl ); |
566 TPoint windowPos = aDef.iWindowRect.iTl; |
531 TPoint scrollBarPos( vBar->PositionRelativeToScreen() ); |
567 TPoint scrollBarPos = vBar->PositionRelativeToScreen(); |
532 scrollBarRect.Move( scrollBarPos - windowPos ); |
568 scrollBarRect.Move(scrollBarPos - windowPos); |
533 } |
569 } |
534 |
570 dontDrawRegion.AddRect(scrollBarRect); |
535 dontDrawRegion.AddRect( scrollBarRect ); |
|
536 } |
571 } |
537 } |
572 } |
538 } |
573 } |
539 |
|
540 if ( aHeading ) |
574 if ( aHeading ) |
541 { |
575 { |
542 dontDrawRegion.AddRect( aHeading->Rect() ); |
576 dontDrawRegion.AddRect( aHeading->Rect() ); |
543 } |
577 } |
544 |
|
545 drawRegion.AddRect( windowRect ); |
578 drawRegion.AddRect( windowRect ); |
546 drawRegion.SubRegion( dontDrawRegion ); |
579 drawRegion.SubRegion( dontDrawRegion ); |
547 |
580 if (cc) |
548 if ( cc ) |
581 { |
549 { |
582 const TAknsItemID *popupBgId = &KAknsIIDQsnBgPopupBackground; |
550 const TAknsItemID* popupBgId = &KAknsIIDQsnBgPopupBackground; |
583 TAknLayoutRect popupBgRect; |
551 AknsDrawUtils::DrawCachedImage( skin, aGc, windowRect, *popupBgId ); |
584 popupBgRect.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__background_slice__Line_1(windowRect)); |
552 |
585 AknsDrawUtils::DrawCachedImage(skin, aGc, popupBgRect.Rect(), *popupBgId); |
553 const TAknsItemID* sliceId = &KAknsIIDQsnBgSlicePopup; |
586 |
|
587 const TAknsItemID *sliceId = &KAknsIIDQsnBgSlicePopup; |
554 TAknLayoutRect sliceRect; |
588 TAknLayoutRect sliceRect; |
555 sliceRect.LayoutRect( windowRect, |
589 sliceRect.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__background_slice__Line_2()); |
556 AknLayoutScalable_Avkon::bg_list_pane_g5( 0 ) ); |
590 AknsDrawUtils::DrawCachedImage(skin, aGc, sliceRect.Rect(), *sliceId); |
557 AknsDrawUtils::DrawCachedImage( skin, aGc, sliceRect.Rect(), *sliceId ); |
591 |
558 |
|
559 TAknWindowComponentLayout popupBgLayout( |
|
560 AknLayoutScalable_Avkon::bg_popup_window_pane( 0 ) ); |
|
561 |
|
562 TAknWindowComponentLayout popupBgInnerLayout( |
|
563 AknLayoutScalable_Avkon::bg_popup_window_pane_g1( |
|
564 Layout_Meta_Data::IsLandscapeOrientation() ) ); |
|
565 |
|
566 TAknLayoutRect topLeft; |
592 TAknLayoutRect topLeft; |
567 topLeft.LayoutRect( |
593 topLeft.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_2()); |
568 windowRect, |
|
569 TAknWindowComponentLayout::Compose( |
|
570 popupBgLayout, |
|
571 TAknWindowComponentLayout::Split( popupBgInnerLayout, 0 ) ) ); |
|
572 TRect topLeftRect( topLeft.Rect() ); |
|
573 |
594 |
574 TAknLayoutRect bottomRight; |
595 TAknLayoutRect bottomRight; |
575 bottomRight.LayoutRect( |
596 bottomRight.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_5()); |
576 windowRect, |
597 |
577 TAknWindowComponentLayout::Compose( |
598 TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); |
578 popupBgLayout, |
599 TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
579 TAknWindowComponentLayout::Split( popupBgInnerLayout, 8 ) ) ); |
600 aGc.SetPenStyle(CGraphicsContext::ENullPen); |
580 TRect bottomRightRect( bottomRight.Rect() ); |
601 const TAknsItemID *frameId = &KAknsIIDQsnFrPopup; |
581 |
602 const TAknsItemID *frameCenterId = &KAknsIIDQsnFrPopupCenter; |
582 TRect outerRect( topLeftRect.iTl, bottomRightRect.iBr ); |
|
583 TRect innerRect( topLeftRect.iBr, bottomRightRect.iTl ); |
|
584 |
|
585 aGc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
586 |
|
587 const TAknsItemID* frameId = &KAknsIIDQsnFrPopup; |
|
588 const TAknsItemID* frameCenterId = &KAknsIIDQsnFrPopupCenter; |
|
589 |
|
590 aGc.SetClippingRegion( drawRegion ); |
603 aGc.SetClippingRegion( drawRegion ); |
591 |
604 windowFrameDrawn = AknsDrawUtils::DrawFrame(skin, aGc, outerRect, innerRect, *frameId, *frameCenterId); |
592 windowFrameDrawn = AknsDrawUtils::DrawFrame( skin, |
|
593 aGc, |
|
594 outerRect, |
|
595 innerRect, |
|
596 *frameId, |
|
597 *frameCenterId ); |
|
598 aGc.CancelClippingRegion(); |
605 aGc.CancelClippingRegion(); |
599 } |
606 } |
600 |
607 if (!windowFrameDrawn) |
601 if ( !windowFrameDrawn ) |
608 { |
602 { |
609 AknDraw::DrawWindowShadow(aGc, aDef.iCover, aDef.iSecond, aDef.iFirst, aDef.iOutline, aDef.iInside); |
603 AknDraw::DrawWindowShadow( aGc, |
|
604 aDef.iCover, |
|
605 aDef.iSecond, |
|
606 aDef.iFirst, |
|
607 aDef.iOutline, |
|
608 aDef.iInside ); |
|
609 } |
610 } |
610 } |
611 } |
611 #pragma warning(default : 4100) |
612 #pragma warning(default : 4100) |
612 |
613 |
613 |
614 |
615 { |
616 { |
616 return TRect(TPoint(0,0), aDef.iWindowRect.Size()); |
617 return TRect(TPoint(0,0), aDef.iWindowRect.Size()); |
617 } |
618 } |
618 |
619 |
619 |
620 |
620 EXPORT_C void AknPopupLayouts::MenuPopupWindowGraphics( |
621 EXPORT_C void AknPopupLayouts::MenuPopupWindowGraphics(TAknPopupWindowLayoutDef &aDef) |
621 TAknPopupWindowLayoutDef& aDef ) |
622 { |
622 { |
623 TRect window_rect = AknPopupLayouts::MenuRect(aDef); |
623 TRect windowRect( AknPopupLayouts::MenuRect( aDef ) ); |
624 TAknWindowLineLayout s0 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_graphics_Line_1(window_rect); |
624 |
625 TAknWindowLineLayout s1 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_graphics_Line_2(window_rect); |
625 aDef.iCover.LayoutRect( |
626 TAknWindowLineLayout s2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_graphics_Line_3(window_rect); |
626 windowRect, AknLayoutScalable_Avkon::bg_popup_window_pane_cp2( 0 ) ); |
627 TAknWindowLineLayout s3 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_graphics_Line_4(window_rect); |
627 aDef.iSecond.LayoutRect( windowRect, KEmptyLayout ); |
628 TAknWindowLineLayout s4 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_graphics_Line_5(window_rect); |
628 aDef.iFirst.LayoutRect( windowRect, KEmptyLayout ); |
629 |
629 aDef.iOutline.LayoutRect( |
630 aDef.iCover.LayoutRect( window_rect, s0); |
630 windowRect, AknLayoutScalable_Avkon::listscroll_menu_pane( 0 ) ); |
631 aDef.iSecond.LayoutRect( window_rect, s1); |
631 aDef.iInside.LayoutRect( |
632 aDef.iFirst.LayoutRect( window_rect, s2); |
632 windowRect, AknLayoutScalable_Avkon::list_menu_pane( 0 ) ); |
633 aDef.iOutline.LayoutRect(window_rect, s3); |
633 } |
634 aDef.iInside.LayoutRect( window_rect, s4); |
634 |
635 } |
635 |
636 |
636 EXPORT_C void AknPopupLayouts::SetupMenuPopupWindow( TAknPopupWindowLayoutDef& aDef, |
637 EXPORT_C void AknPopupLayouts::SetupMenuPopupWindow(TAknPopupWindowLayoutDef &aDef, TInt num, TBool heading) |
637 TInt aNum, |
638 { |
638 TBool aHeading ) |
639 SetupDefaults(aDef); |
639 { |
640 TRect window_rect = AknPopupLayouts::MenuRect(aDef); |
640 SetupDefaults( aDef ); |
641 TAknWindowLineLayout listLayout = AKN_LAYOUT_WINDOW_list_menu_pane(heading?1:0, num-1); |
641 |
642 // We really don't want parent relative list layout here because findbox will be overwritten. |
642 CommonSetup( aDef, |
643 // Just calculate list height and use that. |
643 AknLayoutScalable_Avkon::list_single_number_heading_pane_cp2( 0 ), |
644 TRect nullRect(0,0,0,0); |
644 aNum, |
645 TRect listItemRect = RectFromLayout(nullRect, AknLayoutScalable_Avkon::list_single_number_heading_pane_cp2(0)); |
645 aHeading, |
646 listLayout.iH = (TInt16)(num * listItemRect.Height()); |
646 ETrue ); |
647 listLayout.ib = ELayoutEmpty; |
647 } |
648 |
648 |
649 aDef.iListRect.LayoutRect(window_rect, listLayout); |
649 |
650 |
650 EXPORT_C void AknPopupLayouts::SetupPopupMenuGraphicWindow( |
651 //aDef.iListRect.LayoutRect(window_rect, AKN_LAYOUT_WINDOW_list_menu_pane(heading?1:0, num-1)); |
651 TAknPopupWindowLayoutDef &aDef, |
652 |
652 TInt aNum, |
653 TAknWindowLineLayout part1 = AKN_LAYOUT_WINDOW_Pop_up_window_list_pane_descendants_Line_8; |
653 TBool aHeading ) |
654 TAknWindowLineLayout part2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_Line_2; |
654 { |
655 |
655 SetupDefaults( aDef ); |
|
656 |
|
657 CommonSetup( aDef, |
|
658 AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2( 0 ), |
|
659 aNum, |
|
660 aHeading, |
|
661 ETrue ); |
|
662 } |
|
663 |
|
664 |
|
665 EXPORT_C void AknPopupLayouts::SetupPopupMenuGraphicHeadingWindow( |
|
666 TAknPopupWindowLayoutDef &aDef, |
|
667 TInt aNum, |
|
668 TBool aHeading ) |
|
669 { |
|
670 CommonSetup( aDef, |
|
671 AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2( 0 ), |
|
672 aNum, |
|
673 aHeading, |
|
674 EFalse ); |
|
675 |
|
676 TRect windowRect( AknPopupLayouts::MenuRect( aDef ) ); |
|
677 aDef.iHeadingRect.LayoutRect( windowRect, |
|
678 AknLayoutScalable_Avkon::heading_pane( 0 ) ); |
|
679 } |
|
680 |
|
681 |
|
682 EXPORT_C void AknPopupLayouts::SetupPopupMenuDoubleWindow( |
|
683 TAknPopupWindowLayoutDef& aDef, |
|
684 TInt aNum, |
|
685 TBool aHeading ) |
|
686 { |
|
687 SetupDefaults( aDef ); |
|
688 |
|
689 CommonSetup( aDef, |
|
690 AknLayoutScalable_Avkon::list_double2_graphic_pane_cp2( 0 ), |
|
691 aNum, |
|
692 aHeading, |
|
693 EFalse ); |
|
694 |
|
695 TRect windowRect( AknPopupLayouts::MenuRect( aDef ) ); |
|
696 aDef.iHeadingRect.LayoutRect( windowRect, |
|
697 AknLayoutScalable_Avkon::heading_pane( 0 ) ); |
|
698 } |
|
699 |
|
700 |
|
701 EXPORT_C void AknPopupLayouts::SetupImageSelectionMenuPopupWindow( |
|
702 TAknPopupWindowLayoutDef& aDef, |
|
703 TInt aNum, |
|
704 TBool aHeading ) |
|
705 { |
|
706 SetupDefaults( aDef ); |
|
707 |
|
708 CommonSetup( aDef, |
|
709 AknLayoutScalable_Avkon::list_double_large_graphic_pane_cp2( 0 ), |
|
710 aNum, |
|
711 aHeading, |
|
712 EFalse ); |
|
713 |
|
714 TRect windowRect( AknPopupLayouts::MenuRect( aDef ) ); |
|
715 aDef.iHeadingRect.LayoutRect( windowRect, |
|
716 AknLayoutScalable_Avkon::heading_pane( 0 ) ); |
|
717 } |
|
718 |
|
719 |
|
720 EXPORT_C void AknPopupLayouts::SetupPopupSNoteGroupWindow( |
|
721 TAknPopupWindowLayoutDef &aDef, |
|
722 TInt aNum, |
|
723 TBool /*aHeading*/ ) |
|
724 { |
|
725 // Not used (at least by AvKon) - no need to remove magic numbers. |
|
726 SetupDefaults( aDef ); |
|
727 TRect windowRect( AknPopupLayouts::MenuRect( aDef ) ); |
|
728 aDef.iListRect.LayoutRect( windowRect, |
|
729 0, |
|
730 3, |
|
731 11, |
|
732 ELayoutEmpty, |
|
733 ELayoutEmpty, |
|
734 168, |
|
735 38 + ( 57 - 38 ) * ( aNum - 2 ) ); |
|
736 |
|
737 TAknWindowLineLayout part1( |
|
738 AknLayoutScalable_Avkon::heading_pane( 0 ).LayoutLine() ); |
|
739 |
|
740 TAknWindowLineLayout part2( |
|
741 TAknWindowComponentLayout::Compose( |
|
742 TAknWindowComponentLayout::Compose( |
|
743 TAknWindowComponentLayout::SiblingAsChild( |
|
744 AknLayoutScalable_Avkon::popup_window_general( 1 ), |
|
745 AknLayoutScalable_Avkon::popup_window_general( 0 ) ), |
|
746 AknLayoutScalable_Avkon::listscroll_menu_pane( 0 ) ), |
|
747 AknLayoutScalable_Avkon::list_menu_pane( 0 ) ).LayoutLine() ); |
|
748 |
|
749 // Combine two layouts togeher. |
656 // Combine two layouts togeher. |
750 if ( part2.iC != ELayoutEmpty ) part1.iC = part2.iC; |
657 if (part2.iC != ELayoutEmpty) part1.iC = part2.iC; |
751 if ( part2.il != ELayoutEmpty ) part1.il = part2.il; |
658 if (part2.il != ELayoutEmpty) part1.il = part2.il; |
752 if ( part2.it != ELayoutEmpty ) part1.it = part2.it; |
659 if (part2.it != ELayoutEmpty) part1.it = part2.it; |
753 if ( part2.ir != ELayoutEmpty ) part1.ir = part2.ir; |
660 if (part2.ir != ELayoutEmpty) part1.ir = part2.ir; |
754 if ( part2.ib != ELayoutEmpty ) part1.ib = part2.ib; |
661 if (part2.ib != ELayoutEmpty) part1.ib = part2.ib; |
755 if ( part2.iW != ELayoutEmpty ) part1.iW = part2.iW; |
662 if (part2.iW != ELayoutEmpty) part1.iW = part2.iW; |
756 if ( part2.iH != ELayoutEmpty ) part1.iH = part2.iH; |
663 if (part2.iH != ELayoutEmpty) part1.iH = part2.iH; |
757 |
664 |
758 aDef.iHeadingRect.LayoutRect( windowRect, part1 ); |
665 aDef.iHeadingRect.LayoutRect(window_rect, part1); |
759 |
666 |
760 TInt p = windowRect.Size().iHeight; |
667 //MenuPopupWindowGraphics(aDef); |
|
668 } |
|
669 |
|
670 EXPORT_C void AknPopupLayouts::SetupPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef, TInt num, TBool heading) |
|
671 { |
|
672 SetupDefaults(aDef); |
|
673 TRect window_rect = AknPopupLayouts::MenuRect(aDef); |
|
674 TAknWindowLineLayout listLayout = AKN_LAYOUT_WINDOW_list_menu_graphic_pane(heading?1:0, num-1); |
|
675 // We really don't want parent relative list layout here because findbox will be overwritten. |
|
676 // Just calculate list height and use that. |
|
677 TRect nullRect(0,0,0,0); |
|
678 TRect listItemRect = RectFromLayout(nullRect, AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2(0)); |
|
679 listLayout.iH = (TInt16)(num * listItemRect.Height()); |
|
680 listLayout.ib = ELayoutEmpty; |
|
681 |
|
682 aDef.iListRect.LayoutRect(window_rect, listLayout); |
|
683 |
|
684 //aDef.iListRect.LayoutRect(window_rect, AKN_LAYOUT_WINDOW_list_menu_graphic_pane(heading?1:0, num-1)); |
|
685 TAknWindowLineLayout part1 = AKN_LAYOUT_WINDOW_Pop_up_window_list_pane_descendants_Line_8; |
|
686 TAknWindowLineLayout part2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_Line_2; |
|
687 |
|
688 // Combine two layouts togeher. |
|
689 if (part2.iC != ELayoutEmpty) part1.iC = part2.iC; |
|
690 if (part2.il != ELayoutEmpty) part1.il = part2.il; |
|
691 if (part2.it != ELayoutEmpty) part1.it = part2.it; |
|
692 if (part2.ir != ELayoutEmpty) part1.ir = part2.ir; |
|
693 if (part2.ib != ELayoutEmpty) part1.ib = part2.ib; |
|
694 if (part2.iW != ELayoutEmpty) part1.iW = part2.iW; |
|
695 if (part2.iH != ELayoutEmpty) part1.iH = part2.iH; |
|
696 |
|
697 aDef.iHeadingRect.LayoutRect(window_rect, part1); |
|
698 |
|
699 //MenuPopupWindowGraphics(aDef); |
|
700 } |
|
701 |
|
702 EXPORT_C void AknPopupLayouts::SetupPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef, TInt num, TBool heading) |
|
703 { |
|
704 TRect window_rect = AknPopupLayouts::MenuRect(aDef); |
|
705 TAknWindowLineLayout listLayout = AKN_LAYOUT_WINDOW_list_menu_graphic_heading_pane(heading?1:0, num-1); |
|
706 // We really don't want parent relative list layout here because findbox will be overwritten. |
|
707 // Just calculate list height and use that. |
|
708 TRect nullRect(0,0,0,0); |
|
709 TRect listItemRect = RectFromLayout(nullRect, AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2(0)); |
|
710 listLayout.iH = (TInt16)(num * listItemRect.Height()); |
|
711 listLayout.ib = ELayoutEmpty; |
|
712 |
|
713 aDef.iListRect.LayoutRect(window_rect, listLayout); |
|
714 |
|
715 TAknWindowLineLayout part1 = AKN_LAYOUT_WINDOW_Pop_up_window_list_pane_descendants_Line_8; |
|
716 TAknWindowLineLayout part2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_and_elements__single_graphic_heading__Line_2; |
|
717 // Combine two layouts togeher. |
|
718 if (part2.iC != ELayoutEmpty) part1.iC = part2.iC; |
|
719 if (part2.il != ELayoutEmpty) part1.il = part2.il; |
|
720 if (part2.it != ELayoutEmpty) part1.it = part2.it; |
|
721 if (part2.ir != ELayoutEmpty) part1.ir = part2.ir; |
|
722 if (part2.ib != ELayoutEmpty) part1.ib = part2.ib; |
|
723 if (part2.iW != ELayoutEmpty) part1.iW = part2.iW; |
|
724 if (part2.iH != ELayoutEmpty) part1.iH = part2.iH; |
|
725 |
|
726 aDef.iHeadingRect.LayoutRect(window_rect, part1); |
|
727 |
|
728 //MenuPopupWindowGraphics(aDef); |
|
729 |
|
730 const TAknWindowLineLayout lines[] = |
|
731 { |
|
732 AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_and_elements__single_graphic_heading__Line_3(heading?1:0), |
|
733 AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_and_elements__single_graphic_heading__Line_3(1) |
|
734 }; |
|
735 TRect inner_rect = window_rect; |
|
736 aDef.iVertLineExt1.LayoutRect( inner_rect, lines[0]); |
|
737 aDef.iVertLineExt2.LayoutRect( inner_rect, lines[1]); |
|
738 } |
|
739 |
|
740 EXPORT_C void AknPopupLayouts::SetupPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef, TInt num, TBool heading) |
|
741 { |
|
742 SetupDefaults(aDef); |
|
743 TRect window_rect = AknPopupLayouts::MenuRect(aDef); |
|
744 TAknWindowLineLayout listLayout = AKN_LAYOUT_WINDOW_list_menu_double_pane_list_menu_double2_pane(heading?1:0, num-1); |
|
745 // We really don't want parent relative list layout here because findbox will be overwritten. |
|
746 // Just calculate list height and use that. |
|
747 TRect nullRect(0,0,0,0); |
|
748 TRect listItemRect = RectFromLayout(nullRect, AknLayoutScalable_Avkon::list_double2_graphic_pane_cp2(0)); |
|
749 listLayout.iH = (TInt16)(num * listItemRect.Height()); |
|
750 listLayout.ib = ELayoutEmpty; |
|
751 |
|
752 aDef.iListRect.LayoutRect(window_rect, listLayout); |
|
753 |
|
754 //aDef.iListRect.LayoutRect(window_rect, AKN_LAYOUT_WINDOW_list_menu_double_pane_list_menu_double2_pane(heading?1:0, num-1 )); |
|
755 TAknWindowLineLayout part1 = AKN_LAYOUT_WINDOW_Pop_up_window_list_pane_descendants_Line_8; |
|
756 TAknWindowLineLayout part2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants__double__Line_2; |
|
757 // Combine two layouts togeher. |
|
758 if (part2.iC != ELayoutEmpty) part1.iC = part2.iC; |
|
759 if (part2.il != ELayoutEmpty) part1.il = part2.il; |
|
760 if (part2.it != ELayoutEmpty) part1.it = part2.it; |
|
761 if (part2.ir != ELayoutEmpty) part1.ir = part2.ir; |
|
762 if (part2.ib != ELayoutEmpty) part1.ib = part2.ib; |
|
763 if (part2.iW != ELayoutEmpty) part1.iW = part2.iW; |
|
764 if (part2.iH != ELayoutEmpty) part1.iH = part2.iH; |
|
765 |
|
766 aDef.iHeadingRect.LayoutRect(window_rect, part1); |
|
767 |
|
768 //MenuPopupWindowGraphics(aDef); |
|
769 } |
|
770 |
|
771 EXPORT_C void AknPopupLayouts::SetupImageSelectionMenuPopupWindow(TAknPopupWindowLayoutDef &aDef, TInt num, TBool heading) |
|
772 { |
|
773 SetupDefaults(aDef); |
|
774 TRect window_rect = AknPopupLayouts::MenuRect(aDef); |
|
775 TAknWindowLineLayout listLayout = AKN_LAYOUT_WINDOW_list_menu_double_large_graphic_pane(heading?1:0, num-1); |
|
776 // We really don't want parent relative list layout here because findbox will be overwritten. |
|
777 // Just calculate list height and use that. |
|
778 TRect nullRect(0,0,0,0); |
|
779 TRect listItemRect = RectFromLayout(nullRect, AknLayoutScalable_Avkon::list_double_large_graphic_pane_cp2(0)); |
|
780 listLayout.iH = (TInt16)(num * listItemRect.Height()); |
|
781 listLayout.ib = ELayoutEmpty; |
|
782 |
|
783 aDef.iListRect.LayoutRect(window_rect, listLayout); |
|
784 |
|
785 //aDef.iListRect.LayoutRect(window_rect, AKN_LAYOUT_WINDOW_list_menu_double_large_graphic_pane(heading?1:0, num-1)); |
|
786 |
|
787 TAknWindowLineLayout part1 = AKN_LAYOUT_WINDOW_Pop_up_window_list_pane_descendants_Line_8; |
|
788 TAknWindowLineLayout part2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants__double__Line_2; |
|
789 |
|
790 // Combine two layouts togeher. |
|
791 if (part2.iC != ELayoutEmpty) part1.iC = part2.iC; |
|
792 if (part2.il != ELayoutEmpty) part1.il = part2.il; |
|
793 if (part2.it != ELayoutEmpty) part1.it = part2.it; |
|
794 if (part2.ir != ELayoutEmpty) part1.ir = part2.ir; |
|
795 if (part2.ib != ELayoutEmpty) part1.ib = part2.ib; |
|
796 if (part2.iW != ELayoutEmpty) part1.iW = part2.iW; |
|
797 if (part2.iH != ELayoutEmpty) part1.iH = part2.iH; |
|
798 aDef.iHeadingRect.LayoutRect(window_rect, part1); |
|
799 |
|
800 //MenuPopupWindowGraphics(aDef); |
|
801 } |
|
802 |
|
803 |
|
804 EXPORT_C void AknPopupLayouts::SetupPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef, TInt num, TBool /*heading*/) |
|
805 { |
|
806 // not used (at least by AvKon) - no need to remove magic numbers |
|
807 SetupDefaults(aDef); |
|
808 TRect window_rect = AknPopupLayouts::MenuRect(aDef); |
|
809 aDef.iListRect.LayoutRect(window_rect, 0, 3, 11, ELayoutEmpty, ELayoutEmpty, 168, 38+(57-38)*(num-2) ); |
|
810 TAknWindowLineLayout part1 = AKN_LAYOUT_WINDOW_Pop_up_window_list_pane_descendants_Line_8; |
|
811 TAknWindowLineLayout part2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_Line_2; |
|
812 |
|
813 // Combine two layouts togeher. |
|
814 if (part2.iC != ELayoutEmpty) part1.iC = part2.iC; |
|
815 if (part2.il != ELayoutEmpty) part1.il = part2.il; |
|
816 if (part2.it != ELayoutEmpty) part1.it = part2.it; |
|
817 if (part2.ir != ELayoutEmpty) part1.ir = part2.ir; |
|
818 if (part2.ib != ELayoutEmpty) part1.ib = part2.ib; |
|
819 if (part2.iW != ELayoutEmpty) part1.iW = part2.iW; |
|
820 if (part2.iH != ELayoutEmpty) part1.iH = part2.iH; |
|
821 |
|
822 aDef.iHeadingRect.LayoutRect(window_rect, part1); |
|
823 |
|
824 TInt p = window_rect.Size().iHeight; |
761 const AknLayoutUtils::SAknLayoutRect shadow[] = |
825 const AknLayoutUtils::SAknLayoutRect shadow[] = |
762 { |
826 { |
763 { 0, 0, 0, ELayoutEmpty, ELayoutEmpty, 176, p }, |
827 { 0,0,0,ELayoutEmpty, ELayoutEmpty, 176, p }, |
764 { 86, 7, 12, ELayoutEmpty, ELayoutEmpty, 167, p - 16 }, |
828 { 86,7,12,ELayoutEmpty, ELayoutEmpty, 167, p -16 }, |
765 { 221, 4, 10, ELayoutEmpty, ELayoutEmpty, 169, p - 15 }, |
829 { 221,4,10,ELayoutEmpty, ELayoutEmpty, 169, p -15 }, |
766 { 215, 2, 8, ELayoutEmpty, ELayoutEmpty, 170, p - 14 }, |
830 { 215,2,8,ELayoutEmpty, ELayoutEmpty, 170, p -14 }, |
767 { 0, 3, 9, ELayoutEmpty, ELayoutEmpty, 168, p - 16 } |
831 { 0,3,9,ELayoutEmpty, ELayoutEmpty, 168, p -16 } |
768 }; |
832 }; |
769 |
833 |
770 aDef.iCover.LayoutRect( windowRect, shadow[0] ); |
834 aDef.iCover.LayoutRect( window_rect, shadow[0]); |
771 aDef.iSecond.LayoutRect( windowRect, shadow[1] ); |
835 aDef.iSecond.LayoutRect( window_rect, shadow[1]); |
772 aDef.iFirst.LayoutRect( windowRect, shadow[2] ); |
836 aDef.iFirst.LayoutRect( window_rect, shadow[2]); |
773 aDef.iOutline.LayoutRect(windowRect, shadow[3] ); |
837 aDef.iOutline.LayoutRect(window_rect, shadow[3]); |
774 aDef.iInside.LayoutRect( windowRect, shadow[4] ); |
838 aDef.iInside.LayoutRect( window_rect, shadow[4]); |
775 } |
839 } |
776 |
840 |
777 |
841 |
778 EXPORT_C void AknPopupLayouts::CalcPopupMenuWindow( |
842 |
779 TAknPopupWindowLayoutDef& aDef, |
843 EXPORT_C void AknPopupLayouts::CalcPopupMenuWindow(TAknPopupWindowLayoutDef &aDef,TRect aRect, TInt num) |
780 TRect aRect, |
844 { |
781 TInt aNum ) |
845 TAknLayoutRect popup_menu_window; |
782 { |
846 popup_menu_window.LayoutRect(aRect, AKN_LAYOUT_WINDOW_popup_menu_window(num-1)); |
783 TInt variety; |
847 aDef.iWindowRect = popup_menu_window.Rect(); |
784 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
848 aDef.iPopupMenuWindowOffset=TPoint(0,0); |
785 { |
849 } |
786 // Popup menu window is wider in landscape orientation. |
850 EXPORT_C void AknPopupLayouts::CalcPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef,TRect aRect, TInt num) |
787 variety = ( aNum < 7 ) ? 20 - aNum : 43; |
851 { |
788 } |
852 TAknLayoutRect popup_menu_graphic_window; |
789 else |
853 popup_menu_graphic_window.LayoutRect(aRect, AKN_LAYOUT_WINDOW_popup_menu_graphic_window(num-1)); |
790 { |
854 aDef.iWindowRect = popup_menu_graphic_window.Rect(); |
791 variety = 7 + aNum; |
855 aDef.iPopupMenuWindowOffset=TPoint(0,0); |
792 } |
856 } |
793 |
857 EXPORT_C void AknPopupLayouts::CalcPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef,TRect aRect, TInt num) |
794 TAknLayoutRect popupMenuWindow; |
858 { |
795 popupMenuWindow.LayoutRect( |
859 TAknLayoutRect popup_menu_graphic_heading_window; |
796 aRect, |
860 popup_menu_graphic_heading_window.LayoutRect(aRect,AKN_LAYOUT_WINDOW_popup_menu_graphic_heading_window(num-1)); |
797 AknLayoutScalable_Avkon::popup_menu_window( variety ) ); |
861 aDef.iWindowRect = popup_menu_graphic_heading_window.Rect(); |
798 aDef.iWindowRect = popupMenuWindow.Rect(); |
862 aDef.iPopupMenuWindowOffset=TPoint(0,0); |
799 aDef.iPopupMenuWindowOffset.SetXY( 0, 0 ); |
863 } |
800 } |
864 EXPORT_C void AknPopupLayouts::CalcPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef,TRect aRect, TInt num) |
801 |
865 { |
802 |
866 TAknLayoutRect popup_menu_double_window; |
803 EXPORT_C void AknPopupLayouts::CalcPopupMenuGraphicWindow( |
867 TInt items = 2; |
804 TAknPopupWindowLayoutDef& aDef, |
868 if (num == 2) items = 1; |
805 TRect aRect, |
869 if (num == 1) items = 0; |
806 TInt aNum ) |
870 popup_menu_double_window.LayoutRect(aRect, AKN_LAYOUT_WINDOW_popup_menu_double_window(items)); |
807 { |
871 aDef.iWindowRect = popup_menu_double_window.Rect(); |
808 CalcPopupMenuWindow( aDef, aRect, aNum ); |
872 aDef.iPopupMenuWindowOffset=TPoint(0,0); |
809 } |
873 } |
810 |
874 |
811 |
875 EXPORT_C void AknPopupLayouts::CalcPopupMenuDoubleLargeGraphicWindow(TAknPopupWindowLayoutDef &aDef,TRect aRect, TInt num) |
812 EXPORT_C void AknPopupLayouts::CalcPopupMenuGraphicHeadingWindow( |
876 { |
813 TAknPopupWindowLayoutDef& aDef, |
877 TAknLayoutRect popup_menu_double_large_graphic_window; |
814 TRect aRect, |
878 TInt items = 2; |
815 TInt aNum ) |
879 if (num == 2) items = 1; |
816 { |
880 if (num == 1) items = 0; |
817 CalcPopupMenuWindow( aDef, aRect, aNum ); |
881 popup_menu_double_large_graphic_window.LayoutRect(aRect, AKN_LAYOUT_WINDOW_popup_menu_double_large_graphic_window(items)); |
818 } |
882 aDef.iWindowRect = popup_menu_double_large_graphic_window.Rect(); |
819 |
883 aDef.iPopupMenuWindowOffset=TPoint(0,0); |
820 |
|
821 EXPORT_C void AknPopupLayouts::CalcPopupMenuDoubleWindow( |
|
822 TAknPopupWindowLayoutDef& aDef, |
|
823 TRect aRect, |
|
824 TInt aNum ) |
|
825 { |
|
826 TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() ); |
|
827 |
|
828 TInt variety = isLandscape ? 26 : 2; |
|
829 if ( aNum == 2 ) |
|
830 { |
|
831 variety = isLandscape ? 25 : 1; |
|
832 } |
|
833 else if ( aNum == 1 ) |
|
834 { |
|
835 variety = isLandscape ? 24 : 0; |
|
836 } |
|
837 |
|
838 TAknLayoutRect popupMenuDoubleWindow; |
|
839 popupMenuDoubleWindow.LayoutRect( |
|
840 aRect, AknLayoutScalable_Avkon::popup_menu_window( variety ) ); |
|
841 aDef.iWindowRect = popupMenuDoubleWindow.Rect(); |
|
842 aDef.iPopupMenuWindowOffset.SetXY( 0, 0 ); |
|
843 } |
|
844 |
|
845 |
|
846 EXPORT_C void AknPopupLayouts::CalcPopupMenuDoubleLargeGraphicWindow( |
|
847 TAknPopupWindowLayoutDef& aDef, |
|
848 TRect aRect, |
|
849 TInt aNum ) |
|
850 { |
|
851 CalcPopupMenuDoubleWindow( aDef, aRect, aNum ); |
|
852 } |
|
853 |
|
854 |
|
855 EXPORT_C void AknPopupLayouts::CalcPopupSNoteGroupWindow( |
|
856 TAknPopupWindowLayoutDef& aDef, |
|
857 TRect aRect, |
|
858 TInt /*aNum*/ ) |
|
859 { |
|
860 // Layout for this isn't specified in the layout data, |
|
861 // use the provided rect. |
|
862 aDef.iWindowRect = aRect; |
|
863 aDef.iPopupMenuWindowOffset.SetXY( 0, 0 ); |
|
864 } |
884 } |
865 |
885 |
866 |
886 |
|
887 EXPORT_C void AknPopupLayouts::CalcPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef,TRect aRect, TInt num) |
|
888 { |
|
889 TAknLayoutRect popup_menu_snote_window; |
|
890 if (num-2 < 0) { num = 2; } |
|
891 popup_menu_snote_window.LayoutRect(aRect, AKN_LAYOUT_WINDOW_popup_snote_group_window(num-2)); |
|
892 aDef.iWindowRect = popup_menu_snote_window.Rect(); |
|
893 aDef.iPopupMenuWindowOffset=TPoint(0,0); |
|
894 } |
|
895 |
|
896 |
867 EXPORT_C TRect AknPopupLayouts::WindowRect(TAknPopupWindowLayoutDef &aDef) {return aDef.iWindowRect; } |
897 EXPORT_C TRect AknPopupLayouts::WindowRect(TAknPopupWindowLayoutDef &aDef) {return aDef.iWindowRect; } |
868 |
898 |
869 |
899 EXPORT_C void AknPopupLayouts::ModifyWindowGraphicForHeading(TAknPopupWindowLayoutDef &aDef) |
870 EXPORT_C void AknPopupLayouts::ModifyWindowGraphicForHeading( |
900 { |
871 TAknPopupWindowLayoutDef& aDef ) |
901 TRect nullRect(0,0,0,0); |
872 { |
|
873 TRect nullRect( 0, 0, 0, 0 ); |
|
874 TAknLayoutRect nullHeadingRect; |
902 TAknLayoutRect nullHeadingRect; |
875 |
903 // find out, how much space is needed for heading (spaceForHeading was 23) |
876 TAknWindowComponentLayout popupWindowLayout( |
904 nullHeadingRect.LayoutRect(nullRect,AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_1(nullRect)); |
877 TAknWindowComponentLayout::SiblingAsChild( |
|
878 AknLayoutScalable_Avkon::popup_window_general( 0 ), |
|
879 AknLayoutScalable_Avkon::popup_window_general( 1 ) ) ); |
|
880 |
|
881 // Find out how much space is needed for heading. |
|
882 nullHeadingRect.LayoutRect( nullRect, popupWindowLayout ); |
|
883 TInt spaceForHeading = nullHeadingRect.Rect().Height(); |
905 TInt spaceForHeading = nullHeadingRect.Rect().Height(); |
884 |
906 |
885 // This is necessary to position it correctly. |
907 |
886 aDef.iWindowRect.iTl.iY -= spaceForHeading; |
908 aDef.iWindowRect.iTl.iY -= spaceForHeading; // This is necessary to position it correctly |
887 |
909 // this is because b=0 in parent of coverrect and because |
888 // this is because b=0 in parent of coverrect and because |
910 // parent's height is used in the child... |
889 // parent's height is used in the child... |
911 |
890 TRect windowRect( aDef.iWindowRect ); |
912 TRect window_rect = aDef.iWindowRect; |
891 |
913 |
892 aDef.iCover.LayoutRect( windowRect, popupWindowLayout ); |
914 aDef.iCover.LayoutRect( window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_1(window_rect)); |
893 aDef.iSecond.LayoutRect( windowRect, KEmptyLayout ); |
915 aDef.iSecond.LayoutRect( window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_2(window_rect)); |
894 aDef.iFirst.LayoutRect( windowRect, KEmptyLayout ); |
916 aDef.iFirst.LayoutRect( window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_3(window_rect)); |
895 aDef.iOutline.LayoutRect( windowRect, KEmptyLayout ); |
917 aDef.iOutline.LayoutRect(window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_4(window_rect)); |
896 aDef.iInside.LayoutRect( windowRect, KEmptyLayout ); |
918 aDef.iInside.LayoutRect( window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_5(window_rect)); |
897 |
919 |
898 aDef.iPopupMenuWindowOffset.SetXY( 0, spaceForHeading ); |
920 aDef.iPopupMenuWindowOffset=TPoint(0,spaceForHeading); |
899 } |
921 } |
900 |
|
901 |
922 |
902 EXPORT_C void AknPopupLayouts::ModifyWindowGraphicForMessageBox(TAknPopupWindowLayoutDef &aDef, TInt aNumberOfLines) |
923 EXPORT_C void AknPopupLayouts::ModifyWindowGraphicForMessageBox(TAknPopupWindowLayoutDef &aDef, TInt aNumberOfLines) |
903 { |
924 { |
904 TInt varietyIndex = 0; |
925 TInt varietyIndex = 0; |
905 switch (aNumberOfLines) |
926 switch (aNumberOfLines) |