122 // |
122 // |
123 CAknAdaptiveSearchGrid::~CAknAdaptiveSearchGrid() |
123 CAknAdaptiveSearchGrid::~CAknAdaptiveSearchGrid() |
124 { |
124 { |
125 _AKNTRACE_FUNC_ENTER; |
125 _AKNTRACE_FUNC_ENTER; |
126 CEikonEnv::Static()->EikAppUi()->RemoveFromStack( this ); |
126 CEikonEnv::Static()->EikAppUi()->RemoveFromStack( this ); |
127 delete iBgContextOfFindPane; |
|
128 delete iBgContextOfControlPane; |
127 delete iBgContextOfControlPane; |
129 delete iSkinContextOfFindPane; |
|
130 delete iInputFrame; |
|
131 |
128 |
132 // Clear current region of AS |
129 // Clear current region of AS |
133 iCurrentRegion.Clear(); |
130 iCurrentRegion.Clear(); |
134 iButtonArray.ResetAndDestroy(); |
131 iButtonArray.ResetAndDestroy(); |
135 |
132 |
136 if ( iEditor ) |
|
137 { |
|
138 TRAP_IGNORE(iEditor->TextView()->SetCursorVisibilityL( |
|
139 TCursor::EFCursorInvisible, TCursor::EFCursorInvisible )); |
|
140 delete iEditor; |
|
141 } |
|
142 if( iGridChars ) |
133 if( iGridChars ) |
143 { |
134 { |
144 delete iGridChars; |
135 delete iGridChars; |
145 iGridChars = NULL; |
136 iGridChars = NULL; |
146 } |
137 } |
195 if ( err == KErrNone ) |
186 if ( err == KErrNone ) |
196 { |
187 { |
197 Window().SetBackgroundColor(~0); |
188 Window().SetBackgroundColor(~0); |
198 } |
189 } |
199 } |
190 } |
|
191 Window().SetPointerGrab( ETrue ); |
200 |
192 |
201 CAknWsEventMonitor* eventMonitor = iAppUi->EventMonitor(); |
193 CAknWsEventMonitor* eventMonitor = iAppUi->EventMonitor(); |
202 eventMonitor->AddObserverL( this ); |
194 eventMonitor->AddObserverL( this ); |
203 eventMonitor->Enable(); |
195 eventMonitor->Enable(); |
204 |
196 |
205 iSkinContextOfFindPane = CAknsListBoxBackgroundControlContext::NewL( KAknsIIDQsnBgAreaControlPopup, |
|
206 TRect(0,0,0,0), |
|
207 EFalse, |
|
208 KAknsIIDNone, |
|
209 TRect(0,0,0,0) ); |
|
210 iBgContextOfFindPane = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrInput, |
|
211 TRect(0,0,0,0), |
|
212 TRect(0,0,0,0), |
|
213 EFalse ); |
|
214 iBgContextOfControlPane = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQgnGrafAdaptSearchPageBg, |
197 iBgContextOfControlPane = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQgnGrafAdaptSearchPageBg, |
215 TRect(0,0,0,0), EFalse ); |
198 TRect(0,0,0,0), EFalse ); |
216 // Init components |
199 // Init components |
217 InitControlsL( aFieldStyle ); |
200 InitControlsL( aFieldStyle ); |
218 InitGrid(); |
201 InitGrid(); |
275 case CAknSearchField::EPopupAdaptiveSearchWindow: |
258 case CAknSearchField::EPopupAdaptiveSearchWindow: |
276 flags |= CAknInputFrame::EPopupWindowLayout; |
259 flags |= CAknInputFrame::EPopupWindowLayout; |
277 flags |= CAknInputFrame::EFixedFindWithoutLine; |
260 flags |= CAknInputFrame::EFixedFindWithoutLine; |
278 break; |
261 break; |
279 } |
262 } |
280 iEditor = new (ELeave) CEikEdwin; |
|
281 |
|
282 iInputFrame = CAknInputFrame::NewL( iEditor, |
|
283 EFalse, |
|
284 KAvkonBitmapFile, |
|
285 EMbmAvkonQgn_indi_find_glass, |
|
286 EMbmAvkonQgn_indi_find_glass_mask, |
|
287 flags ); |
|
288 |
|
289 iEditor->SetContainerWindowL( *this ); |
|
290 iInputFrame->SetContainerWindowL( *this ); |
|
291 |
|
292 AknEditUtils::ConstructEditingL( iEditor, |
|
293 iTextLimit, |
|
294 1, |
|
295 EAknEditorCharactersLowerCase, |
|
296 EAknEditorAlignLeft, |
|
297 EFalse, |
|
298 ETrue, |
|
299 EFalse ); |
|
300 iEditor->SetObserver( this ); |
|
301 iEditor->SetBorder( TGulBorder::ENone ); |
|
302 iEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
|
303 iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | |
|
304 EAknEditorNumericInputMode ); |
|
305 iEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB ); |
|
306 |
|
307 if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) ) |
|
308 { |
|
309 iEditor->SetAknEditorPermittedCaseModes( EAknEditorCharactersLowerCase ); |
|
310 } |
|
311 |
|
312 TInt editorFlags = EAknEditorFlagNoT9 | |
|
313 EAknEditorFlagNoLRNavigation | |
|
314 EAknEditorFlagForceTransparentFepModes | |
|
315 EAknEditorFlagNoEditIndicators | |
|
316 EAknEditorFlagFindPane; |
|
317 |
|
318 iEditor->SetAknEditorFlags( editorFlags ); |
|
319 iEditor->CreateTextViewL(); |
|
320 |
|
321 iInputFrame->SetInputContext( iBgContextOfFindPane ); |
|
322 iEditor->SetSkinBackgroundControlContextL( iBgContextOfFindPane ); |
|
323 |
|
324 TRgb textColor = KRgbBlack; |
|
325 TInt error = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), |
|
326 textColor, |
|
327 KAknsIIDQsnTextColors, |
|
328 EAknsCIQsnTextColorsCG19); |
|
329 if( !error ) |
|
330 { |
|
331 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL(*iEditor, EColorLabelText, textColor) ); |
|
332 } |
|
333 |
263 |
334 // Create label for page indicator |
264 // Create label for page indicator |
335 iPageIndicator = new (ELeave) CEikLabel; |
265 iPageIndicator = new (ELeave) CEikLabel; |
336 iPageIndicator->SetObserver( this ); |
266 iPageIndicator->SetObserver( this ); |
337 iPageIndicator->SetContainerWindowL( *this ); |
267 iPageIndicator->SetContainerWindowL( *this ); |
650 InitGridButtons(); |
580 InitGridButtons(); |
651 GridButtonsPositions(); |
581 GridButtonsPositions(); |
652 } |
582 } |
653 |
583 |
654 // ----------------------------------------------------------------------------- |
584 // ----------------------------------------------------------------------------- |
655 // CAknAdaptiveSearchGrid::MopSupplyObject |
|
656 // Retrieves an object of the same type as that encapsulated in aId. |
|
657 // ----------------------------------------------------------------------------- |
|
658 // |
|
659 TTypeUid::Ptr CAknAdaptiveSearchGrid::MopSupplyObject( TTypeUid aId ) |
|
660 { |
|
661 if ( aId.iUid == MAknsControlContext::ETypeId && iSkinContextOfFindPane ) |
|
662 { |
|
663 return MAknsControlContext::SupplyMopObject( aId, iSkinContextOfFindPane ); |
|
664 } |
|
665 return MAknsControlContext::SupplyMopObject( aId, NULL ); |
|
666 } |
|
667 |
|
668 // ----------------------------------------------------------------------------- |
|
669 // CAknAdaptiveSearchGrid::CountComponentControls |
585 // CAknAdaptiveSearchGrid::CountComponentControls |
670 // Gets the number of controls contained in a compound control. |
586 // Gets the number of controls contained in a compound control. |
671 // ----------------------------------------------------------------------------- |
587 // ----------------------------------------------------------------------------- |
672 // |
588 // |
673 TInt CAknAdaptiveSearchGrid::CountComponentControls() const |
589 TInt CAknAdaptiveSearchGrid::CountComponentControls() const |
674 { |
590 { |
675 // buttons + controls + search field ( editor, input frame ) |
591 // buttons + controls |
676 return iButtonArray.Count()+5+2; |
592 return iButtonArray.Count()+5; |
677 } |
593 } |
678 |
594 |
679 // ----------------------------------------------------------------------------- |
|
680 // Sets text into search field. |
|
681 // Gets one parameters: |
|
682 // const TDesC& aSearchTxt - Reference to the text buffer. |
|
683 // ----------------------------------------------------------------------------- |
|
684 // |
|
685 void CAknAdaptiveSearchGrid::SetSearchTextToFindPane( const TDesC& aSearchTxt ) |
|
686 { |
|
687 _AKNDEBUG( |
|
688 _LIT( KClassName, "CAknAdaptiveSearchGrid" ); |
|
689 _LIT( KFunctionName, "SetSearchTextToFindPane" ); |
|
690 _LIT( KFormat, "[%S][%S] search text is: %S"); |
|
691 _AKNTRACE( KFormat, |
|
692 &KClassName, &KFunctionName, &aSearchTxt ); |
|
693 ); |
|
694 |
|
695 TRAP_IGNORE( iEditor->SetTextL( &aSearchTxt ) ); |
|
696 if ( iShown ) |
|
697 { |
|
698 TRAP_IGNORE(iEditor->TextView()->SetCursorVisibilityL( TCursor::EFCursorFlashing, |
|
699 TCursor::EFCursorFlashing )); |
|
700 } |
|
701 TInt curPos = iEditor->TextLength(); |
|
702 //This set selection all off |
|
703 TRAP_IGNORE( iEditor->SetSelectionL( curPos, curPos ) ); |
|
704 iEditor->DrawNow(); |
|
705 } |
|
706 |
|
707 // ----------------------------------------------------------------------------- |
595 // ----------------------------------------------------------------------------- |
708 // CAknAdaptiveSearchGrid::ComponentControlh |
596 // CAknAdaptiveSearchGrid::ComponentControlh |
709 // Gets the specified component of a compound control. |
597 // Gets the specified component of a compound control. |
710 // ----------------------------------------------------------------------------- |
598 // ----------------------------------------------------------------------------- |
711 // |
599 // |
847 void CAknAdaptiveSearchGrid::ControlsPositions() |
721 void CAknAdaptiveSearchGrid::ControlsPositions() |
848 { |
722 { |
849 TRect cell_pane; |
723 TRect cell_pane; |
850 |
724 |
851 TRect grid_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::grid_afind_pane( iLayoutOption ) ); |
725 TRect grid_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::grid_afind_pane( iLayoutOption ) ); |
852 TRect find_pane; |
|
853 |
|
854 if(iPopupFindpane) |
|
855 { |
|
856 find_pane = RectFromLayout( Rect(), AknLayoutScalable_Avkon::popup_find_window() ); |
|
857 } |
|
858 else |
|
859 { |
|
860 find_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::find_pane_cp01( iLayoutOption ) ); |
|
861 } |
|
862 _AKNTRACE( "[%s][%s] rect of find pane is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, |
|
863 find_pane.iTl.iX, find_pane.iTl.iY, find_pane.iBr.iX, find_pane.iBr.iY ); |
|
864 iInputFrame->SetRect( find_pane ); |
|
865 iSkinContextOfFindPane->SetRect( find_pane ); |
|
866 |
726 |
867 // Backspace and close buttons |
727 // Backspace and close buttons |
868 cell_pane = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane(iLayoutOption, iNumOfCols-2, iNumOfRows-1) ); |
728 cell_pane = RectFromLayout( grid_pane, AknLayoutScalable_Apps::cell_afind_pane(iLayoutOption, iNumOfCols-2, iNumOfRows-1) ); |
869 |
729 |
870 // For ELJG-7VC8Q2, move delete button up |
730 // For ELJG-7VC8Q2, move delete button up |
1126 iPrevButton->MakeVisible( ETrue ); |
986 iPrevButton->MakeVisible( ETrue ); |
1127 iPageIndicator->MakeVisible( ETrue ); |
987 iPageIndicator->MakeVisible( ETrue ); |
1128 } |
988 } |
1129 iCloseButton->MakeVisible( ETrue ); |
989 iCloseButton->MakeVisible( ETrue ); |
1130 iDeleteButton->MakeVisible( ETrue ); |
990 iDeleteButton->MakeVisible( ETrue ); |
1131 iInputFrame->MakeVisible( ETrue ); |
|
1132 iEditor->MakeVisible( ETrue ); |
|
1133 } |
991 } |
1134 |
992 |
1135 // ----------------------------------------------------------------------------- |
993 // ----------------------------------------------------------------------------- |
1136 // CAknAdaptiveSearchGrid::AdaptiveSearchGridShowL() |
994 // CAknAdaptiveSearchGrid::AdaptiveSearchGridShowL() |
1137 // Makes adaptive search grid visible and activates it. |
995 // Makes adaptive search grid visible and activates it. |
1265 { |
1119 { |
1266 return; // nothing should be done in this case |
1120 return; // nothing should be done in this case |
1267 } |
1121 } |
1268 if ( !IsFocused() && iLastFocusedButton ) |
1122 if ( !IsFocused() && iLastFocusedButton ) |
1269 iLastFocusedButton->ResetState(); |
1123 iLastFocusedButton->ResetState(); |
1270 |
|
1271 iInputFrame->SetFocus( IsFocused(), aDrawNow ); |
|
1272 } |
1124 } |
1273 |
1125 |
1274 |
1126 |
1275 // ----------------------------------------------------------------------------- |
1127 // ----------------------------------------------------------------------------- |
1276 // CAknAdaptiveSearchGrid::HandleWsEventL |
1128 // CAknAdaptiveSearchGrid::HandleWsEventL |
1295 { |
1147 { |
1296 TPointerEvent& pointerEvent = *aEvent.Pointer(); |
1148 TPointerEvent& pointerEvent = *aEvent.Pointer(); |
1297 |
1149 |
1298 if( pointerEvent.iType == TPointerEvent::EButton1Down ) |
1150 if( pointerEvent.iType == TPointerEvent::EButton1Down ) |
1299 { |
1151 { |
1300 if( iInputFrame->Rect().Contains(pointerEvent.iPosition) || |
1152 if ( !iFindpaneRect.Contains( pointerEvent.iPosition ) && |
1301 aDestination != this ) |
1153 aDestination != this ) |
1302 { |
1154 { |
1303 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1155 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1304 |
1156 |
1305 // according to Touch UI spec tapping on input frame should cause feedback, |
1157 // according to Touch UI spec tapping on input frame should cause feedback, |
1306 // even if action is to cancel dialog.. |
1158 // even if action is to cancel dialog.. |
1626 iCurrentRegion.AddRect( button_rect ); |
1478 iCurrentRegion.AddRect( button_rect ); |
1627 button_rect = iCloseButton->Rect(); |
1479 button_rect = iCloseButton->Rect(); |
1628 _AKNTRACE( "[%s][%s] rect of close button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, |
1480 _AKNTRACE( "[%s][%s] rect of close button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, |
1629 button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY ); |
1481 button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY ); |
1630 iCurrentRegion.AddRect( button_rect ); |
1482 iCurrentRegion.AddRect( button_rect ); |
1631 button_rect = iInputFrame->Rect(); |
|
1632 _AKNTRACE( "[%s][%s] rect of Input Frame is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, |
|
1633 button_rect.iTl.iX, button_rect.iTl.iY, button_rect.iBr.iX, button_rect.iBr.iY ); |
|
1634 iCurrentRegion.AddRect( button_rect ); |
|
1635 if( iNumOfPages > 1 ) |
1483 if( iNumOfPages > 1 ) |
1636 { |
1484 { |
1637 TRect page_pane; |
1485 TRect page_pane; |
1638 page_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::afind_page_pane(iLayoutOption) ); |
1486 page_pane = RectFromLayout( Rect(), AknLayoutScalable_Apps::afind_page_pane(iLayoutOption) ); |
1639 _AKNTRACE( "[%s][%s] rect of page pane is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, |
1487 _AKNTRACE( "[%s][%s] rect of page pane is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, |
1791 // to record the size of it. |
1639 // to record the size of it. |
1792 // ----------------------------------------------------------------------------- |
1640 // ----------------------------------------------------------------------------- |
1793 // |
1641 // |
1794 void CAknAdaptiveSearchGrid::SaveFindPaneRect( const TRect &aRect ) |
1642 void CAknAdaptiveSearchGrid::SaveFindPaneRect( const TRect &aRect ) |
1795 { |
1643 { |
1796 //Now we just deal with the landscape conditions |
|
1797 if ( !Layout_Meta_Data::IsLandscapeOrientation() ) |
|
1798 return; |
|
1799 |
|
1800 //When width is zero, no need to deal with. |
1644 //When width is zero, no need to deal with. |
1801 if ( 0 == aRect.Size().iWidth ) |
1645 if ( 0 == aRect.Size().iWidth ) |
1802 return; |
1646 return; |
1803 |
1647 |
1804 //The same size already is set. No need to do further process. |
1648 //The same size already is set. No need to do further process. |