javauis/lcdui_akn/lcdui/src/CMIDDisplayable.cpp
branchRCL_3
changeset 17 0fd27995241b
parent 14 04becd199f91
child 21 4376525cdefb
equal deleted inserted replaced
15:f9bb0fca356a 17:0fd27995241b
   984         CMIDForm* form = static_cast<CMIDForm*>(iContentControl);
   984         CMIDForm* form = static_cast<CMIDForm*>(iContentControl);
   985         ASSERT(form);
   985         ASSERT(form);
   986         form->HandleForegroundL(aForeground);
   986         form->HandleForegroundL(aForeground);
   987     }
   987     }
   988 
   988 
   989 #ifdef RD_JAVA_NGA_ENABLED
   989     HandleCanvasForeground(aForeground);   
   990     HandleCanvasForeground(aForeground);
       
   991 #endif // RD_JAVA_NGA_ENABLED    
       
   992 
   990 
   993     if (aForeground)
   991     if (aForeground)
   994     {
   992     {
   995         //If MIDlet is sent to foreground and JAD-attribute BackgroundEvent=Pause,
   993         //If MIDlet is sent to foreground and JAD-attribute BackgroundEvent=Pause,
   996         //then call startApp() method for the MIDlet.
   994         //then call startApp() method for the MIDlet.
  1234             {
  1232             {
  1235                 if (iSKPositionWithQwerty == ESoftkeysRight)
  1233                 if (iSKPositionWithQwerty == ESoftkeysRight)
  1236                 {
  1234                 {
  1237                     canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(10).LayoutLine());
  1235                     canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(10).LayoutLine());
  1238                 }
  1236                 }
  1239                 else  //default mode:Softkeys bottom
  1237                 else
  1240                 {
  1238                 {
  1241                     resultRect = TRect(80,0,560,360);//temp code here.LAF correction needed!
  1239 #ifdef RD_JAVA_S60_RELEASE_9_2
  1242                     //canvasRect.LayoutRect( resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(9).LayoutLine() );
  1240                     canvasRect.LayoutRect( resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(9).LayoutLine() );
  1243 
  1241 #else
       
  1242                     resultRect = TRect(80,0,560,360); // Layout data not defined in older releases.
  1244                     DEBUG("- CMIDDisplayable::GetCanvasRectFromLaf");
  1243                     DEBUG("- CMIDDisplayable::GetCanvasRectFromLaf");
  1245                     return resultRect; //Temp code here.LAF correction needed!
  1244                     return resultRect;
       
  1245 #endif // RD_JAVA_S60_RELEASE_9_2
  1246                 }
  1246                 }
  1247             }
  1247             }
  1248         }
  1248         }
  1249         else//normal mode
  1249         else//normal mode
  1250         {
  1250         {
  1366     ASSERT(iContent);
  1366     ASSERT(iContent);
  1367 
  1367 
  1368     iActive = aCurrent;
  1368     iActive = aCurrent;
  1369     const TType type = iContent->Type();
  1369     const TType type = iContent->Type();
  1370 
  1370 
  1371 #ifdef RD_JAVA_NGA_ENABLED
       
  1372     HandleCanvasForeground(aCurrent);
  1371     HandleCanvasForeground(aCurrent);
  1373 #endif // RD_JAVA_NGA_ENABLED
       
  1374 
  1372 
  1375     if (aCurrent)
  1373     if (aCurrent)
  1376     {
  1374     {
  1377         // when setting displayable as current remember to deactivate
  1375         // when setting displayable as current remember to deactivate
  1378         // the default displayable if it has not been done yet
  1376         // the default displayable if it has not been done yet
  1583     // are full screen or not. This determines the rect returned by
  1581     // are full screen or not. This determines the rect returned by
  1584     // iAppUi->ClientRect()
  1582     // iAppUi->ClientRect()
  1585     CEikStatusPane* pane = iAppUi->StatusPane();
  1583     CEikStatusPane* pane = iAppUi->StatusPane();
  1586     pane->MakeVisible(!iIsFullScreenMode);
  1584     pane->MakeVisible(!iIsFullScreenMode);
  1587 
  1585 
  1588     java::ui::CoreUiAvkonAppUi* appUi = java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi();
  1586     java::ui::CoreUiAvkonAppUi* appUi =
       
  1587         java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi();
  1589     if (!iIsFullScreenMode && appUi && appUi->hidesIndicators())
  1588     if (!iIsFullScreenMode && appUi && appUi->hidesIndicators())
  1590     {
  1589     {
  1591         HideIndicators();
  1590         HideIndicators();
  1592     }
  1591     }
  1593 
  1592 
  1594     iCba->MakeVisible(!iIsFullScreenMode);
  1593     if (iCba)
       
  1594     {
       
  1595         iCba->MakeVisible(!iIsFullScreenMode);
       
  1596 
       
  1597 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  1598         // To enable clock pane in landscape after MIDlet was started
       
  1599         iCba->SetBoundingRect(TRect(0, 0, 0, 0));
       
  1600 #endif // RD_JAVA_S60_RELEASE_9_2
       
  1601     }
  1595 
  1602 
  1596     // Close fixed toolbar for full screen Canvas.
  1603     // Close fixed toolbar for full screen Canvas.
  1597     CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();
  1604     CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();
  1598     if (toolbar)
  1605     if (toolbar)
  1599     {
  1606     {
  1600         toolbar->SetToolbarVisibility(!iIsFullScreenMode);
  1607         toolbar->SetToolbarVisibility(!iIsFullScreenMode);
  1601     }
  1608     }
  1602 
  1609 
  1603 #ifdef RD_SCALABLE_UI_V2
  1610 #ifdef RD_SCALABLE_UI_V2
  1604     if ((iActive && iCanvasKeypad) || (!iActive && this->DrawableWindow()->IsFaded() && iCanvasKeypad))
  1611     if ((iActive && iCanvasKeypad)
       
  1612             || (!iActive && this->DrawableWindow()->IsFaded()
       
  1613                 && iCanvasKeypad))
  1605     {
  1614     {
  1606         if (iUseOnScreenKeypad)
  1615         if (iUseOnScreenKeypad)
  1607         {
  1616         {
  1608             iCanvasKeypad->UpdateVisualAppearanceL(
  1617             iCanvasKeypad->UpdateVisualAppearanceL(
  1609                 *iCanvas, iOnScreenKeyboardType, *this);
  1618                 *iCanvas, iOnScreenKeyboardType, *this);
  2211 
  2220 
  2212     TInt numLists = lists.Count();
  2221     TInt numLists = lists.Count();
  2213     TInt numSoftKeys = iSoftKeys.Count();
  2222     TInt numSoftKeys = iSoftKeys.Count();
  2214     ResetSoftKeysAndCommands(lists);
  2223     ResetSoftKeysAndCommands(lists);
  2215 
  2224 
       
  2225     // Variable implicitList is used when mapping commands to soft keys
       
  2226     // In case of IMPLICIT List with only OK or ITEM commands,
       
  2227     // no command is mapped to soft key and these commands are not
       
  2228     // populated to Options menu
       
  2229     TBool implicitList = EFalse;
       
  2230 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  2231     if (iContent && iContent->Type() == EList && iContentControl)
       
  2232     {
       
  2233         CMIDList* list = static_cast<CMIDList*>(iContentControl);
       
  2234         // Important: Set to ETrue only if List is IMPLICIT and there is no highlight
       
  2235         implicitList = (list->ListChoiceType() == MMIDChoiceGroup::EImplicit) &&
       
  2236                        !list->IsHighlighted();
       
  2237     }
       
  2238 #endif // RD_JAVA_S60_RELEASE_9_2
       
  2239 
  2216     // First map one command to every softkey if possible,
  2240     // First map one command to every softkey if possible,
  2217     // sks must have been ordered correctly, ie right key before
  2241     // sks must have been ordered correctly, ie right key before
  2218     // left key or else left key might get BACK cmd if not other
  2242     // left key or else left key might get BACK cmd if not other
  2219     // cmds are available.
  2243     // cmds are available.
  2220     for (TInt i = 0; i < numSoftKeys; i++)
  2244     for (TInt i = 0; i < numSoftKeys; i++)
  2221     {
  2245     {
  2222         for (TInt j = 0; j < numLists && !iSoftKeys[i]->HasAMappedCommand(); j++)
  2246         for (TInt j = 0; j < numLists && !iSoftKeys[i]->HasAMappedCommand(); j++)
  2223         {
  2247         {
  2224             if (lists[j])
  2248             if (lists[j])
  2225             {
  2249             {
  2226                 TInt index = lists[j]->FindCommandForSoftKey(*iSoftKeys[i]);
  2250                 TInt index = lists[j]->FindCommandForSoftKey(*iSoftKeys[i], implicitList);
  2227                 if (index != KErrNotFound)
  2251                 if (index != KErrNotFound)
  2228                 {
  2252                 {
  2229                     TInt commandId = lists[j]->CommandOffset() + index;
  2253                     TInt commandId = lists[j]->CommandOffset() + index;
  2230                     CMIDCommand* cmd = lists[j]->At(index).iCommand;
  2254                     CMIDCommand* cmd = lists[j]->At(index).iCommand;
  2231                     iSoftKeys[i]->Map(cmd);
  2255                     iSoftKeys[i]->Map(cmd);
  2238     }
  2262     }
  2239 
  2263 
  2240     // Then for the sk that can potentially accept an options menu,
  2264     // Then for the sk that can potentially accept an options menu,
  2241     // see if the mapped command must be replaced by the options menu
  2265     // see if the mapped command must be replaced by the options menu
  2242     // when there is at least one command that has not been mapped to any sk.
  2266     // when there is at least one command that has not been mapped to any sk.
       
  2267     // Important: Do not set Options menu in case of IMPLICIT List
       
  2268     // with only OK or ITEM commands
  2243     TBool needToDisplayMenu = EFalse;
  2269     TBool needToDisplayMenu = EFalse;
  2244     for (TInt j = 0; j < numLists && !needToDisplayMenu; j++)
  2270     for (TInt j = 0; j < numLists && !needToDisplayMenu; j++)
  2245     {
  2271     {
  2246         if (lists[j])
  2272         if (lists[j])
  2247         {
  2273         {
       
  2274             // Looping trough all commands
  2248             for (TInt i = 0; i < lists[j]->Count() && !needToDisplayMenu; i++)
  2275             for (TInt i = 0; i < lists[j]->Count() && !needToDisplayMenu; i++)
  2249             {
  2276             {
  2250                 needToDisplayMenu = !CommandIsMappedToSk(lists[j]->At(i).iCommand);
  2277                 CMIDCommand* cmd = lists[j]->At(i).iCommand;
       
  2278                 // In case that displayable is IMPLICIT List, we need to know,
       
  2279                 // if it has only OK or ITEM commands
       
  2280                 if (!(implicitList && (cmd->CommandType() == MMIDCommand::EOk ||
       
  2281                                        cmd->CommandType() == MMIDCommand::EItem)))
       
  2282                 {
       
  2283                     // There is at least one command, which is not mapped yet,
       
  2284                     // so it will be populated to Options menu.
       
  2285                     needToDisplayMenu = !CommandIsMappedToSk(cmd);
       
  2286                 }
  2251             }
  2287             }
  2252         }
  2288         }
  2253     }
  2289     }
  2254     if (needToDisplayMenu)
  2290     if (needToDisplayMenu)
  2255     {
  2291     {
  3080     iFullscreenCanvasLabelCacheIsValid = ETrue;
  3116     iFullscreenCanvasLabelCacheIsValid = ETrue;
  3081 
  3117 
  3082     DEBUG("- CMIDDisplayable::RenewFullscreenCanvasLabelCacheL");
  3118     DEBUG("- CMIDDisplayable::RenewFullscreenCanvasLabelCacheL");
  3083 }
  3119 }
  3084 
  3120 
  3085 #ifdef RD_JAVA_NGA_ENABLED
       
  3086 void CMIDDisplayable::HandleCanvasForeground(TBool aForeground)
  3121 void CMIDDisplayable::HandleCanvasForeground(TBool aForeground)
  3087 {
  3122 {
  3088     if (iContent && iContentControl &&
  3123     if (iContent && iContentControl &&
  3089             (iContent->Type() == MMIDComponent::ECanvas ||
  3124             (iContent->Type() == MMIDComponent::ECanvas ||
  3090              iContent->Type() == MMIDComponent::EGameCanvas))
  3125              iContent->Type() == MMIDComponent::EGameCanvas))
  3091     {
  3126     {
  3092         CMIDCanvas* canvas = static_cast<CMIDCanvas*>(iContentControl);
  3127         CMIDCanvas* canvas = static_cast<CMIDCanvas*>(iContentControl);
  3093         canvas->HandleForeground(aForeground);
  3128         canvas->HandleForeground(aForeground);
  3094     }
  3129     }
  3095 }
  3130 }
  3096 #endif // RD_JAVA_NGA_ENABLED
       
  3097 
  3131 
  3098 void CMIDDisplayable::HandleApplicationBackground()
  3132 void CMIDDisplayable::HandleApplicationBackground()
  3099 {
  3133 {
  3100     // If iCanvasKeypad exists, it notifies On-Screen Keypad
  3134     // If iCanvasKeypad exists, it notifies On-Screen Keypad
  3101     // about current application focus lost.
  3135     // about current application focus lost.
  3102     if (iCanvasKeypad)
  3136     if (iCanvasKeypad)
  3103     {
  3137     {
  3104         iCanvasKeypad->HandleApplicationBackground();
  3138         iCanvasKeypad->HandleApplicationBackground();
  3105     }
  3139     }
  3106 
  3140 
  3107 #ifdef RD_JAVA_NGA_ENABLED
  3141     HandleCanvasForeground(EFalse);    
  3108     HandleCanvasForeground(EFalse);
       
  3109 #endif // RD_JAVA_NGA_ENABLED    
       
  3110 }
  3142 }
  3111 
  3143 
  3112 void CMIDDisplayable::ProcessMSKCommandL()
  3144 void CMIDDisplayable::ProcessMSKCommandL()
  3113 {
  3145 {
  3114     if (iIdOfMSKCommand != KErrNotFound)
  3146     if (iIdOfMSKCommand != KErrNotFound)