fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlJapanesePredictivePane.cpp
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:            Predictive candidate list
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 // INCLUDE FILES
       
    30 #include <eikdef.h>
       
    31 #include <aknViewAppUi.h>
       
    32 #include <avkon.hrh>
       
    33 #include <aknPopup.h>
       
    34 #include <aknlists.h>
       
    35 #include <aknPopupHeadingPane.h>
       
    36 #include <AknsDrawUtils.h>
       
    37 #include <AknsBasicBackgroundControlContext.h>
       
    38 #include <aknfep.rsg>
       
    39 #include <barsread.h>
       
    40 #include <eikmop.h>
       
    41 #include <AknLayout.lag>
       
    42 #include <aknlayoutscalable_avkon.cdl.h>
       
    43 
       
    44 #include "AknFepUiInterfacePanic.h"
       
    45 #include "AknFepGlobalEnums.h"
       
    46 #include "AknFepUIAvkonCtrlJapanesePredictiveListbox.h"
       
    47 #include "AknFepUIAvkonCtrlJapanesePredictivePane.h"
       
    48 #include "AknFepUIManagerJapanese.h"
       
    49 
       
    50 // CONSTANTS
       
    51 const TInt KMaxListColumns = 30;
       
    52 const TInt KLAFBaseListRows = 1;
       
    53 const TInt KLAFBelowTextBaseline = 2;
       
    54 const TInt KLAFAboveTextBaseline = 1;
       
    55 const TInt KSpaceCharCode = ' ';
       
    56 const TInt KListboxFlameMarge = 4;
       
    57 const TInt KScrollRightMarge = 5;
       
    58 const TInt KListboxMarge = 3;
       
    59 
       
    60 /**
       
    61 *  CAknFepUICtrlJapanesePredictivePane class.
       
    62 *
       
    63 */
       
    64 
       
    65 // ============================ MEMBER FUNCTIONS ===============================
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CAknFepUICtrlJapanesePredictivePane::NewL
       
    69 // Two-phased constructor.
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 CAknFepUICtrlJapanesePredictivePane* CAknFepUICtrlJapanesePredictivePane::NewL(CAknFepUIManagerJapanese* aUiMng)
       
    73     {
       
    74     CAknFepUICtrlJapanesePredictivePane* self =
       
    75         new(ELeave)CAknFepUICtrlJapanesePredictivePane(aUiMng);
       
    76     CleanupStack::PushL(self);
       
    77     self->ConstructL();
       
    78     CleanupStack::Pop(self);    // self
       
    79     return self;
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CAknFepUICtrlJapanesePredictivePane::~CAknFepUICtrlJapanesePredictivePane
       
    84 // Destructor
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 CAknFepUICtrlJapanesePredictivePane::~CAknFepUICtrlJapanesePredictivePane()
       
    88     {
       
    89     if (IsVisible())
       
    90         {
       
    91         HideWindow();
       
    92         }
       
    93 
       
    94     if (iListBox)
       
    95         {
       
    96         delete iListBox;
       
    97         iListBox = NULL;
       
    98         }
       
    99 
       
   100     if (iLineInfoArray)
       
   101         {
       
   102         iLineInfoArray->ResetAndDestroy();
       
   103         delete iLineInfoArray;
       
   104         iLineInfoArray = NULL;
       
   105         }
       
   106 
       
   107     if (iListTextArray)
       
   108         {
       
   109         delete iListTextArray;
       
   110         iListTextArray = NULL;
       
   111         }
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CAknFepUICtrlJapanesePredictivePane::ShowWindow
       
   116 // Show Pop-up list
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 void CAknFepUICtrlJapanesePredictivePane::ShowWindow()
       
   120     {
       
   121     RWindow& window=Window();
       
   122     //Set ordinal position to top
       
   123     window.SetOrdinalPosition(0,ECoeWinPriorityFep);
       
   124     window.SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren);
       
   125     window.SetPointerCapture(ETrue);
       
   126     TRAP_IGNORE( ActivateL());
       
   127     MakeVisible(ETrue);
       
   128     DrawNow();
       
   129     }
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CAknFepUICtrlJapanesePredictivePane::ClosePredictiveList
       
   133 // Close Pop-up list
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 void CAknFepUICtrlJapanesePredictivePane::ClosePredictiveList()
       
   137     {
       
   138     CancelPopup();
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CAknFepUICtrlJapanesePredictivePane::SetCurrentItemIndex
       
   143 // Specify the cursor position of a pop-up list.
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 void CAknFepUICtrlJapanesePredictivePane::SetCurrentItemIndex(TInt aItemIndex)
       
   147     {
       
   148     CAknFepUICtrlJapanesePredictiveListBoxModel* model =
       
   149         static_cast<CAknFepUICtrlJapanesePredictiveListBoxModel*>(ListBox()->Model());
       
   150     const TInt maximumItems = model->MaximumItems();
       
   151 
       
   152     if (aItemIndex > maximumItems)
       
   153         {
       
   154         aItemIndex = maximumItems;
       
   155         }
       
   156 
       
   157     CAknFepUICtrlJapanesePredictiveListbox* listBox =
       
   158         static_cast<CAknFepUICtrlJapanesePredictiveListbox*>(ListBox());
       
   159 
       
   160     listBox->SetCurrentCandidateNo(aItemIndex, EFalse);
       
   161     }
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // CAknFepUICtrlJapanesePredictivePane::SetOffsetPosition
       
   165 // Specify the display position of a pop-up list
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 void CAknFepUICtrlJapanesePredictivePane::SetOffsetPosition(TPoint aOffset)
       
   169     {
       
   170     iOffsetPosition = aOffset;
       
   171     }
       
   172 
       
   173 // -----------------------------------------------------------------------------
       
   174 // CAknFepUICtrlJapanesePredictivePane::SetWindowPosition
       
   175 // Set position to show candidate list
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 void CAknFepUICtrlJapanesePredictivePane::SetWindowPosition(
       
   179                                                 const TPoint& aLeftSideOfBaseLine,
       
   180                                                 TInt aHeight,
       
   181                                                 TInt aAscent)
       
   182     {
       
   183     // getting rectangle of main pane
       
   184     TRect screen =
       
   185         TRect(0, 0, AKN_LAYOUT_WINDOW_screen.iW, AKN_LAYOUT_WINDOW_screen.iH);
       
   186     TAknLayoutRect main_pane;
       
   187     main_pane.LayoutRect(screen, AKN_LAYOUT_WINDOW_main_pane(screen, 0, 1, 1));
       
   188     iMainPaneRect = main_pane.Rect();
       
   189 
       
   190     TInt leftPos = aLeftSideOfBaseLine.iX;
       
   191     if (leftPos < 0)
       
   192         {
       
   193         leftPos = iOffsetPosition.iX;
       
   194         }
       
   195 
       
   196     TPoint windowOffset(
       
   197         leftPos,
       
   198         aLeftSideOfBaseLine.iY + aHeight - aAscent - iMainPaneRect.iTl.iY);
       
   199     SetOffsetPosition(windowOffset);
       
   200 
       
   201     iSrcTextHeight = aHeight;
       
   202     }
       
   203 
       
   204 // -----------------------------------------------------------------------------
       
   205 // CAknFepUICtrlJapanesePredictivePane::ShowCandidateListL
       
   206 // Show Pop-up list
       
   207 // -----------------------------------------------------------------------------
       
   208 //
       
   209 void CAknFepUICtrlJapanesePredictivePane::ShowCandidateListL(
       
   210         CDesCArrayFlat* aItems, TInt aIndex, TInt aResourceID)
       
   211     {
       
   212     __ASSERT_DEBUG(aItems->Count() > 0,
       
   213                    AknFepUiInterfacePanic(EAknFepUiInterfacePanicCandidatesEmpty));
       
   214 
       
   215     if (iLineInfoArray)
       
   216         {
       
   217         iLineInfoArray->ResetAndDestroy();
       
   218         }
       
   219     delete iLineInfoArray;
       
   220     delete iListTextArray;
       
   221     iLineInfoArray = NULL;
       
   222     iListTextArray = NULL;
       
   223     // getting listbox width by a pixel unit
       
   224     TAknWindowLineLayout laf =
       
   225         AKN_LAYOUT_WINDOW_popup_fep_japan_predictive_window(0, 0);
       
   226     TAknTextLineLayout textLineLayout =
       
   227         AKN_LAYOUT_TEXT_Predictive_candidate_selection_list_texts_Line_1(0,0);
       
   228     TAknWindowLineLayout scrollLineLayout = AknLayoutScalable_Avkon::scroll_pane_cp29().LayoutLine();
       
   229     TAknLayoutText text;
       
   230     text.LayoutText(laf.Rect(), textLineLayout);
       
   231     TInt allowDrawWidth = text.TextRect().Width() - scrollLineLayout.iW;
       
   232 
       
   233     iLineInfoArray = CreatePredictivePopupLineInfoArrayL(
       
   234         aItems, allowDrawWidth, textLineLayout.iFont);
       
   235     iListTextArray = CreateListTextArrayL(iLineInfoArray);
       
   236 
       
   237     // Set listitems.
       
   238     CAknFepUICtrlJapanesePredictiveListBoxModel* model =
       
   239         static_cast<CAknFepUICtrlJapanesePredictiveListBoxModel*>(ListBox()->Model());
       
   240     model->SetMaximumItems(aItems->Count());
       
   241     model->SetLineInfoArray(iLineInfoArray);
       
   242     model->SetItemTextArray(iListTextArray);
       
   243     model->SetOwnershipType(ELbmDoesNotOwnItemArray);
       
   244 
       
   245     iMaximumRows = MaximumRows(model);
       
   246 
       
   247     SetCurrentItemIndex(aIndex);
       
   248     SetMaximumHeight(iMaximumRows);
       
   249 
       
   250     // Show popup list
       
   251     TBool notShowingPopup =
       
   252         model->NumberOfItems() == 0 && iWindowType < 0x80;
       
   253     if (notShowingPopup)
       
   254         {
       
   255         const TSize screenSize=iCoeEnv->ScreenDevice()->SizeInPixels();
       
   256         iPopoutCba->SetBoundingRect(TRect(screenSize));
       
   257         }
       
   258 
       
   259     // Create a CBA for use with the popup
       
   260     if (aResourceID)
       
   261         {
       
   262         UpdateCbaL(aResourceID);
       
   263         }
       
   264 
       
   265     SetupWindowLayout(iWindowType);
       
   266 
       
   267     iListBox->SetListBoxObserver(this);
       
   268 
       
   269     if (iMarkable)
       
   270         {
       
   271         // If markable, set the popup to observe event change events.
       
   272         // Call HandleControlEvent to set the CBA appropriate to the 1st item
       
   273         iListBox->SetObserver(this);
       
   274         HandleControlEventL(iListBox, EEventStateChanged);
       
   275         }
       
   276 
       
   277     if (IsVisible())
       
   278         {
       
   279         DrawDeferred();
       
   280         }
       
   281     else
       
   282         {
       
   283         ShowWindow();
       
   284         ActivateL();
       
   285         ShowWindowCbaL();
       
   286         }
       
   287     }
       
   288 
       
   289 // -----------------------------------------------------------------------------
       
   290 // CAknFepUICtrlJapanesePredictivePane::HideWindow
       
   291 // Hide Pop-up list
       
   292 // -----------------------------------------------------------------------------
       
   293 //
       
   294 void CAknFepUICtrlJapanesePredictivePane::HideWindow()
       
   295     {
       
   296     MakeVisible(EFalse);
       
   297     Window().SetPointerCapture(EFalse);
       
   298 
       
   299     iEikonEnv->RemoveFromStack(iPopoutCba);
       
   300 
       
   301     iPopoutCba->MakeVisible(EFalse);
       
   302 
       
   303     iCurrentResource = 0;
       
   304     }
       
   305 
       
   306 // -----------------------------------------------------------------------------
       
   307 // CAknFepUICtrlJapanesePredictivePane::CurrentItemIndexOfCandidate
       
   308 // Return a selected candidate item number currently
       
   309 // -----------------------------------------------------------------------------
       
   310 //
       
   311 TInt CAknFepUICtrlJapanesePredictivePane::CurrentItemIndexOfCandidate()
       
   312     {
       
   313     if (IsVisible())
       
   314         {
       
   315         CAknFepUICtrlJapanesePredictiveListbox* listBox =
       
   316             static_cast<CAknFepUICtrlJapanesePredictiveListbox*>(ListBox());
       
   317         return listBox->CurrentCandidateNo();
       
   318         }
       
   319     return -1;      // Disable window
       
   320     }
       
   321 
       
   322 // -----------------------------------------------------------------------------
       
   323 // CAknFepUICtrlJapanesePredictivePane::MoveItem
       
   324 // Move a current item in an appointed direction
       
   325 // -----------------------------------------------------------------------------
       
   326 //
       
   327 TInt CAknFepUICtrlJapanesePredictivePane::MoveItem(
       
   328         TAknFepUICtrlScroll aDirection)
       
   329     {
       
   330     __ASSERT_DEBUG(iListBox->IsVisible(),
       
   331                    AknFepUiInterfacePanic(EAknFepUiInterfacePanicNoCandidatePane));
       
   332 
       
   333     TInt ret = 0;
       
   334 
       
   335     switch(aDirection)
       
   336         {
       
   337         case EScrollLeft:
       
   338             ret = MovePreviousItem();
       
   339             break;
       
   340 
       
   341         case EScrollRight:
       
   342             ret = MoveNextItem();
       
   343             break;
       
   344 
       
   345         case EScrollUp:
       
   346             ret = MovePreviousLineItem();
       
   347             break;
       
   348 
       
   349         case EScrollDown:
       
   350             ret = MoveNextLineItem();
       
   351             break;
       
   352 
       
   353         default:
       
   354         //Panic
       
   355             AknFepUiInterfacePanic(EAknFepUiInterfacePanicCandidatePaneNotSupportScrollDirection);
       
   356             break;
       
   357         }
       
   358     return ret;
       
   359     }
       
   360 
       
   361 // -----------------------------------------------------------------------------
       
   362 // CAknFepUICtrlJapanesePredictivePane::SetupWindowLayout
       
   363 // Set up a window layout type
       
   364 // -----------------------------------------------------------------------------
       
   365 //
       
   366 void CAknFepUICtrlJapanesePredictivePane::SetupWindowLayout(
       
   367         AknPopupLayouts::TAknPopupLayouts /*aType*/)
       
   368     {
       
   369     HandleSizeChanged(Layout(), NULL, ListBox(), this);
       
   370     }
       
   371 
       
   372 // -----------------------------------------------------------------------------
       
   373 // CAknFepUICtrlJapanesePredictivePane::AttemptExitL
       
   374 // Set the title for the selection list
       
   375 // -----------------------------------------------------------------------------
       
   376 //
       
   377 void CAknFepUICtrlJapanesePredictivePane::AttemptExitL(TBool aAccept)
       
   378     {
       
   379     if (iReturn) //Always not null unless ExecuteLD leaves
       
   380         *iReturn = aAccept;
       
   381     }
       
   382 
       
   383 // -----------------------------------------------------------------------------
       
   384 // CAknFepUICtrlJapanesePredictivePane::MopSupplyObject
       
   385 // -----------------------------------------------------------------------------
       
   386 //
       
   387 TTypeUid::Ptr CAknFepUICtrlJapanesePredictivePane::MopSupplyObject(TTypeUid aId)
       
   388     {
       
   389     SetMopParent( iEikonEnv->EikAppUi() );
       
   390     return CAknPopupList::MopSupplyObject(aId);
       
   391     }
       
   392 
       
   393 // -----------------------------------------------------------------------------
       
   394 // CAknFepUICtrlJapanesePredictivePane::CAknFepUICtrlJapanesePredictivePane
       
   395 // Constructor
       
   396 // -----------------------------------------------------------------------------
       
   397 //
       
   398 CAknFepUICtrlJapanesePredictivePane::CAknFepUICtrlJapanesePredictivePane(CAknFepUIManagerJapanese* aUiMng)
       
   399     : iUiMng(aUiMng)
       
   400     {
       
   401     }
       
   402 
       
   403 // -----------------------------------------------------------------------------
       
   404 // CAknFepUICtrlJapanesePredictivePane::ConstructL
       
   405 // Symbian 2nd phase constructor can leave.
       
   406 // -----------------------------------------------------------------------------
       
   407 //
       
   408 void CAknFepUICtrlJapanesePredictivePane::ConstructL()
       
   409     {
       
   410     // Create listbox
       
   411     CAknFepUICtrlJapanesePredictiveListbox* list =
       
   412                 new(ELeave) CAknFepUICtrlJapanesePredictiveListbox;
       
   413     // "iListBox" member variable is defined in CAknPopupList class.
       
   414     iListBox = list;
       
   415     CAknPopupList::ConstructL(
       
   416         list, R_AKNFEP_SOFTKEYS_CONVERT_OTHER_SELECT, AknPopupLayouts::EMenuWindow);
       
   417 
       
   418     list->ConstructL(this, CEikListBox::ELeftDownInViewRect);
       
   419     list->CreateScrollBarFrameL(ETrue);
       
   420     list->ScrollBarFrame()->SetScrollBarVisibilityL(
       
   421                                 CEikScrollBarFrame::EOff,
       
   422                                 CEikScrollBarFrame::EAuto);
       
   423 
       
   424     SetNonFocusing();
       
   425     MakeVisible(EFalse);
       
   426     iLineInfoArray = NULL;
       
   427     iListTextArray = NULL;
       
   428     }
       
   429 
       
   430 // -----------------------------------------------------------------------------
       
   431 // CAknFepUICtrlJapanesePredictivePane::CreatePredictivePopupLineInfoArrayL
       
   432 // Create a array with line information in candidate list
       
   433 // -----------------------------------------------------------------------------
       
   434 CPredictivePopupLineInfoArray*
       
   435 CAknFepUICtrlJapanesePredictivePane::CreatePredictivePopupLineInfoArrayL(
       
   436         CDesCArrayFlat* aItems,
       
   437         const TInt aMaxDisplayWidthInPixel,
       
   438         const TInt aFontId)
       
   439     {
       
   440     CPredictivePopupLineInfoArray* lineArray =
       
   441         new(ELeave) CPredictivePopupLineInfoArray(1);
       
   442     CleanupStack::PushL(lineArray);
       
   443 
       
   444     // getting font object from font id
       
   445     const CFont* font = AknLayoutUtils::FontFromId(aFontId);
       
   446 
       
   447     TInt displayWidthInPixel = aMaxDisplayWidthInPixel;
       
   448     TInt elementStartXPos = 0;
       
   449 
       
   450     TBuf<KMaxListColumns*2> bufferOfLine;
       
   451     CPredictivePopupElementArray* elementArray = NULL;
       
   452 
       
   453     const TInt widthOfSpaceInPixel = font->CharWidthInPixels(KSpaceCharCode);
       
   454     const TInt numberOfItem = aItems->Count();
       
   455     TInt i;
       
   456     for (i = 0; i < numberOfItem; i++)
       
   457         {
       
   458         TPtrC itemText = aItems->MdcaPoint(i);
       
   459         TInt itemTextLength = itemText.Length();
       
   460 
       
   461         // getting a number of characters within width
       
   462         TInt count = font->TextCount(itemText, displayWidthInPixel);
       
   463 
       
   464         // If a candidate cannot occupy a line, it is
       
   465         // continued in next line
       
   466         if (count < itemTextLength && elementArray)
       
   467             {
       
   468             PredictivePopupAppendLineL(lineArray, bufferOfLine, elementArray);
       
   469             CleanupStack::Pop(elementArray);    // elementArray
       
   470             elementArray = NULL;
       
   471             bufferOfLine.SetLength(0);
       
   472 
       
   473             displayWidthInPixel = aMaxDisplayWidthInPixel;
       
   474             elementStartXPos = 0;
       
   475             count = font->TextCount(itemText, displayWidthInPixel);
       
   476             }
       
   477 
       
   478         FOREVER
       
   479             {
       
   480             if (!elementArray)
       
   481                 {
       
   482                 elementArray = new(ELeave) CPredictivePopupElementArray(1);
       
   483                 CleanupStack::PushL(elementArray);
       
   484                 }
       
   485 
       
   486             TPtrC elementText = itemText.Left(count);
       
   487             TInt  elementWidthInPixels = font->TextWidthInPixels(elementText);
       
   488 
       
   489             // setting a item string to line string
       
   490             bufferOfLine.Append(elementText);
       
   491             displayWidthInPixel -= elementWidthInPixels;
       
   492 
       
   493             TPredictivePopupElement& element = elementArray->ExtendL();
       
   494             element.iStartXPos = elementStartXPos;
       
   495             elementStartXPos += elementWidthInPixels;
       
   496             element.iEndXPos   = elementStartXPos;
       
   497             element.iCandidateNo = i;
       
   498 
       
   499             // creating a string which removes a item string
       
   500             itemTextLength -= count;
       
   501             if (itemTextLength > 0)
       
   502                 {
       
   503                 // If this line is full, add this line and create a new line.
       
   504                 PredictivePopupAppendLineL(lineArray, bufferOfLine, elementArray);
       
   505                 CleanupStack::Pop(elementArray);    // elementArray
       
   506                 elementArray = NULL;
       
   507                 bufferOfLine.SetLength(0);
       
   508 
       
   509                 itemText.Set(itemText.Right(itemTextLength));
       
   510                 displayWidthInPixel = aMaxDisplayWidthInPixel;
       
   511                 elementStartXPos = 0;
       
   512 
       
   513                 // Calculating a number of characters which be able to shown in the width and
       
   514                 // cutting the string
       
   515                 count = font->TextCount(itemText, displayWidthInPixel);
       
   516                 }
       
   517             else
       
   518                 {
       
   519                 break;
       
   520                 }
       
   521             }
       
   522 
       
   523         if (displayWidthInPixel > widthOfSpaceInPixel)
       
   524             {
       
   525             // adding space if it is possible to add space
       
   526             bufferOfLine.Append(KSpaceCharCode);
       
   527             displayWidthInPixel -= widthOfSpaceInPixel;
       
   528             elementStartXPos    += widthOfSpaceInPixel;
       
   529             }
       
   530         else
       
   531             {
       
   532             // adding a line information if it isn't possible to add space
       
   533             PredictivePopupAppendLineL(lineArray, bufferOfLine, elementArray);
       
   534             CleanupStack::Pop(elementArray);    // elementArray
       
   535             elementArray = NULL;
       
   536             bufferOfLine.SetLength(0);
       
   537 
       
   538             displayWidthInPixel = aMaxDisplayWidthInPixel - 1;
       
   539             elementStartXPos = 0;
       
   540             }
       
   541         }
       
   542 
       
   543     if (bufferOfLine.Length() > 0 && elementArray)
       
   544         {
       
   545         PredictivePopupAppendLineL(lineArray, bufferOfLine, elementArray);
       
   546         CleanupStack::Pop(elementArray);    // elementArray
       
   547         }
       
   548 
       
   549     CleanupStack::Pop(lineArray);    // lineArray
       
   550 
       
   551     return lineArray;
       
   552     }
       
   553 
       
   554 // -----------------------------------------------------------------------------
       
   555 // CAknFepUICtrlJapanesePredictivePane::PredictivePopupAppendLineL
       
   556 // Append to array with line information
       
   557 // -----------------------------------------------------------------------------
       
   558 //
       
   559 void CAknFepUICtrlJapanesePredictivePane::PredictivePopupAppendLineL(
       
   560         CPredictivePopupLineInfoArray* aLineArray,
       
   561         const TDesC& aLineText,
       
   562         CPredictivePopupElementArray* aElementArray)
       
   563     {
       
   564     HBufC* lineTextBuf = HBufC::NewL(aLineText.Length());
       
   565     CleanupStack::PushL(lineTextBuf);
       
   566     TPtr lineTextBufPtr = lineTextBuf->Des();
       
   567     lineTextBufPtr.Copy(aLineText);
       
   568 
       
   569     CPredictivePopupLineInfo* lineInfo = new(ELeave) CPredictivePopupLineInfo;
       
   570     CleanupStack::PushL(lineInfo);
       
   571 
       
   572     aLineArray->AppendL(lineInfo);
       
   573     CleanupStack::Pop(2, lineTextBuf); // lineTextBuf, lineInfo
       
   574 
       
   575     // After that set to line information items,
       
   576     // becasue the following member variables are deleted
       
   577     // in the destractor of CPredictivePopupLineInfo if leave occurs.
       
   578     lineInfo->iLineText = lineTextBuf;
       
   579     lineInfo->iElementsOnLine = aElementArray;
       
   580     }
       
   581 
       
   582 // -----------------------------------------------------------------------------
       
   583 // CAknFepUICtrlJapanesePredictivePane::CreateListTextArrayL
       
   584 // Create arrary with string to show in a line
       
   585 // -----------------------------------------------------------------------------
       
   586 //
       
   587 CDesCArrayFlat* CAknFepUICtrlJapanesePredictivePane::CreateListTextArrayL(
       
   588         CPredictivePopupLineInfoArray* aLineArray)
       
   589     {
       
   590     CDesCArrayFlat* textArray = new(ELeave) CDesCArrayFlat(1);
       
   591     CleanupStack::PushL(textArray);
       
   592 
       
   593     const TInt numberOfItem = aLineArray->Count();
       
   594     TInt i;
       
   595     for (i = 0; i < numberOfItem; i++)
       
   596         {
       
   597         CPredictivePopupLineInfo* lineInfo = aLineArray->At(i);
       
   598         textArray->AppendL(*lineInfo->iLineText);
       
   599         }
       
   600 
       
   601     CleanupStack::Pop(textArray);    // textArray
       
   602 
       
   603     return textArray;
       
   604     }
       
   605 
       
   606 // -----------------------------------------------------------------------------
       
   607 // CAknFepUICtrlJapanesePredictivePane::HandleSizeChanged
       
   608 // The handler function for size change
       
   609 //
       
   610 // Original function is AknPopupLayouts::HandleSizeChanged()
       
   611 // -----------------------------------------------------------------------------
       
   612 //
       
   613 void CAknFepUICtrlJapanesePredictivePane::HandleSizeChanged(
       
   614         TAknPopupWindowLayoutDef& aDef,
       
   615         CAknPopupHeadingPane* aHeading,
       
   616         CEikListBox* aListBox,
       
   617         CCoeControl* aWindowOwningControl)
       
   618     {
       
   619     TInt numofitems = aListBox->Model()->NumberOfItems();
       
   620 
       
   621     TInt minItems = KJapPredictiveVisibleListRowsMin;
       
   622     TInt maxItems = KJapPredictiveVisibleListRowsMax;
       
   623 
       
   624     if (aDef.iMaximumHeight)
       
   625         {
       
   626         maxItems = aDef.iMaximumHeight;
       
   627         }
       
   628     AknPopupLayouts::CheckRange(numofitems, minItems, maxItems);
       
   629     CalcPopupMenuWindow(aDef, iMainPaneRect, numofitems);
       
   630     SetupMenuPopupWindow(aDef, numofitems, aHeading != 0);
       
   631 
       
   632     aWindowOwningControl->SetRect(AknPopupLayouts::WindowRect(aDef));
       
   633     HandleSizeAndPositionOfComponents(aDef, aListBox, aHeading);
       
   634 
       
   635     TRect windowRect = AknPopupLayouts::WindowRect(aDef);
       
   636     MAknsControlContext *cc = AknsDrawUtils::ControlContext( aListBox );
       
   637     TBool defaultContext = EFalse;
       
   638     if (!cc)
       
   639         {
       
   640         cc = aListBox->View()->ItemDrawer()->SkinBackgroundControlContext();
       
   641         defaultContext = ETrue;
       
   642         }
       
   643 
       
   644     if (cc)
       
   645         {
       
   646         CAknsBasicBackgroundControlContext *bcc =
       
   647             (CAknsBasicBackgroundControlContext*)cc;
       
   648         TAknLayoutRect popupBgRect;
       
   649 
       
   650         popupBgRect.LayoutRect(
       
   651             windowRect,
       
   652             ELayoutEmpty,
       
   653             0, 0, ELayoutEmpty, ELayoutEmpty,
       
   654             windowRect.Size().iWidth, windowRect.Size().iHeight);
       
   655 
       
   656         bcc->SetBitmap(KAknsIIDQsnFrPopupCenter);
       
   657 
       
   658         if (defaultContext)
       
   659             {
       
   660             bcc->SetRect(popupBgRect.Rect());
       
   661             }
       
   662 
       
   663         bcc->SetParentPos(aWindowOwningControl->PositionRelativeToScreen());
       
   664 
       
   665         if (defaultContext)
       
   666             {
       
   667             bcc->SetParentPos(TPoint(0, 0));
       
   668             }
       
   669         }
       
   670      }
       
   671 
       
   672 // -----------------------------------------------------------------------------
       
   673 // CAknFepUICtrlJapanesePredictivePane::HandleDraw
       
   674 // The handler function for Draw
       
   675 //
       
   676 // Original function is AknPopupLayouts::HandleDraw()
       
   677 // -----------------------------------------------------------------------------
       
   678 //
       
   679 void CAknFepUICtrlJapanesePredictivePane::HandleDraw(CEikonEnv* /*aEikEnv*/,
       
   680                   CWindowGc& aGc,
       
   681                   const TAknPopupWindowLayoutDef& aDef,
       
   682                   CEikListBox* aListBox,
       
   683                   CAknPopupHeadingPane* /*aHeading*/)
       
   684     {
       
   685     aGc.Clear();
       
   686 
       
   687     TRect windowRect =
       
   688         AknPopupLayouts::MenuRect(const_cast<TAknPopupWindowLayoutDef&>(aDef));
       
   689     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   690     MAknsControlContext* cc = AknsDrawUtils::ControlContext(aListBox);
       
   691     TBool windowFrameDrawn = EFalse;
       
   692     if (!cc)
       
   693         {
       
   694         cc = aListBox->View()->ItemDrawer()->SkinBackgroundControlContext();
       
   695         }
       
   696 
       
   697     if (cc)
       
   698         {
       
   699         // drawing frame
       
   700         TAknLayoutRect topLeft;
       
   701         topLeft.LayoutRect(
       
   702             windowRect,
       
   703             ELayoutEmpty,
       
   704             0, 0, ELayoutEmpty, ELayoutEmpty, KListboxFlameMarge, KListboxFlameMarge);
       
   705 
       
   706         TAknLayoutRect bottomRight;
       
   707         bottomRight.LayoutRect(
       
   708             windowRect,
       
   709             ELayoutEmpty,
       
   710             ELayoutEmpty, ELayoutEmpty, 0, 0, KListboxFlameMarge, KListboxFlameMarge);
       
   711 
       
   712         TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
       
   713         TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
       
   714         aGc.SetPenStyle(CGraphicsContext::ENullPen);
       
   715         const TAknsItemID *frameId = &KAknsIIDQsnFrPopupSub;
       
   716         const TAknsItemID *frameCenterId = &KAknsIIDQsnFrPopupCenter;
       
   717         windowFrameDrawn = AknsDrawUtils::DrawFrame(
       
   718                 skin, aGc, outerRect, innerRect, *frameId, *frameCenterId);
       
   719         }
       
   720 
       
   721     if (!windowFrameDrawn)
       
   722         {
       
   723         DrawWindowShadow(
       
   724             aGc,
       
   725             aDef.iCover, aDef.iSecond, aDef.iFirst, aDef.iOutline, aDef.iInside);
       
   726         }
       
   727     }
       
   728 
       
   729 // -----------------------------------------------------------------------------
       
   730 // CAknFepUICtrlJapanesePredictivePane::CalcPopupMenuWindow
       
   731 // Set up the information on a pop-up window
       
   732 //
       
   733 // Original function is AknPopupLayouts::CalcPopupMenuWindow()
       
   734 // -----------------------------------------------------------------------------
       
   735 //
       
   736 void CAknFepUICtrlJapanesePredictivePane::CalcPopupMenuWindow(
       
   737         TAknPopupWindowLayoutDef &aDef,const TRect& aRect, TInt /*aNum*/)
       
   738     {
       
   739     TAknLayoutRect popup_menu_window;
       
   740 
       
   741     TBool sizeDesideFlag = EFalse;
       
   742     TInt adjustOffsetX = 0;
       
   743     TInt adjustOffsetY = 0;
       
   744 
       
   745     TAknWindowLineLayout laf =
       
   746         AKN_LAYOUT_WINDOW_popup_fep_japan_predictive_window(
       
   747             0, iMaximumRows - KJapPredictiveVisibleListRowsMin);
       
   748     laf.il = 0;
       
   749     laf.it = 0;
       
   750     TAknWindowLineLayout maxlaf =
       
   751         AKN_LAYOUT_WINDOW_popup_fep_japan_predictive_window(
       
   752             0, KJapPredictiveVisibleListRowsMax - KJapPredictiveVisibleListRowsMin);
       
   753     laf.il = 0;
       
   754     maxlaf.it = 0;
       
   755 
       
   756     popup_menu_window.LayoutRect(aRect, laf);
       
   757 
       
   758     // checking whether list can be drawn under the position which popup window is dispalyed
       
   759     if (iMainPaneRect.iTl.iY
       
   760         + iOffsetPosition.iY + KLAFBelowTextBaseline
       
   761         + maxlaf.iH < iMainPaneRect.iBr.iY)
       
   762         {
       
   763         // deciding the position which popup window is dispalyed
       
   764         adjustOffsetY = (-1) * KLAFBelowTextBaseline;
       
   765         sizeDesideFlag = ETrue;
       
   766         }
       
   767 
       
   768         // checking whether list can be drawn top the position which popup window is dispalyed
       
   769     else if (iMainPaneRect.iTl.iY
       
   770             + iOffsetPosition.iY - KLAFAboveTextBaseline
       
   771             - iSrcTextHeight
       
   772             - popup_menu_window.Rect().Height() > iMainPaneRect.iTl.iY)
       
   773         {
       
   774         // deciding the position which popup window is dispalyed
       
   775         adjustOffsetY = iSrcTextHeight + KLAFAboveTextBaseline + popup_menu_window.Rect().Height();
       
   776         sizeDesideFlag = ETrue;
       
   777         }
       
   778 
       
   779     // display the bottom of window in case the displaying position isn't decided
       
   780     //
       
   781     if (!sizeDesideFlag)
       
   782         {
       
   783         TAknWindowLineLayout laf =
       
   784             AKN_LAYOUT_WINDOW_popup_fep_japan_predictive_window(
       
   785                 0, KJapPredictiveVisibleListRowsMax - KLAFBaseListRows);
       
   786         laf.il = 0;
       
   787         laf.it = 0;
       
   788         popup_menu_window.LayoutRect(aRect, laf);
       
   789         adjustOffsetY =
       
   790             iMainPaneRect.iTl.iY
       
   791             + iOffsetPosition.iY + KLAFBelowTextBaseline
       
   792             + popup_menu_window.Rect().Height() - iMainPaneRect.iBr.iY;
       
   793 
       
   794         iMaximumRows = KJapPredictiveVisibleListRowsMin;
       
   795         sizeDesideFlag = ETrue;
       
   796         }
       
   797 
       
   798     adjustOffsetX =
       
   799         iMainPaneRect.iTl.iX
       
   800         + iOffsetPosition.iX
       
   801         + popup_menu_window.Rect().Width() - iMainPaneRect.iBr.iX;
       
   802     adjustOffsetX = (adjustOffsetX > 0) ? adjustOffsetX : 0;
       
   803 
       
   804     TPoint adjustOffset(-adjustOffsetX, -adjustOffsetY);
       
   805 
       
   806     aDef.iWindowRect = popup_menu_window.Rect();
       
   807     aDef.iWindowRect.Move(iOffsetPosition);
       
   808     aDef.iWindowRect.Move(adjustOffset);
       
   809 
       
   810     TRect window_rect = AknPopupLayouts::MenuRect(aDef);
       
   811     aDef.iCover.LayoutRect(
       
   812         window_rect,
       
   813         AKN_LAYOUT_WINDOW_Predictive_candidate_selection_popup_window_graphics_Line_1(aDef.iWindowRect));
       
   814     aDef.iSecond.LayoutRect(
       
   815         window_rect,
       
   816         AKN_LAYOUT_WINDOW_Predictive_candidate_selection_popup_window_graphics_Line_2(aDef.iWindowRect));
       
   817     aDef.iFirst.LayoutRect(
       
   818         window_rect,
       
   819         AKN_LAYOUT_WINDOW_Predictive_candidate_selection_popup_window_graphics_Line_2(aDef.iWindowRect));
       
   820     aDef.iOutline.LayoutRect(
       
   821         window_rect,
       
   822         AKN_LAYOUT_WINDOW_Predictive_candidate_selection_popup_window_graphics_Line_3(aDef.iWindowRect));
       
   823     aDef.iInside.LayoutRect(
       
   824         window_rect,
       
   825         AKN_LAYOUT_WINDOW_Predictive_candidate_selection_popup_window_graphics_Line_4(aDef.iWindowRect));
       
   826     aDef.iPopupMenuWindowOffset = TPoint(0, 0);
       
   827     }
       
   828 
       
   829 // -----------------------------------------------------------------------------
       
   830 // CAknFepUICtrlJapanesePredictivePane::SetupMenuPopupWindow
       
   831 // Set up the information on a pop-up window
       
   832 //
       
   833 // Original function is AknPopupLayouts::SetupMenuPopupWindow()
       
   834 // -----------------------------------------------------------------------------
       
   835 //
       
   836 void CAknFepUICtrlJapanesePredictivePane::SetupMenuPopupWindow(TAknPopupWindowLayoutDef &aDef, TInt /*num*/, TBool /*heading*/)
       
   837     {
       
   838     AknPopupLayouts::SetupDefaults(aDef);
       
   839     TRect window_rect = AknPopupLayouts::MenuRect(aDef);
       
   840 
       
   841     // setting size of listbox pane
       
   842     TAknWindowLineLayout laf =
       
   843         AKN_LAYOUT_WINDOW_popup_fep_japan_predictive_window(0, iMaximumRows - KLAFBaseListRows);
       
   844 
       
   845     laf.il = KListboxMarge;
       
   846     laf.it = KListboxMarge;
       
   847     laf.iW -= KListboxMarge*2;
       
   848     laf.iH = laf.iH - KListboxMarge*2 - (laf.iH-KListboxMarge*2)%iMaximumRows;
       
   849     aDef.iListRect.LayoutRect(window_rect, laf);
       
   850     }
       
   851 
       
   852 // -----------------------------------------------------------------------------
       
   853 // CAknFepUICtrlJapanesePredictivePane::HandleSizeAndPositionOfComponents
       
   854 // The handler function for size and a location
       
   855 //
       
   856 // Original function is AknPopupLayouts::HandleSizeAndPositionOfComponents()
       
   857 //
       
   858 //
       
   859 // -----------------------------------------------------------------------------
       
   860 //
       
   861 void CAknFepUICtrlJapanesePredictivePane::HandleSizeAndPositionOfComponents(
       
   862         const TAknPopupWindowLayoutDef &aDef,
       
   863         CCoeControl *aContent,
       
   864         CAknPopupHeadingPane* /*aHeading*/)
       
   865     {
       
   866     TRect lbrect = aDef.iListRect.Rect();
       
   867 
       
   868    if (AknLayoutUtils::ScalableLayoutInterfaceAvailable())
       
   869         {
       
   870         // set scroll size
       
   871         CAknFepUICtrlJapanesePredictiveListbox* listBox =
       
   872             static_cast<CAknFepUICtrlJapanesePredictiveListbox*>(aContent);
       
   873         CAknFepUICtrlJapanesePredictiveListBoxModel* model =
       
   874             static_cast<CAknFepUICtrlJapanesePredictiveListBoxModel*>(listBox->Model());
       
   875         TInt maxRows = model->LineInfoArray()->Count();
       
   876         if (maxRows > KJapPredictiveVisibleListRowsMax)
       
   877             {
       
   878             TAknWindowLineLayout scrollLineLayout = AknLayoutScalable_Avkon::scroll_pane_cp29().LayoutLine();
       
   879             lbrect.iBr.iX -= (scrollLineLayout.iW + KScrollRightMarge - KListboxMarge);
       
   880             }
       
   881         }
       
   882 
       
   883     aContent->SetRect(lbrect);
       
   884     }
       
   885 
       
   886 // -----------------------------------------------------------------------------
       
   887 // CAknFepUICtrlJapanesePredictivePane::DrawWindowShadow
       
   888 // Draw window shadow
       
   889 //
       
   890 // Original function is AknDrawWithSkins::DrawWindowShadow()
       
   891 // -----------------------------------------------------------------------------
       
   892 //
       
   893 void CAknFepUICtrlJapanesePredictivePane::DrawWindowShadow(
       
   894         CWindowGc& aGc,
       
   895         const TAknLayoutRect& aCoverRect,
       
   896         const TAknLayoutRect& /*aSecondShadowRect*/,
       
   897         const TAknLayoutRect& aFirstShadowRect,
       
   898         const TAknLayoutRect& aOutlineFrameRect,
       
   899         const TAknLayoutRect& aInsideAreaRect)
       
   900     {
       
   901     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   902 
       
   903     // draw rectangle
       
   904     aGc.SetBrushColor(aCoverRect.Color());
       
   905     AknsDrawUtils::Background(skin, NULL, NULL, aGc, aCoverRect.Rect());
       
   906 
       
   907     aFirstShadowRect.DrawOutLineRect(aGc);
       
   908 
       
   909     aOutlineFrameRect.DrawOutLineRect(aGc);
       
   910 
       
   911     aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   912     aGc.SetBrushColor(aInsideAreaRect.Color());
       
   913     AknsDrawUtils::Background(skin, NULL, NULL, aGc, aInsideAreaRect.Rect());
       
   914     }
       
   915 
       
   916 // -----------------------------------------------------------------------------
       
   917 // CAknFepUICtrlJapanesePredictivePane::MaximumRows
       
   918 // calculate maximum columns from items of listbox
       
   919 // -----------------------------------------------------------------------------
       
   920 //
       
   921 TInt CAknFepUICtrlJapanesePredictivePane::MaximumRows(
       
   922         CTextListBoxModel* aModel)
       
   923     {
       
   924     CAknFepUICtrlJapanesePredictiveListBoxModel* model =
       
   925         static_cast<CAknFepUICtrlJapanesePredictiveListBoxModel*>(aModel);
       
   926     TInt maxRows = model->LineInfoArray()->Count();
       
   927     TInt maxVisibleRows = Min(KJapPredictiveVisibleListRowsMax, maxRows);
       
   928     maxVisibleRows = Max(KJapPredictiveVisibleListRowsMin, maxVisibleRows);
       
   929     return maxVisibleRows;
       
   930     }
       
   931 
       
   932 // -----------------------------------------------------------------------------
       
   933 // CAknFepUICtrlJapanesePredictivePane::Draw
       
   934 // Called by the framework to draw the control
       
   935 // -----------------------------------------------------------------------------
       
   936 //
       
   937 void CAknFepUICtrlJapanesePredictivePane::Draw(const TRect& /*aRect*/) const
       
   938     {
       
   939     CWindowGc& gc = SystemGc();
       
   940     gc.Clear();
       
   941     HandleDraw(iEikonEnv, gc, Layout(), iListBox, Heading());
       
   942     }
       
   943 
       
   944 // -----------------------------------------------------------------------------
       
   945 // CAknFepUICtrlJapanesePredictivePane::OfferKeyEventL
       
   946 // Handle key events. When a key event occurs
       
   947 // -----------------------------------------------------------------------------
       
   948 //
       
   949 TKeyResponse CAknFepUICtrlJapanesePredictivePane::OfferKeyEventL(
       
   950         const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
       
   951     {
       
   952     return EKeyWasNotConsumed;
       
   953     }
       
   954 
       
   955 // -----------------------------------------------------------------------------
       
   956 // CAknFepUICtrlJapanesePredictivePane::MovePreviousItem
       
   957 // selecting a next candidate
       
   958 // -----------------------------------------------------------------------------
       
   959 //
       
   960 TInt CAknFepUICtrlJapanesePredictivePane::MovePreviousItem()
       
   961     {
       
   962     CAknFepUICtrlJapanesePredictiveListbox* listBox =
       
   963         static_cast<CAknFepUICtrlJapanesePredictiveListbox*>(ListBox());
       
   964 
       
   965     return listBox->MovePreviousItem();
       
   966     }
       
   967 
       
   968 // -----------------------------------------------------------------------------
       
   969 // CAknFepUICtrlJapanesePredictivePane::MoveNextItem
       
   970 // selecting a next candidate
       
   971 // -----------------------------------------------------------------------------
       
   972 //
       
   973 TInt CAknFepUICtrlJapanesePredictivePane::MoveNextItem()
       
   974     {
       
   975     CAknFepUICtrlJapanesePredictiveListbox* listBox =
       
   976         static_cast<CAknFepUICtrlJapanesePredictiveListbox*>(ListBox());
       
   977 
       
   978     return listBox->MoveNextItem();
       
   979     }
       
   980 
       
   981 // -----------------------------------------------------------------------------
       
   982 // CAknFepUICtrlJapanesePredictivePane::MovePreviousLineItem
       
   983 // selecting a previous line candidate
       
   984 // -----------------------------------------------------------------------------
       
   985 //
       
   986 TInt CAknFepUICtrlJapanesePredictivePane::MovePreviousLineItem()
       
   987     {
       
   988     CAknFepUICtrlJapanesePredictiveListbox* listBox =
       
   989         static_cast<CAknFepUICtrlJapanesePredictiveListbox*>(ListBox());
       
   990 
       
   991     return listBox->MovePreviousLineItem();
       
   992     }
       
   993 
       
   994 // -----------------------------------------------------------------------------
       
   995 // CAknFepUICtrlJapanesePredictivePane::MoveNextLineItem
       
   996 // selecting a next line candidate
       
   997 // -----------------------------------------------------------------------------
       
   998 //
       
   999 TInt CAknFepUICtrlJapanesePredictivePane::MoveNextLineItem()
       
  1000     {
       
  1001     CAknFepUICtrlJapanesePredictiveListbox* listBox =
       
  1002         static_cast<CAknFepUICtrlJapanesePredictiveListbox*>(ListBox());
       
  1003 
       
  1004     return listBox->MoveNextLineItem();
       
  1005     }
       
  1006 
       
  1007 // -----------------------------------------------------------------------------
       
  1008 // CAknFepUICtrlJapanesePredictivePane::UpdateCbaL
       
  1009 // Changing the cba
       
  1010 // -----------------------------------------------------------------------------
       
  1011 //
       
  1012 void CAknFepUICtrlJapanesePredictivePane::UpdateCbaL(TInt aResourceID)
       
  1013     {
       
  1014     if (iCurrentResource == aResourceID)
       
  1015         {
       
  1016         return;
       
  1017         }
       
  1018 
       
  1019     // store resource id
       
  1020     iPopoutCba->SetCommandSetL( aResourceID );
       
  1021     iCurrentResource = aResourceID;
       
  1022     iPopoutCba->DrawDeferred();
       
  1023     }
       
  1024 
       
  1025 /**
       
  1026  * Processes events from the softkeys. Responds to EAknSoftkeyOk and EAknSoftkeyBack
       
  1027  * to accept or cancel the pop-up.
       
  1028  *
       
  1029  * @param   aCommandId  Event Id from the soft-key
       
  1030  */
       
  1031 void CAknFepUICtrlJapanesePredictivePane::ProcessCommandL(TInt aCommandId)
       
  1032     {
       
  1033     // Respond to softkey events
       
  1034     switch (aCommandId)
       
  1035         {
       
  1036         case EAknFepSoftkeyConvert:
       
  1037         case EAknFepSoftkeyCloseWindow:
       
  1038         case EAknFepSoftkeyCommit:
       
  1039         case EAknFepSoftkeySelectCandidate:
       
  1040         case EAknFepSoftkeyOtherModes:
       
  1041             iUiMng->HandleCommandL(aCommandId);
       
  1042             break;
       
  1043         default:
       
  1044             CAknPopupList::ProcessCommandL(aCommandId);
       
  1045             break;
       
  1046         }
       
  1047     }
       
  1048 
       
  1049 void CAknFepUICtrlJapanesePredictivePane::ShowWindowCbaL()
       
  1050     {
       
  1051     RDrawableWindow* cbaWindow = iPopoutCba->ButtonGroup()->AsControl()->DrawableWindow();
       
  1052     cbaWindow->SetOrdinalPosition(0,ECoeWinPriorityFep);
       
  1053     cbaWindow->SetFaded(EFalse, RWindowTreeNode::EFadeWindowOnly);
       
  1054     cbaWindow->SetNonFading(ETrue);
       
  1055     iEikonEnv->EikAppUi()->AddToStackL(iPopoutCba,
       
  1056                                                  ECoeStackPriorityFep,
       
  1057                                                  ECoeStackFlagRefusesFocus);
       
  1058 
       
  1059     iPopoutCba->ActivateL();
       
  1060     iPopoutCba->MakeVisible(ETrue);
       
  1061     iPopoutCba->DrawDeferred(); // to update the cba
       
  1062     }
       
  1063 
       
  1064 // ---------------------------------------------------------------------------
       
  1065 // CAknFepUICtrlJapanesePredictivePane::HandleListBoxEventL
       
  1066 // CallBack from ListBox
       
  1067 // (other items were commented in a header).
       
  1068 // ---------------------------------------------------------------------------
       
  1069 //
       
  1070 void CAknFepUICtrlJapanesePredictivePane::HandleListBoxEventL(
       
  1071     CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
       
  1072     {
       
  1073     switch (aEventType)
       
  1074         {
       
  1075         case EEventItemDraggingActioned: // Item Moved
       
  1076             DrawNow();
       
  1077             break;
       
  1078         case EEventItemClicked:
       
  1079             {
       
  1080             TKeyEvent ccpuStart = {EKeyOK, EStdKeyDevice3, 0, 0};
       
  1081             iEikonEnv->SimulateKeyEventL(ccpuStart, EEventKey);
       
  1082             }
       
  1083             break;
       
  1084         default:
       
  1085            break;
       
  1086         }
       
  1087     }
       
  1088 
       
  1089 // End of File