branch | RCL_3 |
changeset 16 | 4ce476e64c59 |
parent 12 | f5907b1a1053 |
child 26 | 67369d1b217f |
13:0396474f30f5 | 16:4ce476e64c59 |
---|---|
31 #include <alf/alfbrusharray.h> |
31 #include <alf/alfbrusharray.h> |
32 #include <alf/alftextstyle.h> |
32 #include <alf/alftextstyle.h> |
33 #include <AknsConstants.h> |
33 #include <AknsConstants.h> |
34 #include <AknUtils.h> |
34 #include <AknUtils.h> |
35 #include <touchlogicalfeedback.h> |
35 #include <touchlogicalfeedback.h> |
36 #include <layoutmetadata.cdl.h> |
|
36 |
37 |
37 #include "fscontrolbuttonvisualiser.h" |
38 #include "fscontrolbuttonvisualiser.h" |
38 #include "fscontrolbuttonmodel.h" |
39 #include "fscontrolbuttonmodel.h" |
39 #include "fsgenericpanic.h" |
40 #include "fsgenericpanic.h" |
40 #include "fstextstylemanager.h" |
41 #include "fstextstylemanager.h" |
99 iButtonContentLayout = CAlfLayout::AddNewL( *iParent ); |
100 iButtonContentLayout = CAlfLayout::AddNewL( *iParent ); |
100 |
101 |
101 // Request callback after image is loaded to refresh it's size and |
102 // Request callback after image is loaded to refresh it's size and |
102 // position. |
103 // position. |
103 iParent->Env().TextureManager().AddLoadObserverL( this ); |
104 iParent->Env().TextureManager().AddLoadObserverL( this ); |
105 |
|
106 iParentLayout->SetFlag( EAlfVisualFlagLayoutUpdateNotification ); |
|
107 iButtonLayout->SetFlags( EAlfVisualFlagManualSize | EAlfVisualFlagManualPosition ); |
|
108 iButtonContentLayout->SetFlags( EAlfVisualFlagManualSize | EAlfVisualFlagManualPosition ); |
|
109 |
|
104 } |
110 } |
105 } |
111 } |
106 |
112 |
107 |
113 |
108 // --------------------------------------------------------------------------- |
114 // --------------------------------------------------------------------------- |
321 TInt width( iParentLayout->Size().Target().iX ); |
327 TInt width( iParentLayout->Size().Target().iX ); |
322 pos.iX = width - aStartAt.iX - iButtonLayout->Size().Target().iX; |
328 pos.iX = width - aStartAt.iX - iButtonLayout->Size().Target().iX; |
323 } |
329 } |
324 |
330 |
325 // Set new position for background visual and it's content. |
331 // Set new position for background visual and it's content. |
326 iButtonLayout->SetFlag( EAlfVisualFlagManualPosition ); |
|
327 iButtonContentLayout->SetFlag( EAlfVisualFlagManualPosition ); |
|
328 iButtonLayout->SetPos( pos ); |
332 iButtonLayout->SetPos( pos ); |
329 iButtonContentLayout->SetPos( pos ); |
333 iButtonContentLayout->SetPos( pos ); |
330 } |
334 } |
331 |
335 |
332 Refresh(); |
336 Refresh(); |
639 TBool textClipping( ETrue ); |
643 TBool textClipping( ETrue ); |
640 CAlfTextVisual::TLineWrap textWrapping( |
644 CAlfTextVisual::TLineWrap textWrapping( |
641 CAlfTextVisual::ELineWrapTruncate ); |
645 CAlfTextVisual::ELineWrapTruncate ); |
642 |
646 |
643 const TPoint oldSize( iButtonContentLayout->Size().Target() ); |
647 const TPoint oldSize( iButtonContentLayout->Size().Target() ); |
644 |
|
645 iButtonLayout->SetFlag( EAlfVisualFlagManualSize ); |
|
646 iButtonContentLayout->SetFlag( EAlfVisualFlagManualSize ); |
|
647 |
648 |
648 switch( iButtonModel->AutoSizeMode() ) |
649 switch( iButtonModel->AutoSizeMode() ) |
649 { |
650 { |
650 case MFsControlButtonInterface::EFsLayout: |
651 case MFsControlButtonInterface::EFsLayout: |
651 { |
652 { |
706 |
707 |
707 iButtonLayout->UpdateChildrenLayout(); |
708 iButtonLayout->UpdateChildrenLayout(); |
708 |
709 |
709 TRAP_IGNORE( UpdateElementsSizeL( iButtonModel->Type() ) ); |
710 TRAP_IGNORE( UpdateElementsSizeL( iButtonModel->Type() ) ); |
710 |
711 |
712 iButtonContentLayout->UpdateChildrenLayout(); |
|
713 |
|
711 // update text styles if needed (at least one text line) |
714 // update text styles if needed (at least one text line) |
712 const TPoint newSize( iButtonContentLayout->Size().Target() ); |
715 const TPoint newSize( iButtonContentLayout->Size().Target() ); |
713 if ( newSize != oldSize ) |
716 if ( newSize != oldSize ) |
714 { |
717 { |
715 iUpdateIconsAlign = ETrue; |
718 iUpdateIconsAlign = ETrue; |
1138 if ( supportedType ) |
1141 if ( supportedType ) |
1139 { |
1142 { |
1140 const TInt newWidth( |
1143 const TInt newWidth( |
1141 parentRect.Width() + textRect.Width() - text.iTextRect.Width() |
1144 parentRect.Width() + textRect.Width() - text.iTextRect.Width() |
1142 ); |
1145 ); |
1143 iParentLayout->SetFlags( EAlfVisualFlagLayoutUpdateNotification ); |
|
1144 return newWidth; |
1146 return newWidth; |
1145 } |
1147 } |
1146 } |
1148 } |
1147 |
1149 |
1148 if ( iButtonModel->ContainsElement( ECBElemIconA ) ) |
1150 if ( iButtonModel->ContainsElement( ECBElemIconA ) ) |
1164 // --------------------------------------------------------------------------- |
1166 // --------------------------------------------------------------------------- |
1165 // |
1167 // |
1166 void CFsControlButtonVisualiser::UpdateButtonPos() |
1168 void CFsControlButtonVisualiser::UpdateButtonPos() |
1167 { |
1169 { |
1168 FUNC_LOG; |
1170 FUNC_LOG; |
1169 iButtonLayout->SetFlag( EAlfVisualFlagManualPosition ); |
|
1170 iButtonContentLayout->SetFlag( EAlfVisualFlagManualPosition ); |
|
1171 |
|
1172 // Set position for button background and for the content. |
1171 // Set position for button background and for the content. |
1173 iButtonLayout->SetPos( iButtonModel->TopLeftPoint() ); |
1172 iButtonLayout->SetPos( iButtonModel->TopLeftPoint() ); |
1174 iButtonContentLayout->SetPos( iButtonModel->TopLeftPoint() ); |
1173 iButtonContentLayout->SetPos( iButtonModel->TopLeftPoint() ); |
1175 } |
1174 } |
1176 |
1175 |
1198 // parent. It's position is related to controlbar's rect. |
1197 // parent. It's position is related to controlbar's rect. |
1199 iconA.Move( -iconA.iTl.iX, -iconA.iTl.iY ); |
1198 iconA.Move( -iconA.iTl.iX, -iconA.iTl.iY ); |
1200 break; |
1199 break; |
1201 case ECBTypeOneLineLabelOnly: |
1200 case ECBTypeOneLineLabelOnly: |
1202 CFsLayoutManager::LayoutMetricsText( parentRect, |
1201 CFsLayoutManager::LayoutMetricsText( parentRect, |
1203 CFsLayoutManager::EFsLmMainSpFsCtrlbarDdmenuPaneT1, text, 0 ); |
1202 CFsLayoutManager::ECmailDdmenuBtn01PaneT1, text, 1 ); |
1204 text1 = text.iTextRect; |
1203 text1 = text.iTextRect; |
1205 break; |
1204 break; |
1206 case ECBTypeOneLineLabelIconA: |
1205 case ECBTypeOneLineLabelIconA: |
1207 CFsLayoutManager::LayoutMetricsRect( parentRect, |
1206 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
1208 CFsLayoutManager::EFsLmMainSpFsCtrlbarDdmenuPaneG2, |
1207 { |
1209 iconA, 0 ); |
1208 CFsLayoutManager::LayoutMetricsRect( parentRect, |
1210 CFsLayoutManager::LayoutMetricsText( parentRect, |
1209 CFsLayoutManager::ECmailDdmenuBtn02PaneG2, |
1211 CFsLayoutManager::EFsLmMainSpFsCtrlbarDdmenuPaneT1, text, 2 ); |
1210 iconA, 0 ); |
1212 text1 = text.iTextRect; |
1211 CFsLayoutManager::LayoutMetricsText( parentRect, |
1212 CFsLayoutManager::ECmailDdmenuBtn02PaneT2, |
|
1213 text, 0 ); |
|
1214 } |
|
1215 else |
|
1216 { |
|
1217 CFsLayoutManager::LayoutMetricsRect( parentRect, |
|
1218 CFsLayoutManager::ECmailDdmenuBtn01PaneG1, |
|
1219 iconA, 1 ); |
|
1220 CFsLayoutManager::LayoutMetricsText( parentRect, |
|
1221 CFsLayoutManager::ECmailDdmenuBtn01PaneT1, |
|
1222 text, 0 ); |
|
1223 } |
|
1224 text1 = text.iTextRect; |
|
1213 break; |
1225 break; |
1214 case ECBTypeOneLineLabelIconB: |
1226 case ECBTypeOneLineLabelIconB: |
1215 CFsLayoutManager::LayoutMetricsText( parentRect, |
1227 CFsLayoutManager::LayoutMetricsText( parentRect, |
1216 CFsLayoutManager::EFsLmMainSpFsCtrlbarDdmenuPaneT1, text, 1 ); |
1228 CFsLayoutManager::ECmailDdmenuBtn01PaneT1, text, 1 ); |
1217 text1 = text.iTextRect; |
1229 text1 = text.iTextRect; |
1218 CFsLayoutManager::LayoutMetricsRect( parentRect, |
1230 CFsLayoutManager::LayoutMetricsRect( parentRect, |
1219 CFsLayoutManager::EFsLmMainSpFsCtrlbarDdmenuPaneG1, |
1231 CFsLayoutManager::ECmailDdmenuBtn01PaneG2, |
1220 iconB, 0 ); |
1232 iconB, 2 ); |
1221 break; |
1233 break; |
1222 case ECBTypeOneLineLabelTwoIcons: |
1234 case ECBTypeOneLineLabelTwoIcons: |
1223 CFsLayoutManager::LayoutMetricsRect( parentRect, |
1235 CFsLayoutManager::LayoutMetricsRect( parentRect, |
1224 CFsLayoutManager::EFsLmMainSpFsCtrlbarDdmenuPaneG2, |
1236 CFsLayoutManager::ECmailDdmenuBtn01PaneG1, |
1225 iconA, 1 ); |
1237 iconA, 1 ); |
1226 CFsLayoutManager::LayoutMetricsText( parentRect, |
1238 CFsLayoutManager::LayoutMetricsText( parentRect, |
1227 CFsLayoutManager::EFsLmMainSpFsCtrlbarDdmenuPaneT1, text, 3 ); |
1239 CFsLayoutManager::ECmailDdmenuBtn01PaneT1, text, 0 ); |
1228 text1 = text.iTextRect; |
1240 text1 = text.iTextRect; |
1229 CFsLayoutManager::LayoutMetricsRect( parentRect, |
1241 CFsLayoutManager::LayoutMetricsRect( parentRect, |
1230 CFsLayoutManager::EFsLmMainSpFsCtrlbarDdmenuPaneG1, |
1242 CFsLayoutManager::ECmailDdmenuBtn01PaneG2, |
1231 iconB, 1 ); |
1243 iconB, 1 ); |
1232 break; |
1244 break; |
1233 default: |
1245 default: |
1234 break; |
1246 break; |
1235 } |
1247 } |
1245 iconA.SetRect( TPoint( |
1257 iconA.SetRect( TPoint( |
1246 ( buttonSize.iWidth - oldIconSize.iWidth ) / 2, |
1258 ( buttonSize.iWidth - oldIconSize.iWidth ) / 2, |
1247 ( buttonSize.iHeight - oldIconSize.iHeight ) / 2 ), |
1259 ( buttonSize.iHeight - oldIconSize.iHeight ) / 2 ), |
1248 oldIconSize ); |
1260 oldIconSize ); |
1249 } |
1261 } |
1250 iconA.SetHeight( buttonSize.iHeight ); |
|
1251 text1.SetHeight( buttonSize.iHeight ); |
|
1252 |
1262 |
1253 if ( iButtonModel->ContainsElement( ECBElemIconA ) ) |
1263 if ( iButtonModel->ContainsElement( ECBElemIconA ) ) |
1254 { |
1264 { |
1255 const TSize& size( iconA.Size() ); |
1265 const TSize& size( iconA.Size() ); |
1256 iIconAContainer->SetSize( size ); |
1266 iIconAContainer->SetSize( size ); |
1268 { |
1278 { |
1269 if ( iLabelFirstLine ) |
1279 if ( iLabelFirstLine ) |
1270 { |
1280 { |
1271 iLabelFirstLine->SetSize( text1.Size() ); |
1281 iLabelFirstLine->SetSize( text1.Size() ); |
1272 iLabelFirstLine->SetPos( text1.iTl ); |
1282 iLabelFirstLine->SetPos( text1.iTl ); |
1283 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
1284 { |
|
1285 iLabelFirstLine->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
1286 } |
|
1287 else |
|
1288 { |
|
1289 iLabelFirstLine->SetAlign( EAlfAlignHLocale, EAlfAlignVCenter ); |
|
1290 } |
|
1273 } |
1291 } |
1274 } |
1292 } |
1275 if ( iButtonModel->ContainsElement( ECBElemLabelSndLine ) ) |
1293 if ( iButtonModel->ContainsElement( ECBElemLabelSndLine ) ) |
1276 { |
1294 { |
1277 iLabelSecondLine->SetSize( text2.Size() ); |
1295 iLabelSecondLine->SetSize( text2.Size() ); |
1553 { |
1571 { |
1554 FUNC_LOG; |
1572 FUNC_LOG; |
1555 if ( iParentLayout ) |
1573 if ( iParentLayout ) |
1556 { |
1574 { |
1557 // This flag is cleared when the layout is updated. |
1575 // This flag is cleared when the layout is updated. |
1558 iParentLayout->SetFlags( EAlfVisualFlagLayoutUpdateNotification ); |
|
1559 iParentLayout->UpdateChildrenLayout(); |
1576 iParentLayout->UpdateChildrenLayout(); |
1560 } |
1577 } |
1561 } |
1578 } |
1562 |
1579 |
1563 |
1580 |