uifw/AvKon/src/AknAdaptiveSearchGrid.cpp
branchRCL_3
changeset 55 aecbbf00d063
parent 51 fcdfafb36fe7
child 56 d48ab3b357f1
equal deleted inserted replaced
51:fcdfafb36fe7 55:aecbbf00d063
    59 
    59 
    60 _LIT( KSlashOfPageIndicator, "/" );
    60 _LIT( KSlashOfPageIndicator, "/" );
    61 _LIT( KSpaceCharacter, " " );
    61 _LIT( KSpaceCharacter, " " );
    62 const TInt KCloseAndClearButtonCount = 2;  
    62 const TInt KCloseAndClearButtonCount = 2;  
    63 
    63 
       
    64    
    64 // ============================ MEMBER FUNCTIONS ===============================
    65 // ============================ MEMBER FUNCTIONS ===============================
    65 
    66 
    66 // -----------------------------------------------------------------------------
    67 // -----------------------------------------------------------------------------
    67 // CAknAdaptiveSearchGrid::NewL()
    68 // CAknAdaptiveSearchGrid::NewL()
    68 // Two-phased constructor.
    69 // Two-phased constructor.
   122 //
   123 //
   123 CAknAdaptiveSearchGrid::~CAknAdaptiveSearchGrid()
   124 CAknAdaptiveSearchGrid::~CAknAdaptiveSearchGrid()
   124     { 
   125     { 
   125     _AKNTRACE_FUNC_ENTER;
   126     _AKNTRACE_FUNC_ENTER;
   126     CEikonEnv::Static()->EikAppUi()->RemoveFromStack( this );
   127     CEikonEnv::Static()->EikAppUi()->RemoveFromStack( this );
   127     if ( iBgContextOfControlPane )
   128     delete iBgContextOfFindPane;
   128     	{
   129     delete iBgContextOfControlPane;
   129 		delete iBgContextOfControlPane;
   130     delete iSkinContextOfFindPane; 
   130 		iBgContextOfControlPane = NULL;
   131     delete iInputFrame;
   131     	}
   132  
   132     // Clear current region of AS
   133     // Clear current region of AS
   133     iCurrentRegion.Clear();    
   134     iCurrentRegion.Clear();    
   134     iButtonArray.ResetAndDestroy();
   135     iButtonArray.ResetAndDestroy();
   135     
   136     
       
   137     if ( iEditor )
       
   138         {
       
   139         TRAP_IGNORE(iEditor->TextView()->SetCursorVisibilityL( 
       
   140             TCursor::EFCursorInvisible, TCursor::EFCursorInvisible ));
       
   141         delete iEditor;
       
   142         }   
   136     if( iGridChars )
   143     if( iGridChars )
   137         {
   144         {
   138         delete iGridChars;
   145         delete iGridChars;
   139         iGridChars = NULL;
   146         iGridChars = NULL;
   140         }               
   147         }               
   162         {
   169         {
   163         delete iPageIndicator;
   170         delete iPageIndicator;
   164         iPageIndicator = NULL;
   171         iPageIndicator = NULL;
   165         }
   172         }
   166        
   173        
   167     if ( iAppUi )
   174     CAknWsEventMonitor* eventMonitor = iAppUi->EventMonitor();    
   168         {
   175     eventMonitor->Enable( EFalse ); 
   169         CAknWsEventMonitor* eventMonitor = iAppUi->EventMonitor();  
   176     eventMonitor->RemoveObserver( this ); 
   170         eventMonitor->Enable( EFalse ); 
       
   171         eventMonitor->RemoveObserver( this ); 
       
   172         }
       
   173     _AKNTRACE_FUNC_EXIT;
   177     _AKNTRACE_FUNC_EXIT;
   174     }
   178     }
   175 
   179 
   176 // -----------------------------------------------------------------------------
   180 // -----------------------------------------------------------------------------
   177 // CAknAdaptiveSearchGrid::ConstructL()
   181 // CAknAdaptiveSearchGrid::ConstructL()
   192         if ( err == KErrNone )
   196         if ( err == KErrNone )
   193             {
   197             {
   194             Window().SetBackgroundColor(~0);
   198             Window().SetBackgroundColor(~0);
   195             }
   199             }
   196         }        
   200         }        
   197     Window().SetPointerGrab( ETrue );
       
   198 
   201 
   199     CAknWsEventMonitor* eventMonitor = iAppUi->EventMonitor();    
   202     CAknWsEventMonitor* eventMonitor = iAppUi->EventMonitor();    
   200     eventMonitor->AddObserverL( this );
   203     eventMonitor->AddObserverL( this );
   201     eventMonitor->Enable();
   204     eventMonitor->Enable();
   202     
   205     
       
   206     iSkinContextOfFindPane = CAknsListBoxBackgroundControlContext::NewL( KAknsIIDQsnBgAreaControlPopup, 
       
   207                                                                          TRect(0,0,0,0), 
       
   208                                                                          EFalse, 
       
   209                                                                          KAknsIIDNone, 
       
   210                                                                          TRect(0,0,0,0) );   
       
   211     iBgContextOfFindPane = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrInput, 
       
   212                                                                      TRect(0,0,0,0), 
       
   213                                                                      TRect(0,0,0,0), 
       
   214                                                                      EFalse );    
   203     iBgContextOfControlPane = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQgnGrafAdaptSearchPageBg, 
   215     iBgContextOfControlPane = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQgnGrafAdaptSearchPageBg, 
   204                                                                         TRect(0,0,0,0), EFalse );          
   216                                                                         TRect(0,0,0,0), EFalse );          
   205     // Init components
   217     // Init components
   206     InitControlsL( aFieldStyle );
   218     InitControlsL( aFieldStyle );
   207     InitGrid();   
   219     InitGrid();   
   264         case CAknSearchField::EPopupAdaptiveSearchWindow:
   276         case CAknSearchField::EPopupAdaptiveSearchWindow:
   265             flags |= CAknInputFrame::EPopupWindowLayout;
   277             flags |= CAknInputFrame::EPopupWindowLayout;
   266             flags |= CAknInputFrame::EFixedFindWithoutLine;
   278             flags |= CAknInputFrame::EFixedFindWithoutLine;
   267             break;
   279             break;
   268         }
   280         }
       
   281     iEditor = new (ELeave) CEikEdwin;   
       
   282     
       
   283     iInputFrame = CAknInputFrame::NewL( iEditor, 
       
   284                                         EFalse, 
       
   285                                         KAvkonBitmapFile, 
       
   286                                         EMbmAvkonQgn_indi_find_glass, 
       
   287                                         EMbmAvkonQgn_indi_find_glass_mask, 
       
   288                                         flags );                     
       
   289 
       
   290     iEditor->SetContainerWindowL( *this );
       
   291     iInputFrame->SetContainerWindowL( *this );
       
   292     
       
   293     AknEditUtils::ConstructEditingL( iEditor,
       
   294                                      iTextLimit,
       
   295                                      1,
       
   296                                      EAknEditorCharactersLowerCase,
       
   297                                      EAknEditorAlignLeft,
       
   298                                      EFalse,
       
   299                                      ETrue,
       
   300                                      EFalse );
       
   301     iEditor->SetObserver( this );
       
   302     iEditor->SetBorder( TGulBorder::ENone );
       
   303     iEditor->SetAknEditorInputMode( EAknEditorTextInputMode );
       
   304     iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode |
       
   305                                             EAknEditorNumericInputMode ); 
       
   306     iEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB );
       
   307     
       
   308     if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
       
   309         {
       
   310         iEditor->SetAknEditorPermittedCaseModes( EAknEditorCharactersLowerCase );
       
   311         }
       
   312 
       
   313     TInt editorFlags = EAknEditorFlagNoT9 | 
       
   314                        EAknEditorFlagNoLRNavigation |
       
   315                        EAknEditorFlagForceTransparentFepModes |
       
   316                        EAknEditorFlagNoEditIndicators |
       
   317                        EAknEditorFlagFindPane;
       
   318 
       
   319     iEditor->SetAknEditorFlags( editorFlags );
       
   320     iEditor->CreateTextViewL(); 
       
   321 
       
   322     iInputFrame->SetInputContext( iBgContextOfFindPane );
       
   323     iEditor->SetSkinBackgroundControlContextL( iBgContextOfFindPane );
       
   324   
       
   325     TRgb textColor = KRgbBlack;
       
   326     TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), 
       
   327                                             textColor, 
       
   328                                             KAknsIIDQsnTextColors, 
       
   329                                             EAknsCIQsnTextColorsCG19);
       
   330     if( !error )
       
   331         {
       
   332         TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL(*iEditor, EColorLabelText, textColor) );       
       
   333         }   
   269     
   334     
   270     // Create label for page indicator
   335     // Create label for page indicator
   271     iPageIndicator = new (ELeave) CEikLabel;
   336     iPageIndicator = new (ELeave) CEikLabel;
   272     iPageIndicator->SetObserver( this );
   337     iPageIndicator->SetObserver( this );
   273     iPageIndicator->SetContainerWindowL( *this );
   338     iPageIndicator->SetContainerWindowL( *this );
   342 // Update layout variant. This should be done when 
   407 // Update layout variant. This should be done when 
   343 // KEikDynamicLayoutVariantSwitch message recieved. 
   408 // KEikDynamicLayoutVariantSwitch message recieved. 
   344 // -----------------------------------------------------------------------------
   409 // -----------------------------------------------------------------------------
   345 // 
   410 // 
   346 void CAknAdaptiveSearchGrid::UpdateLayoutVariant()
   411 void CAknAdaptiveSearchGrid::UpdateLayoutVariant()
   347 	{
   412     {
   348     _AKNTRACE_FUNC_ENTER;
   413     _AKNTRACE_FUNC_ENTER;
   349 	InitGrid(); 
   414     InitGrid(); 
   350 	UpdatePageAndRowCount();       	         
   415     UpdatePageAndRowCount();                 
   351 	if( IsShown() )
   416     if( IsShown() )
   352 		{
   417         {
   353 		ControlsPositions();
   418         ControlsPositions();
   354 		TRAP_IGNORE( UpdateVisibleButtonsL() );  
   419         TRAP_IGNORE( UpdateVisibleButtonsL() );  
   355 		ShowControls();           
   420         ShowControls();           
   356 		}
   421         }
   357     _AKNTRACE_FUNC_EXIT;
   422     _AKNTRACE_FUNC_EXIT;
   358 	}
   423     }
   359 
   424 
   360 // -----------------------------------------------------------------------------
   425 // -----------------------------------------------------------------------------
   361 // CAknAdaptiveSearchGrid::UpdateSkinL()
   426 // CAknAdaptiveSearchGrid::UpdateSkinL()
   362 // Update adaptive search grid skin. This should be done when 
   427 // Update adaptive search grid skin. This should be done when 
   363 // KAknsMessageSkinChange message recieved. 
   428 // KAknsMessageSkinChange message recieved. 
   364 // -----------------------------------------------------------------------------
   429 // -----------------------------------------------------------------------------
   365 //  
   430 //  
   366 void CAknAdaptiveSearchGrid::UpdateSkinL()
   431 void CAknAdaptiveSearchGrid::UpdateSkinL()
   367 	{
   432     {
   368     CGulIcon* gulIcon = NULL;
   433     CGulIcon* gulIcon = NULL;
   369     gulIcon = GetColorIconL( 0 );        
   434     gulIcon = GetColorIconL( 0 );        
   370     iCloseButton->State()->SetIcon( gulIcon );
   435     iCloseButton->State()->SetIcon( gulIcon );
   371     CGulIcon* gulIcon1 = NULL;
   436     CGulIcon* gulIcon1 = NULL;
   372     gulIcon1 = GetColorIconL( 1 );        
   437     gulIcon1 = GetColorIconL( 1 );        
   373     iDeleteButton->State()->SetIcon( gulIcon1 );
   438     iDeleteButton->State()->SetIcon( gulIcon1 );
   374     CGulIcon* gulIcon2 = NULL;
   439     CGulIcon* gulIcon2 = NULL;
   375     gulIcon2 = GetColorIconL( 2 );        
   440     gulIcon2 = GetColorIconL( 2 );        
   376 	iPrevButton->State()->SetIcon( gulIcon2 );		
   441     iPrevButton->State()->SetIcon( gulIcon2 );      
   377     CGulIcon* gulIcon3 = NULL;
   442     CGulIcon* gulIcon3 = NULL;
   378     gulIcon3 = GetColorIconL( 3 );        
   443     gulIcon3 = GetColorIconL( 3 );        
   379     iNextButton->State()->SetIcon( gulIcon3 );
   444     iNextButton->State()->SetIcon( gulIcon3 );
   380     
   445     
   381    	UpdateVisibleButtonsL();	 	    		    
   446     UpdateVisibleButtonsL();                        
   382 	    
   447         
   383     if( iNumOfPages > 1 )
   448     if( iNumOfPages > 1 )
   384 		{	
   449         {   
   385 		// Page pane & page indicator	
   450         // Page pane & page indicator   
   386     	TRect page_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::afind_page_pane( iLayoutOption) );	
   451         TRect page_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::afind_page_pane( iLayoutOption) );    
   387     	if( AknsUtils::AvkonSkinEnabled() )
   452         if( AknsUtils::AvkonSkinEnabled() )
   388 	        {	        
   453             {           
   389 	        TRgb textColor = KRgbBlack; 
   454             TRgb textColor = KRgbBlack; 
   390     	    TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), 
   455             TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), 
   391     	                                            textColor, 
   456                                                     textColor, 
   392     	                                            KAknsIIDQsnTextColors, 
   457                                                     KAknsIIDQsnTextColors, 
   393     	                                            EAknsCIQsnTextColorsCG19);
   458                                                     EAknsCIQsnTextColorsCG19);
   394     	    if( !error )        	        
   459             if( !error )                    
   395     	        AknLayoutUtils::OverrideControlColorL(*iPageIndicator, EColorLabelText, textColor);         	                           
   460                 AknLayoutUtils::OverrideControlColorL(*iPageIndicator, EColorLabelText, textColor);                                        
   396 		    }			    
   461             }               
   397 		iBgContextOfControlPane->SetRect( page_pane );     
   462         iBgContextOfControlPane->SetRect( page_pane );     
   398 		}
   463         }
   399 	}
   464     }
   400 // CAknAdaptiveSearchGrid::InitGridButtons()
   465 // CAknAdaptiveSearchGrid::InitGridButtons()
   401 // Initiates buttons array of the adaptive search grid.
   466 // Initiates buttons array of the adaptive search grid.
   402 // iTotalGridButtons should be calculated in advance by caling InitGrid() 
   467 // iTotalGridButtons should be calculated in advance by caling InitGrid() 
   403 // -----------------------------------------------------------------------------
   468 // -----------------------------------------------------------------------------
   404 //
   469 //
   429         button->SetObserver( this );        
   494         button->SetObserver( this );        
   430         button->SetContainerWindowL( *this ); 
   495         button->SetContainerWindowL( *this ); 
   431         button->SetBackground(this);
   496         button->SetBackground(this);
   432         button->SetTextColorIds( KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG65 );
   497         button->SetTextColorIds( KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG65 );
   433         button->ActivateL();
   498         button->ActivateL();
   434         button->MakeVisible( EFalse );
       
   435         return button;
   499         return button;
   436         }
   500         }
   437     else
   501     else
   438         {
   502         {
   439         CleanupStack::PopAndDestroy( button );
   503         CleanupStack::PopAndDestroy( button );
   464     {  
   528     {  
   465     TInt layout_option;
   529     TInt layout_option;
   466            
   530            
   467     if( Layout_Meta_Data::IsLandscapeOrientation() )
   531     if( Layout_Meta_Data::IsLandscapeOrientation() )
   468         {
   532         {
       
   533         CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();
   469         iLayoutOption = KLandscapeSinglePage; 
   534         iLayoutOption = KLandscapeSinglePage; 
   470         layout_option = KLandscapeMaxSize;
   535         layout_option = KLandscapeMaxSize;
   471         iToolbarShown = EFalse;
   536         if ( toolbar && toolbar->IsShown() )
       
   537              iToolbarShown = ETrue;
       
   538         else
       
   539             iToolbarShown = EFalse;
   472         }
   540         }
   473     else
   541     else
   474         {        
   542         {        
   475         CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();
   543         CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();
   476         iLayoutOption = KPortraitSinglePage;
   544         iLayoutOption = KPortraitSinglePage;
   497         {
   565         {
   498         TRect controlPaneRect;
   566         TRect controlPaneRect;
   499         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EControlPane,
   567         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EControlPane,
   500                                            controlPaneRect );
   568                                            controlPaneRect );
   501         currentWindowRect.iBr.iY = controlPaneRect.iTl.iY;
   569         currentWindowRect.iBr.iY = controlPaneRect.iTl.iY;
       
   570         
       
   571         TRect mainPaneRect;
       
   572         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   573                                            mainPaneRect );
       
   574         CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();   
       
   575         if ( !toolbar 
       
   576              || !toolbar->IsVisible()
       
   577              || mainPaneRect.iBr.iX <= toolbar->Position().iX 
       
   578            )
       
   579             {          
       
   580             currentWindowRect.iBr.iX = mainPaneRect.iBr.iX;
       
   581             }
   502         }
   582         }
   503         
   583         
   504     TRect grid_pane = RectFromLayout( currentWindowRect, AknLayoutScalable_Apps::grid_afind_pane( iLayoutOption ) );
   584     TRect grid_pane = RectFromLayout( currentWindowRect, AknLayoutScalable_Apps::grid_afind_pane( iLayoutOption ) );
   505     TRect button_rect = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane( iLayoutOption, 0, 0 ) );  
   585     TRect button_rect = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane( iLayoutOption, 0, 0 ) );  
   506     TSize button_rect_size = button_rect.Size();
   586     TSize button_rect_size = button_rect.Size();
   532 //    
   612 //    
   533 void CAknAdaptiveSearchGrid::Draw( CWindowGc& aGc, const CCoeControl& /*aControl*/, 
   613 void CAknAdaptiveSearchGrid::Draw( CWindowGc& aGc, const CCoeControl& /*aControl*/, 
   534          const TRect& aRect ) const 
   614          const TRect& aRect ) const 
   535     {
   615     {
   536     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   616     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   537 
   617     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); 
   538     TRgb color;
   618     aGc.SetBrushColor( KRgbWhite );
   539     TInt error = AknsUtils::GetCachedColor(skin, color, KAknsIIDFsTextColors, 
   619     aGc.SetPenColor( KRgbBlack );
   540         		   EAknsCIFsTextColorsCG3 );
       
   541     if( error == KErrNone )
       
   542         {
       
   543         aGc.SetBrushColor( color );
       
   544         aGc.SetPenColor( color );
       
   545         }
       
   546     else
       
   547         {
       
   548         aGc.SetBrushColor( KRgbWhite );
       
   549         aGc.SetPenColor( KRgbBlack );
       
   550         }
       
   551     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   620     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   552     aGc.DrawRect( aRect );   
   621     aGc.DrawRect( aRect );   
   553     }
   622     }
   554 
   623 
   555 // -----------------------------------------------------------------------------
   624 // -----------------------------------------------------------------------------
   582     InitGridButtons();       
   651     InitGridButtons();       
   583     GridButtonsPositions();      
   652     GridButtonsPositions();      
   584     }
   653     }
   585 
   654 
   586 // -----------------------------------------------------------------------------
   655 // -----------------------------------------------------------------------------
       
   656 // CAknAdaptiveSearchGrid::MopSupplyObject
       
   657 // Retrieves an object of the same type as that encapsulated in aId.
       
   658 // -----------------------------------------------------------------------------
       
   659 //    
       
   660 TTypeUid::Ptr CAknAdaptiveSearchGrid::MopSupplyObject( TTypeUid aId )
       
   661     {
       
   662     if ( aId.iUid == MAknsControlContext::ETypeId && iSkinContextOfFindPane )
       
   663         {
       
   664         return MAknsControlContext::SupplyMopObject( aId, iSkinContextOfFindPane );
       
   665         }
       
   666     return MAknsControlContext::SupplyMopObject( aId, NULL );
       
   667     }
       
   668 
       
   669 // -----------------------------------------------------------------------------
   587 // CAknAdaptiveSearchGrid::CountComponentControls
   670 // CAknAdaptiveSearchGrid::CountComponentControls
   588 // Gets the number of controls contained in a compound control.
   671 // Gets the number of controls contained in a compound control.
   589 // -----------------------------------------------------------------------------
   672 // -----------------------------------------------------------------------------
   590 //   
   673 //   
   591 TInt CAknAdaptiveSearchGrid::CountComponentControls() const
   674 TInt CAknAdaptiveSearchGrid::CountComponentControls() const
   592     {
   675     {
   593     // buttons + controls    
   676     // buttons + controls + search field ( editor, input frame )    
   594     return iButtonArray.Count()+5;
   677     return iButtonArray.Count()+5+2; 
   595     } 
   678     } 
   596 
   679 
       
   680 // -----------------------------------------------------------------------------
       
   681 // Sets text into search field.
       
   682 // Gets one parameters:
       
   683 // const TDesC& aSearchTxt      - Reference to the text buffer.
       
   684 // -----------------------------------------------------------------------------      
       
   685 //                   
       
   686 void CAknAdaptiveSearchGrid::SetSearchTextToFindPane( const TDesC& aSearchTxt )
       
   687     { 
       
   688     _AKNDEBUG(
       
   689                _LIT( KClassName, "CAknAdaptiveSearchGrid" );
       
   690                _LIT( KFunctionName, "SetSearchTextToFindPane" );
       
   691                _LIT( KFormat, "[%S][%S] search text is: %S");
       
   692                _AKNTRACE( KFormat, 
       
   693                &KClassName, &KFunctionName, &aSearchTxt );
       
   694                );
       
   695 
       
   696     TRAP_IGNORE( iEditor->SetTextL( &aSearchTxt ) );
       
   697     if ( iShown )
       
   698         {
       
   699         TRAP_IGNORE(iEditor->TextView()->SetCursorVisibilityL( TCursor::EFCursorFlashing,
       
   700                                                            TCursor::EFCursorFlashing ));
       
   701         }
       
   702     TInt curPos = iEditor->TextLength(); 
       
   703     //This set selection all off
       
   704     TRAP_IGNORE( iEditor->SetSelectionL( curPos, curPos ) ); 
       
   705     iEditor->DrawNow();
       
   706     } 
       
   707     
   597 // -----------------------------------------------------------------------------
   708 // -----------------------------------------------------------------------------
   598 // CAknAdaptiveSearchGrid::ComponentControlh
   709 // CAknAdaptiveSearchGrid::ComponentControlh
   599 // Gets the specified component of a compound control.
   710 // Gets the specified component of a compound control.
   600 // -----------------------------------------------------------------------------
   711 // -----------------------------------------------------------------------------
   601 //    
   712 //    
   617                 return iCloseButton;
   728                 return iCloseButton;
   618             case 3: 
   729             case 3: 
   619                 return iDeleteButton;
   730                 return iDeleteButton;
   620             case 4:
   731             case 4:
   621                 return iPageIndicator;
   732                 return iPageIndicator;
       
   733             case 5:
       
   734                 return iInputFrame; 
       
   735             case 6:
       
   736                 return iEditor;                             
   622             default:
   737             default:
   623                 return NULL;
   738                 return NULL;
   624             }
   739             }
   625         }
   740         }
   626     }   
   741     }   
   629 // CAknAdaptiveSearchGrid::SetAdaptiveSearchGridVisibility
   744 // CAknAdaptiveSearchGrid::SetAdaptiveSearchGridVisibility
   630 // Shows or hides grid.
   745 // Shows or hides grid.
   631 // The position of the top left corner should be set in advance.
   746 // The position of the top left corner should be set in advance.
   632 // -----------------------------------------------------------------------------
   747 // -----------------------------------------------------------------------------
   633 //
   748 //
   634 void CAknAdaptiveSearchGrid::SetVisibilityL( TBool aVisible, TBool /*aSelectAll*/ )
   749 void CAknAdaptiveSearchGrid::SetVisibilityL( TBool aVisible, TBool aSelectAll )
   635     {
   750     {
   636     _AKNTRACE( "[%s][%s] Visible : %d", "CAknAdaptiveSearchGrid", __FUNCTION__, aVisible );
   751     _AKNTRACE( "[%s][%s] Visible : %d", "CAknAdaptiveSearchGrid", __FUNCTION__, aVisible );
   637     if ( aVisible )
   752     if ( aVisible )
   638         {      
   753         {      
   639         SetFocus( ETrue);  
   754         SetFocus( ETrue);  
   640         iCurrentPage = 1;
   755         iCurrentPage = 1;
   641         ShowL();
   756         ShowL();
       
   757         if ( iEditor )
       
   758             {
       
   759             iEditor->SetFocus( ETrue );
       
   760             TInt curPos = iEditor->TextLength(); 
       
   761             iEditor->SetCursorPosL( curPos, EFalse );
       
   762             if ( aSelectAll) 
       
   763                 {
       
   764                 iEditor->SelectAllL();
       
   765                 }
       
   766             }    
   642         }
   767         }
   643     else
   768     else
   644         {
   769         {
   645         HideL();
   770         HideL();
   646         }    
   771         }    
   723 void CAknAdaptiveSearchGrid::ControlsPositions()
   848 void CAknAdaptiveSearchGrid::ControlsPositions()
   724     {
   849     {
   725     TRect cell_pane; 
   850     TRect cell_pane; 
   726     
   851     
   727     TRect grid_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::grid_afind_pane( iLayoutOption ) );   
   852     TRect grid_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::grid_afind_pane( iLayoutOption ) );   
       
   853     TRect find_pane; 
       
   854      
       
   855     if(iPopupFindpane)
       
   856         {
       
   857         find_pane = RectFromLayout( Rect(), AknLayoutScalable_Avkon::popup_find_window() );
       
   858         }
       
   859     else
       
   860         {
       
   861         find_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::find_pane_cp01( iLayoutOption ) );
       
   862         } 
       
   863     _AKNTRACE( "[%s][%s] rect of find pane is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
       
   864             find_pane.iTl.iX, find_pane.iTl.iY, find_pane.iBr.iX, find_pane.iBr.iY );   
       
   865     iInputFrame->SetRect( find_pane ); 
       
   866     iSkinContextOfFindPane->SetRect( find_pane );        
   728    
   867    
   729     // Backspace and close buttons
   868     // Backspace and close buttons
   730     cell_pane = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane(iLayoutOption, iNumOfCols-2, iNumOfRows-1) );        
   869     cell_pane = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane(iLayoutOption, iNumOfCols-2, iNumOfRows-1) );        
   731    
   870    
   732     // For ELJG-7VC8Q2, move delete button up
   871     // For ELJG-7VC8Q2, move delete button up
   734         {
   873         {
   735         cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*iNumOfRows;          
   874         cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*iNumOfRows;          
   736         cell_pane.iTl.iY = cell_pane.iTl.iY - iOverlapLength*(iNumOfRows-1); 
   875         cell_pane.iTl.iY = cell_pane.iTl.iY - iOverlapLength*(iNumOfRows-1); 
   737         }
   876         }
   738      _AKNTRACE( "[%s][%s] rect of delete button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   877      _AKNTRACE( "[%s][%s] rect of delete button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   739     		cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   878             cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   740     iDeleteButton->SetRect( cell_pane );    
   879     iDeleteButton->SetRect( cell_pane );    
   741     cell_pane = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane(iLayoutOption, iNumOfCols-1, iNumOfRows-1) );        
   880     cell_pane = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane(iLayoutOption, iNumOfCols-1, iNumOfRows-1) );        
   742    
   881    
   743     // For ELJG-7VC8Q2, move close button up
   882     // For ELJG-7VC8Q2, move close button up
   744     if(iPopupFindpane && ( iLayoutOption == KPortraitSinglePage ||iLayoutOption == KLandscapeSinglePage))
   883     if(iPopupFindpane && ( iLayoutOption == KPortraitSinglePage ||iLayoutOption == KLandscapeSinglePage))
   746         cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*iNumOfRows;          
   885         cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*iNumOfRows;          
   747         cell_pane.iTl.iY = cell_pane.iTl.iY - iOverlapLength*(iNumOfRows-1); 
   886         cell_pane.iTl.iY = cell_pane.iTl.iY - iOverlapLength*(iNumOfRows-1); 
   748         }
   887         }
   749 
   888 
   750      _AKNTRACE( "[%s][%s] rect of close button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   889      _AKNTRACE( "[%s][%s] rect of close button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   751         		cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   890                 cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   752     iCloseButton->SetRect( cell_pane ); 
   891     iCloseButton->SetRect( cell_pane ); 
   753 
   892 
   754     // For ELJG-7VC8Q2, Move all the buttons up when there is only one page
   893     // For ELJG-7VC8Q2, Move all the buttons up when there is only one page
   755     if(iPopupFindpane)
   894     if(iPopupFindpane)
   756         {
   895         {
   759             {
   898             {
   760             for ( TInt i = 0; i < iNumOfCols; i++ ) 
   899             for ( TInt i = 0; i < iNumOfCols; i++ ) 
   761                 {
   900                 {
   762                 cell_pane = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane( iLayoutOption, i, j ) );             
   901                 cell_pane = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane( iLayoutOption, i, j ) );             
   763                 if(iLayoutOption == KPortraitSinglePage ||iLayoutOption == KLandscapeSinglePage )   
   902                 if(iLayoutOption == KPortraitSinglePage ||iLayoutOption == KLandscapeSinglePage )   
   764             	    {
   903                     {
   765                     cell_pane.iTl.iY -=iOverlapLength*j;
   904                     cell_pane.iTl.iY -=iOverlapLength*j;
   766                     cell_pane.iBr.iY -=iOverlapLength*(j+1); 
   905                     cell_pane.iBr.iY -=iOverlapLength*(j+1); 
   767             	    }
   906                     }
   768                 iButtonArray[temp]->SetRect( cell_pane );
   907                 iButtonArray[temp]->SetRect( cell_pane );
   769                 temp++;
   908                 temp++;
   770                 }               
   909                 }               
   771             } 
   910             } 
   772     	}
   911         }
   773 
   912 
   774    
   913    
   775     if ( Layout_Meta_Data::IsLandscapeOrientation() && AknLayoutUtils::LayoutMirrored() )
   914     if ( Layout_Meta_Data::IsLandscapeOrientation() && AknLayoutUtils::LayoutMirrored() )
   776         {
   915         {
   777         SetCornerAndSize( EHLeftVTop, Rect().Size()); 
   916         SetCornerAndSize( EHLeftVTop, Rect().Size()); 
   789                 {
   928                 {
   790                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   929                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   791                 }
   930                 }
   792 
   931 
   793             _AKNTRACE( "[%s][%s] rect of delete button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   932             _AKNTRACE( "[%s][%s] rect of delete button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   794                 		cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY ); 
   933                         cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY ); 
   795             iDeleteButton->SetRect( cell_pane );        
   934             iDeleteButton->SetRect( cell_pane );        
   796             cell_pane = RectFromLayout( cont_pane, AknLayoutScalable_Apps::cell_afind_grid_control_pane(0,1) ); 
   935             cell_pane = RectFromLayout( cont_pane, AknLayoutScalable_Apps::cell_afind_grid_control_pane(0,1) ); 
   797 
   936 
   798             // For ELJG-7VC8Q2, Move close button up
   937             // For ELJG-7VC8Q2, Move close button up
   799             if(iPopupFindpane)
   938             if(iPopupFindpane)
   800                 {
   939                 {
   801                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);      	
   940                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);        
   802                 }
   941                 }
   803 
   942 
   804             _AKNTRACE( "[%s][%s] rect of close button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   943             _AKNTRACE( "[%s][%s] rect of close button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   805                 		cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   944                         cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   806             iCloseButton->SetRect( cell_pane );         
   945             iCloseButton->SetRect( cell_pane );         
   807             }
   946             }
   808         // Page pane    
   947         // Page pane    
   809         TRect page_pane;       
   948         TRect page_pane;       
   810         page_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::afind_page_pane( iLayoutOption) );  
   949         page_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::afind_page_pane( iLayoutOption) );  
   811         _AKNTRACE( "[%s][%s] rect of page pane is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   950         _AKNTRACE( "[%s][%s] rect of page pane is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   812         		page_pane.iTl.iX, page_pane.iTl.iY, page_pane.iBr.iX, page_pane.iBr.iY );
   951                 page_pane.iTl.iX, page_pane.iTl.iY, page_pane.iBr.iX, page_pane.iBr.iY );
   813         AknLayoutUtils::LayoutLabel( iPageIndicator, Rect(), 
   952         AknLayoutUtils::LayoutLabel( iPageIndicator, Rect(), 
   814         TAknWindowComponentLayout::ComposeText( AknLayoutScalable_Apps::afind_page_pane( iLayoutOption ), 
   953         TAknWindowComponentLayout::ComposeText( AknLayoutScalable_Apps::afind_page_pane( iLayoutOption ), 
   815         AknLayoutScalable_Apps::afind_page_pane_t1() ).LayoutLine() );
   954         AknLayoutScalable_Apps::afind_page_pane_t1() ).LayoutLine() );
   816         
   955         
   817         // Next and previous buttons
   956         // Next and previous buttons
   823             if(iPopupFindpane)
   962             if(iPopupFindpane)
   824                 {
   963                 {
   825                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   964                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   826                 }
   965                 }
   827             _AKNTRACE( "[%s][%s] rect of pre page button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   966             _AKNTRACE( "[%s][%s] rect of pre page button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   828                            		cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   967                                 cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   829             iPrevButton->SetRect( cell_pane );
   968             iPrevButton->SetRect( cell_pane );
   830             cell_pane = RectFromLayout( page_pane, AknLayoutScalable_Apps::afind_page_pane_g3( iLayoutOption) );  
   969             cell_pane = RectFromLayout( page_pane, AknLayoutScalable_Apps::afind_page_pane_g3( iLayoutOption) );  
   831             
   970             
   832             // For ELJG-7VC8Q2, Move next button up
   971             // For ELJG-7VC8Q2, Move next button up
   833             if(iPopupFindpane)
   972             if(iPopupFindpane)
   834                 {
   973                 {
   835                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   974                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   836                 }
   975                 }
   837             _AKNTRACE( "[%s][%s] rect of next page button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   976             _AKNTRACE( "[%s][%s] rect of next page button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   838                            		cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   977                                 cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   839             iNextButton->SetRect( cell_pane );  
   978             iNextButton->SetRect( cell_pane );  
   840             }
   979             }
   841         else
   980         else
   842             {
   981             {
   843             cell_pane = RectFromLayout( page_pane, AknLayoutScalable_Apps::afind_page_pane_g2( iLayoutOption) ); 
   982             cell_pane = RectFromLayout( page_pane, AknLayoutScalable_Apps::afind_page_pane_g2( iLayoutOption) ); 
   846             if(iPopupFindpane)
   985             if(iPopupFindpane)
   847                 {
   986                 {
   848                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   987                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   849                 } 
   988                 } 
   850             _AKNTRACE( "[%s][%s] rect of next page button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   989             _AKNTRACE( "[%s][%s] rect of next page button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   851                            		cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   990                                 cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   852             iNextButton->SetRect( cell_pane );       
   991             iNextButton->SetRect( cell_pane );       
   853             cell_pane = RectFromLayout( page_pane, AknLayoutScalable_Apps::afind_page_pane_g3( iLayoutOption) ); 
   992             cell_pane = RectFromLayout( page_pane, AknLayoutScalable_Apps::afind_page_pane_g3( iLayoutOption) ); 
   854             
   993             
   855              // For ELJG-7VC8Q2, Move pre button up
   994              // For ELJG-7VC8Q2, Move pre button up
   856             if(iPopupFindpane)
   995             if(iPopupFindpane)
   857                 {
   996                 {
   858                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   997                 cell_pane.iBr.iY = cell_pane.iBr.iY - iOverlapLength*(iNumOfRows+1);
   859                 }
   998                 }
   860  
   999  
   861             _AKNTRACE( "[%s][%s] rect of pre page button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
  1000             _AKNTRACE( "[%s][%s] rect of pre page button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
   862                            		cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
  1001                                 cell_pane.iTl.iX, cell_pane.iTl.iY, cell_pane.iBr.iX, cell_pane.iBr.iY );
   863             iPrevButton->SetRect( cell_pane );   
  1002             iPrevButton->SetRect( cell_pane );   
   864             }    
  1003             }    
   865         
  1004         
   866         if( AknsUtils::AvkonSkinEnabled() )
  1005         if( AknsUtils::AvkonSkinEnabled() )
   867             {           
  1006             {           
   986         {   
  1125         {   
   987         iNextButton->MakeVisible( ETrue );  
  1126         iNextButton->MakeVisible( ETrue );  
   988         iPrevButton->MakeVisible( ETrue );          
  1127         iPrevButton->MakeVisible( ETrue );          
   989         iPageIndicator->MakeVisible( ETrue );   
  1128         iPageIndicator->MakeVisible( ETrue );   
   990         }
  1129         }
   991     if(iGridChars)
  1130     iCloseButton->MakeVisible( ETrue );
   992         {
  1131     iDeleteButton->MakeVisible( ETrue );
   993         iCloseButton->MakeVisible( ETrue );
  1132     iInputFrame->MakeVisible( ETrue ); 
   994         iDeleteButton->MakeVisible( ETrue );
  1133     iEditor->MakeVisible( ETrue );
   995         }
       
   996     else
       
   997         {
       
   998         iCloseButton->MakeVisible( EFalse );
       
   999         iDeleteButton->MakeVisible( EFalse );
       
  1000         }
       
  1001     }
  1134     }
  1002     
  1135     
  1003 // -----------------------------------------------------------------------------
  1136 // -----------------------------------------------------------------------------
  1004 // CAknAdaptiveSearchGrid::AdaptiveSearchGridShowL()
  1137 // CAknAdaptiveSearchGrid::AdaptiveSearchGridShowL()
  1005 // Makes adaptive search grid visible and activates it.
  1138 // Makes adaptive search grid visible and activates it.
  1024         
  1157         
  1025     CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();
  1158     CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();
  1026     TBool needRelayout = EFalse;
  1159     TBool needRelayout = EFalse;
  1027     if( Layout_Meta_Data::IsLandscapeOrientation())
  1160     if( Layout_Meta_Data::IsLandscapeOrientation())
  1028         {
  1161         {
  1029         if ( iLayoutOption == KPortraitMultiPage 
  1162         if ( iLayoutOption == KPortraitMultiPage || iLayoutOption == KPortraitSinglePage )
  1030                 || iLayoutOption == KPortraitSinglePage 
       
  1031                 || iFindPaneSizeChanged )
       
  1032             {       
  1163             {       
  1033             needRelayout = ETrue;
  1164             needRelayout = ETrue;
  1034             iFindPaneSizeChanged = EFalse;
  1165             }
  1035             }
  1166         else if ( toolbar && toolbar->IsVisible() && iToolbarShown == EFalse )
       
  1167             {
       
  1168             needRelayout = ETrue;
       
  1169             }
       
  1170             
  1036         }
  1171         }
  1037     else if ( iLayoutOption == KLandscapeMultiPage || iLayoutOption == KLandscapeSinglePage )
  1172     else if ( iLayoutOption == KLandscapeMultiPage || iLayoutOption == KLandscapeSinglePage )
  1038         {       
  1173         {       
  1039         needRelayout = ETrue;
  1174         needRelayout = ETrue;
  1040         }
  1175         }
  1103     _AKNTRACE_FUNC_ENTER;
  1238     _AKNTRACE_FUNC_ENTER;
  1104     if ( !iShown ) // nothing to hide
  1239     if ( !iShown ) // nothing to hide
  1105         {
  1240         {
  1106         return;
  1241         return;
  1107         }  
  1242         }  
       
  1243   
       
  1244     iEditor->TextView()->SetCursorVisibilityL( 
       
  1245         TCursor::EFCursorInvisible, TCursor::EFCursorInvisible);
       
  1246             
  1108     SetFocus( EFalse );
  1247     SetFocus( EFalse );
  1109     //fix for TSW error EKDN-7KW9P2
  1248     //fix for TSW error EKDN-7KW9P2
  1110     SetShown( EFalse );
  1249     SetShown( EFalse );
  1111             
  1250             
  1112     if( iAdaptiveSearchGridObserver )
  1251     if( iAdaptiveSearchGridObserver )
  1121 // -----------------------------------------------------------------------------
  1260 // -----------------------------------------------------------------------------
  1122 // CAknAdaptiveSearchGrid::FocusChanged
  1261 // CAknAdaptiveSearchGrid::FocusChanged
  1123 // This function is called whenever a control gains or loses focus.
  1262 // This function is called whenever a control gains or loses focus.
  1124 // -----------------------------------------------------------------------------
  1263 // -----------------------------------------------------------------------------
  1125 // 
  1264 // 
  1126 void CAknAdaptiveSearchGrid::FocusChanged( TDrawNow /*aDrawNow*/ )
  1265 void CAknAdaptiveSearchGrid::FocusChanged( TDrawNow aDrawNow )
  1127     {
  1266     {
  1128     if ( !iShown || IsNonFocusing() )
  1267     if ( !iShown || IsNonFocusing() )
  1129         {
  1268         {
  1130         return; // nothing should be done in this case 
  1269         return; // nothing should be done in this case 
  1131         }      
  1270         }      
  1132     if ( !IsFocused() && iLastFocusedButton )               
  1271     if ( !IsFocused() && iLastFocusedButton )               
  1133         iLastFocusedButton->ResetState();        
  1272         iLastFocusedButton->ResetState();        
       
  1273     
       
  1274     iInputFrame->SetFocus( IsFocused(), aDrawNow );
  1134     }        
  1275     }        
  1135         
  1276         
  1136 
  1277 
  1137 // -----------------------------------------------------------------------------
  1278 // -----------------------------------------------------------------------------
  1138 // CAknAdaptiveSearchGrid::HandleWsEventL
  1279 // CAknAdaptiveSearchGrid::HandleWsEventL
  1156     if( aEvent.Type() == EEventPointer )
  1297     if( aEvent.Type() == EEventPointer )
  1157         {     
  1298         {     
  1158         TPointerEvent& pointerEvent = *aEvent.Pointer();
  1299         TPointerEvent& pointerEvent = *aEvent.Pointer();
  1159         
  1300         
  1160         if( pointerEvent.iType == TPointerEvent::EButton1Down ) 
  1301         if( pointerEvent.iType == TPointerEvent::EButton1Down ) 
  1161             {
  1302             {     
  1162             if ( !iFindpaneRect.Contains( pointerEvent.iPosition ) &&
  1303              if( iInputFrame->Rect().Contains(pointerEvent.iPosition) || 
  1163                 aDestination != this )
  1304                 aDestination != this )
  1164                 {
  1305                 {  
       
  1306             MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1307             
       
  1308             // according to Touch UI spec tapping on input frame should cause feedback, 
       
  1309             // even if action is to cancel dialog..
       
  1310             if ( feedback )
       
  1311                 {
       
  1312                 feedback->InstantFeedback( this, ETouchFeedbackBasic );
       
  1313                 }
       
  1314                 
  1165                 HideL();
  1315                 HideL();
  1166                 return;
  1316                 return;                          
  1167                 }
  1317                 }                             
  1168             }
  1318             }   
  1169         }
  1319         }                     
  1170     }
  1320     }
  1171         
  1321         
  1172        
  1322        
  1173 // -----------------------------------------------------------------------------
  1323 // -----------------------------------------------------------------------------
  1174 // CAknAdaptiveSearchGrid::HandleControlEventL
  1324 // CAknAdaptiveSearchGrid::HandleControlEventL
  1239             {
  1389             {
  1240             break;
  1390             break;
  1241             }
  1391             }
  1242         }
  1392         }
  1243     _AKNTRACE_FUNC_EXIT;
  1393     _AKNTRACE_FUNC_EXIT;
  1244     }     
  1394     }       
  1245 
       
  1246 static CAknButton* GetButtonHelper( RPointerArray<CAknButton> &aButtonArray, TInt aIndex )
       
  1247     {
       
  1248     return ( aIndex < aButtonArray.Count() && aIndex >= 0 ) ? aButtonArray[aIndex] : NULL;
       
  1249     }
       
  1250 
  1395 
  1251 // -----------------------------------------------------------------------------
  1396 // -----------------------------------------------------------------------------
  1252 // CAknAdaptiveSearchGrid::UpdateVisibleButtonsL()
  1397 // CAknAdaptiveSearchGrid::UpdateVisibleButtonsL()
  1253 // -----------------------------------------------------------------------------
  1398 // -----------------------------------------------------------------------------
  1254 //
  1399 //
  1277 
  1422 
  1278         // Hide all the buttons at the beginning for now. 
  1423         // Hide all the buttons at the beginning for now. 
  1279         CAknButton* tmpButton = NULL;    
  1424         CAknButton* tmpButton = NULL;    
  1280         for( TInt i = 0; i < iButtonArray.Count(); i++ )
  1425         for( TInt i = 0; i < iButtonArray.Count(); i++ )
  1281             {
  1426             {
  1282             tmpButton = GetButtonHelper( iButtonArray, i );
  1427             tmpButton = static_cast<CAknButton*>( iButtonArray[i] );            
  1283             if ( NULL != tmpButton )
  1428             tmpButton->MakeVisible( EFalse );
  1284                 {
       
  1285                 tmpButton->MakeVisible( EFalse );
       
  1286                 }
       
  1287             }
  1429             }
  1288                 
  1430                 
  1289         TInt tempTotalGridButtons = iTotalGridButtons - KCloseAndClearButtonCount;               
  1431         TInt tempTotalGridButtons = iTotalGridButtons - KCloseAndClearButtonCount;               
  1290         if( iNumOfPages == 1 )
  1432         if( iNumOfPages == 1 )
  1291             {       
  1433             {       
  1292             for ( TInt i = 0; i < tempTotalGridButtons; i++ )
  1434             for ( TInt i = 0; i < tempTotalGridButtons; i++ )
  1293                 {
  1435                 {
  1294                 button = GetButtonHelper( iButtonArray, tempTotalGridButtons-i-1 );
  1436                 button = static_cast<CAknButton*>( iButtonArray[tempTotalGridButtons-i-1] );
  1295                 if ( NULL == button )
       
  1296                     {
       
  1297                     continue;
       
  1298                     }
       
  1299                 
       
  1300                 TInt charPosition = numOfChars-i-1-shift_Ind;
  1437                 TInt charPosition = numOfChars-i-1-shift_Ind;
  1301                 if ( charPosition >= 0 ) 
  1438                 if ( charPosition >= 0 ) 
  1302                     {
  1439                     {
  1303                     bState = button->State();
  1440                     bState = button->State();
  1304                     if ( ptr.Mid(charPosition, 1) == KSpaceCharacter )
  1441                     if ( ptr.Mid(charPosition, 1) == KSpaceCharacter )
  1310                         bState->SetTextL( KNullDesC );                          
  1447                         bState->SetTextL( KNullDesC );                          
  1311                         bState->SetIcon( icon );
  1448                         bState->SetIcon( icon );
  1312                         button->SetIconSize( iButtonIconSize );                                      
  1449                         button->SetIconSize( iButtonIconSize );                                      
  1313                         }
  1450                         }
  1314                     else
  1451                     else
  1315                         { 
  1452                         {
  1316                         if( bState->Icon() )
  1453                         if( bState->Icon() )
  1317                             {
  1454                             {
  1318                             bState->SetIcon( NULL );          
  1455                             bState->SetIcon( NULL );          
  1319                             }       
  1456                             }       
  1320                         // If Devanagari
  1457                         // If Devanagari
  1329                             bState->SetTextL( ptr.Mid(charPosition, 1) );
  1466                             bState->SetTextL( ptr.Mid(charPosition, 1) );
  1330                             }
  1467                             }
  1331                         }                  
  1468                         }                  
  1332                     button_rect = button->Rect();
  1469                     button_rect = button->Rect();
  1333                     _AKNTRACE( "[%s][%s] rect of button %s is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, bState->Text().Ptr(), 
  1470                     _AKNTRACE( "[%s][%s] rect of button %s is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, bState->Text().Ptr(), 
  1334                     		button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1471                             button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1335                     iCurrentRegion.AddRect( button_rect );
  1472                     iCurrentRegion.AddRect( button_rect );
  1336                     button->MakeVisible( ETrue );
  1473                     button->MakeVisible( ETrue );
  1337                     }
  1474                     }
  1338                 else
  1475                 else
  1339                     {
  1476                     {
  1367                 // last page
  1504                 // last page
  1368                 TInt charsOnLastPage = numOfChars -  numOfCharsInPrevPages; 
  1505                 TInt charsOnLastPage = numOfChars -  numOfCharsInPrevPages; 
  1369                 TInt offset = tempTotalGridButtons - charsOnLastPage;   
  1506                 TInt offset = tempTotalGridButtons - charsOnLastPage;   
  1370                 
  1507                 
  1371                 for ( TInt i = tempTotalGridButtons-1 ; i >= 0 ; --i )
  1508                 for ( TInt i = tempTotalGridButtons-1 ; i >= 0 ; --i )
  1372                     {                  
  1509                     {
  1373                     button = GetButtonHelper( iButtonArray, i+shift_Ind );
  1510                     button = static_cast<CAknButton*>(iButtonArray[i+shift_Ind]);
  1374                     if ( NULL == button )
       
  1375                         {
       
  1376                         continue;
       
  1377                         }
       
  1378                 
       
  1379                     if( i < offset )
  1511                     if( i < offset )
  1380                         {
  1512                         {
  1381                         button->MakeVisible( EFalse );                  
  1513                         button->MakeVisible( EFalse );                  
  1382                         }
  1514                         }
  1383                     else
  1515                     else
  1414                                 bState->SetTextL( ptr.Mid(CharPosition, 1));                      
  1546                                 bState->SetTextL( ptr.Mid(CharPosition, 1));                      
  1415                                 }                 
  1547                                 }                 
  1416                             }                  
  1548                             }                  
  1417                         button_rect = button->Rect();
  1549                         button_rect = button->Rect();
  1418                         _AKNTRACE( "[%s][%s] rect of button %s is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, bState->Text().Ptr(), 
  1550                         _AKNTRACE( "[%s][%s] rect of button %s is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, bState->Text().Ptr(), 
  1419                                            		button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1551                                                 button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1420                         iCurrentRegion.AddRect( button_rect );
  1552                         iCurrentRegion.AddRect( button_rect );
  1421                         button->MakeVisible( ETrue );
  1553                         button->MakeVisible( ETrue );
  1422                         }
  1554                         }
  1423                     }
  1555                     }
  1424                 }
  1556                 }
  1430                 shift_Ind = 0;
  1562                 shift_Ind = 0;
  1431 
  1563 
  1432                 for ( TInt i = 0; i < numOfChars; i++ )
  1564                 for ( TInt i = 0; i < numOfChars; i++ )
  1433                     {
  1565                     {
  1434                     if ( ( i >= start) && (i < end) )
  1566                     if ( ( i >= start) && (i < end) )
  1435                         {                      
  1567                         {   
  1436                         button = GetButtonHelper( iButtonArray, i-start-shift_Ind );
  1568                         button = static_cast<CAknButton*>(iButtonArray[i-start-shift_Ind]);
  1437                         if ( NULL == button )
       
  1438                             {
       
  1439                             continue;
       
  1440                             }
       
  1441                     
       
  1442                         bState = button->State();               
  1569                         bState = button->State();               
  1443                         if( ptr.Mid(i, 1) == KSpaceCharacter )
  1570                         if( ptr.Mid(i, 1) == KSpaceCharacter )
  1444                             {  
  1571                             {  
  1445                             // Create icon for space button                        
  1572                             // Create icon for space button                        
  1446                             icon = GetColorIconL( 4 );
  1573                             icon = GetColorIconL( 4 );
  1477                                 bState->SetTextL( ptr.Mid(i, 1) );
  1604                                 bState->SetTextL( ptr.Mid(i, 1) );
  1478                                 }
  1605                                 }
  1479                             }                  
  1606                             }                  
  1480                         button_rect = button->Rect();
  1607                         button_rect = button->Rect();
  1481                         _AKNTRACE( "[%s][%s] rect of button %s is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, bState->Text().Ptr(), 
  1608                         _AKNTRACE( "[%s][%s] rect of button %s is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, bState->Text().Ptr(), 
  1482                                            		button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1609                                                 button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1483                         iCurrentRegion.AddRect( button_rect );
  1610                         iCurrentRegion.AddRect( button_rect );
  1484                         button->MakeVisible( ETrue );
  1611                         button->MakeVisible( ETrue );
  1485                         
  1612                         
  1486                         }                   
  1613                         }                   
  1487                     }
  1614                     }
  1489                         {
  1616                         {
  1490                         tempTotalGridButtons = iTotalGridButtons;
  1617                         tempTotalGridButtons = iTotalGridButtons;
  1491                         }
  1618                         }
  1492                     for ( TInt i = tempTotalGridButtons; i < tempTotalGridButtons+iNumOfCols; i++ )
  1619                     for ( TInt i = tempTotalGridButtons; i < tempTotalGridButtons+iNumOfCols; i++ )
  1493                         {
  1620                         {
  1494                         button = GetButtonHelper( iButtonArray, i );
  1621                         button = static_cast<CAknButton*>(iButtonArray[i]);
  1495                         if ( NULL != button )
  1622                         button->MakeVisible( EFalse );  
  1496                             {
       
  1497                             button->MakeVisible( EFalse );  
       
  1498                             }
       
  1499                         
       
  1500                         }           
  1623                         }           
  1501                 }               
  1624                 }               
  1502             }        
  1625             }        
  1503         button_rect = iDeleteButton->Rect();
  1626         button_rect = iDeleteButton->Rect();
  1504         _AKNTRACE( "[%s][%s] rect of delete button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
  1627         _AKNTRACE( "[%s][%s] rect of delete button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
  1505                            		button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1628                                 button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1506         iCurrentRegion.AddRect( button_rect );
  1629         iCurrentRegion.AddRect( button_rect );
  1507         button_rect = iCloseButton->Rect();
  1630         button_rect = iCloseButton->Rect();
  1508         _AKNTRACE( "[%s][%s] rect of close button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
  1631         _AKNTRACE( "[%s][%s] rect of close button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
  1509                            		button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1632                                 button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
       
  1633         iCurrentRegion.AddRect( button_rect );
       
  1634         button_rect = iInputFrame->Rect();
       
  1635         _AKNTRACE( "[%s][%s] rect of Input Frame is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
       
  1636                                         button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY );
  1510         iCurrentRegion.AddRect( button_rect );
  1637         iCurrentRegion.AddRect( button_rect );
  1511         if( iNumOfPages > 1 )
  1638         if( iNumOfPages > 1 )
  1512             {
  1639             {
  1513             TRect page_pane;       
  1640             TRect page_pane;       
  1514             page_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::afind_page_pane(iLayoutOption) );   
  1641             page_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::afind_page_pane(iLayoutOption) );   
  1515             _AKNTRACE( "[%s][%s] rect of page pane is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
  1642             _AKNTRACE( "[%s][%s] rect of page pane is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__,
  1516             		page_pane.iTl.iX, page_pane.iTl.iY, page_pane.iBr.iX, page_pane.iBr.iY );
  1643                     page_pane.iTl.iX, page_pane.iTl.iY, page_pane.iBr.iX, page_pane.iBr.iY );
  1517             iCurrentRegion.AddRect( page_pane );
  1644             iCurrentRegion.AddRect( page_pane );
  1518             }    
  1645             }    
  1519         }
  1646         }
  1520     Window().SetShape( iCurrentRegion );
  1647     Window().SetShape( iCurrentRegion );
  1521     _AKNTRACE_FUNC_EXIT;
  1648     _AKNTRACE_FUNC_EXIT;
  1607     {    
  1734     {    
  1608     _AKNTRACE_FUNC_ENTER;
  1735     _AKNTRACE_FUNC_ENTER;
  1609     _AKNTRACE( "[%s][%s] Event Type : %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, aType );
  1736     _AKNTRACE( "[%s][%s] Event Type : %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, aType );
  1610     switch( aType )
  1737     switch( aType )
  1611         {
  1738         {
  1612     	case KEikDynamicLayoutVariantSwitch:
  1739         case KEikDynamicLayoutVariantSwitch:
  1613         	{
  1740             {
  1614         	UpdateLayoutVariant();
  1741             UpdateLayoutVariant();
  1615         	break;
  1742             break;
  1616         	}
  1743             }
  1617         case KAknsMessageSkinChange:
  1744         case KAknsMessageSkinChange:
  1618         	{
  1745             {
  1619         	TRAP_IGNORE( UpdateSkinL() );
  1746             TRAP_IGNORE( UpdateSkinL() );
  1620         	break;
  1747             break;
  1621         	}
  1748             }
  1622         default:
  1749         default:
  1623         	{
  1750             {
  1624         	break;
  1751             break;
  1625         	}
  1752             }
  1626         }
  1753         }
  1627         
  1754         
  1628     CAknControl::HandleResourceChange( aType );
  1755     CAknControl::HandleResourceChange( aType );
  1629     _AKNTRACE_FUNC_EXIT;
  1756     _AKNTRACE_FUNC_EXIT;
  1630     }
  1757     }
  1658 MAknAdaptiveSearchGridObserver* CAknAdaptiveSearchGrid::AdaptiveSearchGridObserver() 
  1785 MAknAdaptiveSearchGridObserver* CAknAdaptiveSearchGrid::AdaptiveSearchGridObserver() 
  1659     {
  1786     {
  1660     return iAdaptiveSearchGridObserver;
  1787     return iAdaptiveSearchGridObserver;
  1661     }
  1788     }
  1662         
  1789         
  1663 
       
  1664 // -----------------------------------------------------------------------------
       
  1665 // CAknAdaptiveSearch::SaveFindPaneRect()
       
  1666 // When the rect of find pane is set, this functions will be notified
       
  1667 // to record the size of it.
       
  1668 // -----------------------------------------------------------------------------
       
  1669 //
       
  1670 void CAknAdaptiveSearchGrid::SaveFindPaneRect( const TRect &aRect )
       
  1671     {
       
  1672     //When width is zero, no need to deal with.
       
  1673     if ( 0 == aRect.Size().iWidth )
       
  1674         {
       
  1675         return;
       
  1676         }
       
  1677     
       
  1678     //The same size already is set. No need to do further process.
       
  1679     if ( aRect == iFindpaneRect )
       
  1680         {
       
  1681         return;    
       
  1682         }
       
  1683 
       
  1684     iFindpaneRect = aRect;
       
  1685     iFindPaneSizeChanged = ETrue;
       
  1686     }
       
  1687 
       
  1688 // End of File
  1790 // End of File
  1689 
  1791