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