meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerlocationfield.cpp
branchRCL_3
changeset 80 726fba06891a
parent 64 3533d4323edc
equal deleted inserted replaced
73:c8382f7b54ef 80:726fba06891a
    54 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    55 //
    55 //
    56 CESMRViewerLocationField::~CESMRViewerLocationField()
    56 CESMRViewerLocationField::~CESMRViewerLocationField()
    57     {
    57     {
    58     delete iFieldButton;
    58     delete iFieldButton;
       
    59     delete iLockIcon;
    59     delete iWaypointIcon;
    60     delete iWaypointIcon;
    60     delete iFeatures;
    61     delete iFeatures;
    61     }
    62     }
    62 
    63 
    63 // ---------------------------------------------------------------------------
    64 // ---------------------------------------------------------------------------
   190     {
   191     {
   191 	iFieldButton = CMRButton::NewL(
   192 	iFieldButton = CMRButton::NewL(
   192 	        NMRBitmapManager::EMRBitmapLocation,
   193 	        NMRBitmapManager::EMRBitmapLocation,
   193 	        this );
   194 	        this );
   194     iFieldButton->SetObserver(this);
   195     iFieldButton->SetObserver(this);
   195 
   196 	iLockIcon = CMRImage::NewL(
       
   197 			NMRBitmapManager::EMRBitmapLockField,
       
   198 			this,
       
   199 			ETrue );
       
   200 	
   196     iRichTextViewer = CESMRRichTextViewer::NewL( this );
   201     iRichTextViewer = CESMRRichTextViewer::NewL( this );
   197     CESMRField::ConstructL( iRichTextViewer ); // ownership transfered
   202     CESMRField::ConstructL( iRichTextViewer ); // ownership transfered
   198     iRichTextViewer->SetEdwinSizeObserver( this );
   203     iRichTextViewer->SetEdwinSizeObserver( this );
   199     iRichTextViewer->SetParent( this );
   204     iRichTextViewer->SetParent( this );
   200 
   205 
   306     if ( iFieldButton )
   311     if ( iFieldButton )
   307         {
   312         {
   308         ++count;
   313         ++count;
   309         }
   314         }
   310 
   315 
       
   316     if( iWaypointIcon )
       
   317         {
       
   318         ++count;
       
   319         }
       
   320 
       
   321     if( iLockIcon )
       
   322         {
       
   323         ++count;
       
   324         }
       
   325 
   311     if ( iRichTextViewer )
   326     if ( iRichTextViewer )
   312         {
       
   313         ++count;
       
   314         }
       
   315 
       
   316     if( iWaypointIcon )
       
   317         {
   327         {
   318         ++count;
   328         ++count;
   319         }
   329         }
   320     return count;
   330     return count;
   321     }
   331     }
   329     switch ( aIndex )
   339     switch ( aIndex )
   330         {
   340         {
   331         case 0:
   341         case 0:
   332             return iFieldButton;
   342             return iFieldButton;
   333         case 1:
   343         case 1:
       
   344         	{
       
   345         	if( iWaypointIcon )
       
   346         		{
       
   347 				return iWaypointIcon;
       
   348         		}
       
   349         	else if( iLockIcon )
       
   350 				{
       
   351 				return iLockIcon;
       
   352 				}
       
   353         	else if( iRichTextViewer )
       
   354 				{
       
   355 				return iRichTextViewer;
       
   356 				}
       
   357         	}
       
   358         case 2:
       
   359         	if( iWaypointIcon && iLockIcon )
       
   360 				{
       
   361 				return iLockIcon;
       
   362 				}
       
   363 			else if( iRichTextViewer )
       
   364 				{
       
   365 				return iRichTextViewer;
       
   366 				}
       
   367         case 3:
   334             return iRichTextViewer;
   368             return iRichTextViewer;
   335         case 2:
       
   336             return iWaypointIcon;
       
   337         default:
   369         default:
   338             return NULL;
   370             return NULL;
   339         }
   371         }
   340     }
   372     }
   341 
   373 
   368         TAknWindowComponentLayout iconLayout(
   400         TAknWindowComponentLayout iconLayout(
   369                 NMRLayoutManager::GetWindowComponentLayout(
   401                 NMRLayoutManager::GetWindowComponentLayout(
   370                     NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) );
   402                     NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) );
   371         AknLayoutUtils::LayoutImage( iWaypointIcon, rowRect, iconLayout );
   403         AknLayoutUtils::LayoutImage( iWaypointIcon, rowRect, iconLayout );
   372         }
   404         }
       
   405     
       
   406     // Layouting lock icon
       
   407     if( iLockIcon && IsLocked() )
       
   408         {
       
   409         TAknWindowComponentLayout iconLayout(
       
   410                 NMRLayoutManager::GetWindowComponentLayout(
       
   411                     NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) );
       
   412         AknLayoutUtils::LayoutImage( iLockIcon, rowRect, iconLayout );
       
   413         }
   373 
   414 
   374     TAknLayoutText viewerLayoutText;
   415     TAknLayoutText viewerLayoutText;
   375 
   416 
   376     if( iWaypointIcon )
   417     if( iWaypointIcon || ( iLockIcon && IsLocked() ) )
   377         {
   418         {
   378         viewerLayoutText = NMRLayoutManager::GetLayoutText( rowRect,
   419         viewerLayoutText = NMRLayoutManager::GetLayoutText( rowRect,
   379                     NMRLayoutManager::EMRTextLayoutSingleRowEditorText );
   420                     NMRLayoutManager::EMRTextLayoutSingleRowEditorText );
   380         }
   421         }
   381     else
   422     else
   477 	if( IsLocked() )
   518 	if( IsLocked() )
   478 		{
   519 		{
   479 		return;
   520 		return;
   480 		}
   521 		}
   481 
   522 
   482 	CESMRField::LockL();
   523 	// If waypoint icon is present, let's hide that,
   483 
   524 	// because locked icon replaces it.
   484 	delete iWaypointIcon;
   525 	if( iWaypointIcon )
   485 	iWaypointIcon = NULL;
   526 		{
   486 	iWaypointIcon = CMRImage::NewL(
   527 		iWaypointIcon->MakeVisible( EFalse );
   487 	        NMRBitmapManager::EMRBitmapLockField,
   528 		}
   488 	        this,
   529 
   489 	        ETrue );
   530 	if( !iLockIcon )
   490 
   531 		{	
   491 	iWaypointIcon->SetObserver( this );
   532 		iLockIcon = CMRImage::NewL(
       
   533 				NMRBitmapManager::EMRBitmapLockField,
       
   534 				this,
       
   535 				ETrue );
       
   536 		}
       
   537 
       
   538 	iLockIcon->SetObserver( this );
   492 	}
   539 	}
   493 
   540 
   494 // ---------------------------------------------------------------------------
   541 // ---------------------------------------------------------------------------
   495 // CESMRViewerLocationField::GetCursorLineVerticalPos
   542 // CESMRViewerLocationField::GetCursorLineVerticalPos
   496 // ---------------------------------------------------------------------------
   543 // ---------------------------------------------------------------------------