uifw/EikStd/coctlsrc/eikspane.cpp
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 9 aabf2c525e0f
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   299             }
   299             }
   300         }
   300         }
   301 	return EFalse;
   301 	return EFalse;
   302 	}
   302 	}
   303 
   303 
       
   304 // ----------------------------------------------------------------------------
       
   305 // Sets the container control for the specified control and updates the
       
   306 // the whole parent hierarchy.
       
   307 // ----------------------------------------------------------------------------
       
   308 //
       
   309 static void SetContainersL( CCoeControl& aControl,
       
   310                             const CCoeControl& aContainer )
       
   311     {
       
   312     aControl.SetContainerWindowL( aContainer );
       
   313 
       
   314     TInt count = aControl.CountComponentControls();
       
   315 
       
   316     for ( TInt i = 0; i < count; ++i )
       
   317         {
       
   318         CCoeControl* child = aControl.ComponentControl( i );
       
   319         SetContainersL( *child, aControl );
       
   320         }
       
   321     }
   304 
   322 
   305 // ---------------------------------------------------------------------------
   323 // ---------------------------------------------------------------------------
   306 // Helper method to compose two layout lines together.
   324 // Helper method to compose two layout lines together.
   307 // ---------------------------------------------------------------------------
   325 // ---------------------------------------------------------------------------
   308 //
   326 //
  1143 
  1161 
  1144     /**
  1162     /**
  1145     * Handles resource change events.
  1163     * Handles resource change events.
  1146     */
  1164     */
  1147     void HandleResourceChange( TInt aType );
  1165     void HandleResourceChange( TInt aType );
       
  1166 
       
  1167     /**
       
  1168      * Sets the parent window of the container control and the child controls
       
  1169      * inside it.
       
  1170      * 
       
  1171      * @param  aParentWindowGroup   If not @c NULL, then the control is made
       
  1172      *                              window-owning with this window group
       
  1173      *                              as parent.
       
  1174      * @param  aParentControl       Control to be set as parent. Note that
       
  1175      *                              specifying this parameter has no effect
       
  1176      *                              if the @c aParentWindowGroup is not
       
  1177      *                              @c NULL.
       
  1178      * @param  aRedrawStoreHandler  Pointer to the redraw store handler should
       
  1179      *                              be also passed if @c aParentWindowGroup
       
  1180      *                              is specified.
       
  1181      */
       
  1182     void SetParentWindowL( RWindowGroup* aParentWindowGroup,
       
  1183                            CCoeControl* aParentControl,
       
  1184                            CRedrawStoreHandler* aRedrawStoreHandler );
       
  1185     
       
  1186     /**
       
  1187      * Sets the background drawer for the container control.
       
  1188      * 
       
  1189      * @param  aBackground  The background drawer.
       
  1190      */
       
  1191     void SetBackgroundDrawer( MCoeControlBackground* aBackground );
       
  1192     
       
  1193     /**
       
  1194      * Checks if the status pane container is in the idle (Home Screen)
       
  1195      * application. This check in required in some places since Home
       
  1196      * Screen draws the status pane background itself.
       
  1197      * 
       
  1198      * @return @c ETrue if in idle application, @c EFalse otherwise.
       
  1199      */
       
  1200     TBool InIdleApplication();
  1148 
  1201 
  1149 public: // From base class @c CCoeControl.
  1202 public: // From base class @c CCoeControl.
  1150 
  1203 
  1151     /**
  1204     /**
  1152     * Sets the dimming status.
  1205     * Sets the dimming status.
  1340     {
  1393     {
  1341     SetMopParent( iEikonEnv->EikAppUi() );
  1394     SetMopParent( iEikonEnv->EikAppUi() );
  1342 
  1395 
  1343     CreateWindowL( aParent );
  1396     CreateWindowL( aParent );
  1344     
  1397     
  1345     //This is added for homescreen transparent
  1398     // This is added for homescreen transparency support.
  1346     CEikApplication* app = iEikonEnv->EikAppUi()->Application();
  1399     if ( InIdleApplication()  )
  1347     if ( app && app->AppDllUid() == KActiveIdle2Uid  )
       
  1348         {
  1400         {
  1349         if( KErrNone == Window().SetTransparencyAlphaChannel())
  1401         if( KErrNone == Window().SetTransparencyAlphaChannel())
  1350             Window().SetBackgroundColor(~0);
  1402             Window().SetBackgroundColor(~0);
  1351         }
  1403         }
  1352     else
  1404     else
  2235             }
  2287             }
  2236 
  2288 
  2237         case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT:
  2289         case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT:
  2238         case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT: // fallthrough
  2290         case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT: // fallthrough
  2239             {
  2291             {
       
  2292             if ( aContextNumber == 0 )
       
  2293                 {
       
  2294                 // We use frame as layered context so that we can avoid having
       
  2295                 // two separate background contexts in this class.
       
  2296                 // In any case frame context is implemented using layered
       
  2297                 // context so this should be quite ok thing to do.
       
  2298 
       
  2299                 TAknLayoutRect layoutRect;
       
  2300                 layoutRect.LayoutRect(
       
  2301                     application_window,
       
  2302                     AknLayoutScalable_Avkon::area_top_pane( 2 ) );
       
  2303                 TRect topLayoutRect( layoutRect.Rect() );
       
  2304 
       
  2305                 layoutRect.LayoutRect(
       
  2306                     topLayoutRect,
       
  2307                     AknLayoutScalable_Avkon::status_pane( 1 ) );
       
  2308                 TRect spRect( layoutRect.Rect() );
       
  2309 
       
  2310                 layoutRect.LayoutRect(
       
  2311                     spRect,
       
  2312                     AknLayoutScalable_Avkon::bg_status_flat_pane( 0 ) );
       
  2313                 TRect bgRect( layoutRect.Rect() );
       
  2314 
       
  2315                 if ( aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT )
       
  2316                     {
       
  2317                     TAknLayoutRect extension;
       
  2318                     extension.LayoutRect(
       
  2319                         application_window,
       
  2320                         AknLayoutScalable_Avkon::main_pane( 4 ) );
       
  2321 
       
  2322                     // Wallpaper
       
  2323                     aBgContext->SetLayerImage( ELayerFlatWallpaper,
       
  2324                                                KAknsIIDWallpaper );
       
  2325                     aBgContext->SetLayerRect(  ELayerFlatWallpaper, screen );
       
  2326 
       
  2327                     // Main pane
       
  2328                     aBgContext->SetLayerImage( ELayerFlatMain,
       
  2329                                                KAknsIIDQsnBgAreaMainIdle );
       
  2330                     aBgContext->SetLayerRect( ELayerFlatMain,
       
  2331                                               extension.Rect() );
       
  2332 
       
  2333                     // Skin background, transparency support
       
  2334                     aBgContext->SetLayerImage( ELayerFlatBackground,
       
  2335                                                KAknsIIDQsnBgScreenIdle );
       
  2336                     aBgContext->SetLayerRect(  ELayerFlatBackground,
       
  2337                                                topLayoutRect );
       
  2338 
       
  2339                     // CBA area
       
  2340                     aBgContext->SetLayerImage( ELayerFlatCba,
       
  2341                                                KAknsIIDQsnBgAreaControlIdle );
       
  2342                     aBgContext->SetLayerRect( ELayerFlatCba, cbaRect );
       
  2343                     }
       
  2344                  else
       
  2345                     { // Not Idle.
       
  2346                     // Main pane
       
  2347                     aBgContext->SetLayerImage( ELayerFlatMain, KAknsIIDNone );
       
  2348 
       
  2349                     // Wallpaper
       
  2350                     aBgContext->SetLayerImage( ELayerFlatWallpaper,
       
  2351                                                KAknsIIDNone );
       
  2352 
       
  2353                     // Skin background, transparency support
       
  2354                     aBgContext->SetLayerImage( ELayerFlatBackground,
       
  2355                                                KAknsIIDQsnBgScreen );
       
  2356                     aBgContext->SetLayerRect( ELayerFlatBackground, screen );
       
  2357 
       
  2358                     // CBA area
       
  2359                     aBgContext->SetLayerImage( ELayerFlatCba, aCbaBgID );
       
  2360                     aBgContext->SetLayerRect( ELayerFlatCba, cbaRect );
       
  2361                     }
       
  2362 
       
  2363                 MAknsSkinInstance* si = AknsUtils::SkinInstance();
       
  2364                 CAknsItemData* idata  = NULL;
       
  2365                 if ( si )
       
  2366                     {
       
  2367                     TRAP_IGNORE(
       
  2368                         idata = si->CreateUncachedItemDataL(
       
  2369                             KAknsIIDQsnFrStatusFlat, EAknsITImageTable ) );
       
  2370                     }
       
  2371 
       
  2372                 if ( idata ) // 9 piece frame used
       
  2373                     {
       
  2374                     layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g2() );
       
  2375                     aBgContext->SetLayerImage( ELayerFlatTl, KAknsIIDQsnFrStatusFlatCornerTl );
       
  2376                     aBgContext->SetLayerRect( ELayerFlatTl, layoutRect.Rect() );
       
  2377 
       
  2378                     layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g3() );
       
  2379                     aBgContext->SetLayerImage( ELayerFlatTr, KAknsIIDQsnFrStatusFlatCornerTr );
       
  2380                     aBgContext->SetLayerRect( ELayerFlatTr, layoutRect.Rect() );
       
  2381 
       
  2382                     layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g4() );
       
  2383                     aBgContext->SetLayerImage( ELayerFlatBl, KAknsIIDQsnFrStatusFlatCornerBl );
       
  2384                     aBgContext->SetLayerRect( ELayerFlatBl, layoutRect.Rect() );
       
  2385 
       
  2386                     layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g5() );
       
  2387                     aBgContext->SetLayerImage( ELayerFlatBr, KAknsIIDQsnFrStatusFlatCornerBr );
       
  2388                     aBgContext->SetLayerRect( ELayerFlatBr, layoutRect.Rect() );
       
  2389 
       
  2390                     layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g6() );
       
  2391                     aBgContext->SetLayerImage( ELayerFlatT,  KAknsIIDQsnFrStatusFlatSideT);
       
  2392                     aBgContext->SetLayerRect( ELayerFlatT, layoutRect.Rect() );
       
  2393 
       
  2394                     layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g7() );
       
  2395                     aBgContext->SetLayerImage( ELayerFlatB, KAknsIIDQsnFrStatusFlatSideB );
       
  2396                     aBgContext->SetLayerRect( ELayerFlatB, layoutRect.Rect() );
       
  2397 
       
  2398                     layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g9() );
       
  2399                     aBgContext->SetLayerImage( ELayerFlatR, KAknsIIDQsnFrStatusFlatSideR );
       
  2400                     aBgContext->SetLayerRect( ELayerFlatR, layoutRect.Rect() );
       
  2401 
       
  2402                     layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g8() );
       
  2403                     aBgContext->SetLayerImage( ELayerFlatL, KAknsIIDQsnFrStatusFlatSideL );
       
  2404                     aBgContext->SetLayerRect( ELayerFlatL, layoutRect.Rect() );
       
  2405 
       
  2406                     layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g1() );
       
  2407                     aBgContext->SetLayerImage( ELayerFlatCenter, KAknsIIDQsnFrStatusFlatCenter );
       
  2408                     aBgContext->SetLayerRect( ELayerFlatCenter, layoutRect.Rect() );
       
  2409 
       
  2410                     if ( aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT )
       
  2411                         {
       
  2412                         maskIID = KAknsIIDQgnGrafBgLscTopMaskIcon;
       
  2413                         maskRect = spRect;
       
  2414                         }
       
  2415                     }
       
  2416                 else // handle one piece version here
       
  2417                     {
       
  2418                     if ( aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT )
       
  2419                         {
       
  2420                         // Wallpaper
       
  2421                         aBgContext->SetLayerImage( ELayerFlatWallpaper,
       
  2422                                                    KAknsIIDWallpaper );
       
  2423                         aBgContext->SetLayerRect( ELayerFlatWallpaper,
       
  2424                                                   staconTop );
       
  2425 
       
  2426                         // Skin background
       
  2427                         aBgContext->SetLayerImage( ELayerFlatBackground,
       
  2428                                                    KAknsIIDQsnFrStatusFlat );
       
  2429                         aBgContext->SetLayerRect( ELayerFlatBackground,
       
  2430                                                   bgRect );
       
  2431 
       
  2432                         // Set all other frame parts empty as they
       
  2433                         // might already be filled with something
       
  2434                         for ( TInt n = ELayerFlatBackground + 1; n <= ELayerFlatCenter; n++ )
       
  2435                            {
       
  2436                            aBgContext->SetLayerImage( n, KAknsIIDNone );
       
  2437                            }
       
  2438 
       
  2439                         maskIID = KAknsIIDQgnGrafBgLscTopMaskIcon;
       
  2440                         maskRect = spRect;
       
  2441                         }
       
  2442                     else
       
  2443                         {
       
  2444                         aBgContext->SetLayerImage( ELayerFlatWallpaper,
       
  2445                                                    KAknsIIDQsnFrStatusFlat );
       
  2446                         aBgContext->SetLayerRect( ELayerFlatWallpaper,
       
  2447                                                   bgRect );
       
  2448 
       
  2449                         // Set all other frame parts empty as they
       
  2450                         // might already be filled with something
       
  2451                         for ( TInt n = ELayerFlatBackground; n <= ELayerFlatCenter; n++ )
       
  2452                             {
       
  2453                             aBgContext->SetLayerImage( n, KAknsIIDNone );
       
  2454                             }
       
  2455                         }
       
  2456                     }
       
  2457 
       
  2458                 delete idata;
       
  2459                 }
       
  2460             else // context == 1 - this is the area removed from CBA for clock
       
  2461                  // and indicator panes.
       
  2462                 {
       
  2463                 if ( aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT )
       
  2464                     {
       
  2465                     aBgContext->SetLayerImage( ELayerFlatCbaWp,
       
  2466                                                KAknsIIDWallpaper );
       
  2467                     aBgContext->SetLayerRect( ELayerFlatCbaWp, screen );
       
  2468 
       
  2469                     maskIID = KAknsIIDQgnGrafBgLscBottomMaskIcon;
       
  2470                     maskRect = cbaRect;
       
  2471                     }
       
  2472                 else
       
  2473                     {
       
  2474                     aBgContext->SetLayerImage( ELayerFlatCbaWp, KAknsIIDNone );
       
  2475                     }
       
  2476 
       
  2477                 aBgContext->SetLayerImage( ELaterFlatCbaSkin,
       
  2478                                            KAknsIIDQsnBgAreaControlIdle );
       
  2479                 aBgContext->SetLayerRect( ELaterFlatCbaSkin, cbaRect );
       
  2480                 }
       
  2481 
       
  2482             break;
       
  2483             }
       
  2484 
       
  2485         case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS:
       
  2486         case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS: // fallthrough
       
  2487             {
  2240             TBool idleLayout =
  2488             TBool idleLayout =
  2241                 aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT;
  2489                 aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS;
  2242 
  2490 
  2243             TAknLayoutRect flatWideStatusPane;
  2491             TAknLayoutRect flatWideStatusPane;
  2244             flatWideStatusPane.LayoutRect(
  2492             flatWideStatusPane.LayoutRect(
  2245                 application_window,
  2493                 application_window,
  2246                 DoCompose( AknLayoutScalable_Avkon::area_top_pane( 19 ),
  2494                 DoCompose( AknLayoutScalable_Avkon::area_top_pane( 20 ),
  2247                            AknLayoutScalable_Avkon::status_pane( 4 ) ).LayoutLine() );
  2495                            AknLayoutScalable_Avkon::status_pane( 5 ) ).LayoutLine() );
  2248             TRect spRect( flatWideStatusPane.Rect() );
  2496             TRect spRect( flatWideStatusPane.Rect() );
  2249 
  2497 
  2250             if ( idleLayout )
  2498             if ( idleLayout )
  2251                 {
  2499                 {
  2252                 aBgContext->SetLayerImage( ELayerFlatWallpaper, KAknsIIDWallpaper );
  2500                 aBgContext->SetLayerImage( ELayerFlatWallpaper, KAknsIIDWallpaper );
  2258             aBgContext->SetLayerImage( ELayerFlatMain, KAknsIIDNone );
  2506             aBgContext->SetLayerImage( ELayerFlatMain, KAknsIIDNone );
  2259 
  2507 
  2260             aBgContext->SetLayerImage( ELayerFlatCba, KAknsIIDNone );
  2508             aBgContext->SetLayerImage( ELayerFlatCba, KAknsIIDNone );
  2261 
  2509 
  2262             MAknsSkinInstance* si = AknsUtils::SkinInstance();
  2510             MAknsSkinInstance* si = AknsUtils::SkinInstance();
  2263             CAknsItemData* idata = NULL;
  2511             CAknsItemData* idata  = NULL;
  2264             if ( si )
  2512             if ( si )
  2265                 {
  2513                 {
  2266                 TRAP_IGNORE(
  2514                 TRAP_IGNORE(
  2267                     idata = si->CreateUncachedItemDataL( KAknsIIDQsnFrStatusFlat,
  2515                     idata = si->CreateUncachedItemDataL( KAknsIIDQsnFrStatusFlat,
  2268                                                          EAknsITImageTable ) );
  2516                                                          EAknsITImageTable ) );
  2269                 }
  2517                 }
  2270 
  2518 
  2271             if ( idata ) // 9 piece frame used
  2519             if ( idata ) // 9 piece frame used
  2272                 {
  2520                 {
  2273                 if ( aCbaBgID == KAknsIIDQsnBgAreaControlMp )
  2521                 aBgContext->SetLayerImage(
  2274                     {
  2522                     ELayerFlatBackground,
  2275                     aBgContext->SetLayerImage( ELayerFlatBackground,
  2523                     idleLayout ? KAknsIIDQsnBgScreenIdle :
  2276                                                KAknsIIDQsnBgScreenMp );
  2524                                  KAknsIIDQsnBgScreen );
  2277                     }
       
  2278                 else
       
  2279                     {
       
  2280                     aBgContext->SetLayerImage(
       
  2281                         ELayerFlatBackground,
       
  2282                         idleLayout ? KAknsIIDQsnBgScreenIdle :
       
  2283                                      KAknsIIDQsnBgScreen );
       
  2284                     }
       
  2285                 aBgContext->SetLayerRect( ELayerFlatBackground, screen );
  2525                 aBgContext->SetLayerRect( ELayerFlatBackground, screen );
  2286 
  2526 
  2287                 TAknWindowLineLayout layout( AknLayoutScalable_Avkon::bg_status_flat_pane_g2().LayoutLine() );
  2527                 TAknWindowLineLayout layout( AknLayoutScalable_Avkon::bg_status_flat_pane_g2().LayoutLine() );
  2288                 layoutRect.LayoutRect( spRect, layout );
  2528                 layoutRect.LayoutRect( spRect, layout );
  2289                 aBgContext->SetLayerImage( ELayerFlatTl, KAknsIIDQsnFrStatusFlatCornerTl );
  2529                 aBgContext->SetLayerImage( ELayerFlatTl, KAknsIIDQsnFrStatusFlatCornerTl );
  2290                 aBgContext->SetLayerRect( ELayerFlatTl, layoutRect.Rect() );
  2530                 aBgContext->SetLayerRect( ELayerFlatTl, layoutRect.Rect() );
  2291 
  2531 
  2292                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g3().LayoutLine();
  2532                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g3().LayoutLine();
  2293                 layoutRect.LayoutRect( spRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g3() );
  2533                 layoutRect.LayoutRect( spRect, layout );
  2294                 aBgContext->SetLayerImage( ELayerFlatTr, KAknsIIDQsnFrStatusFlatCornerTr );
  2534                 aBgContext->SetLayerImage( ELayerFlatTr, KAknsIIDQsnFrStatusFlatCornerTr );
  2295                 aBgContext->SetLayerRect( ELayerFlatTr, layoutRect.Rect());
  2535                 aBgContext->SetLayerRect( ELayerFlatTr, layoutRect.Rect());
  2296 
  2536 
  2297                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g4().LayoutLine();
  2537                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g4().LayoutLine();
  2298                 layoutRect.LayoutRect( spRect, layout );
  2538                 layoutRect.LayoutRect( spRect, layout );
  2339                 }
  2579                 }
  2340 
  2580 
  2341             break;
  2581             break;
  2342             }
  2582             }
  2343 
  2583 
  2344         case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS:
       
  2345         case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS: // fallthrough
       
  2346             {
       
  2347             TBool idleLayout =
       
  2348                 aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS;
       
  2349 
       
  2350             TAknLayoutRect flatWideStatusPane;
       
  2351             flatWideStatusPane.LayoutRect(
       
  2352                 application_window,
       
  2353                 DoCompose( AknLayoutScalable_Avkon::area_top_pane( 20 ),
       
  2354                            AknLayoutScalable_Avkon::status_pane( 5 ) ).LayoutLine() );
       
  2355             TRect spRect( flatWideStatusPane.Rect() );
       
  2356 
       
  2357             if ( idleLayout )
       
  2358                 {
       
  2359                 aBgContext->SetLayerImage( ELayerFlatWallpaper, KAknsIIDWallpaper );
       
  2360                 aBgContext->SetLayerRect( ELayerFlatWallpaper, screen );
       
  2361                 maskIID  = KAknsIIDQgnGrafBgLscTopMaskIcon;
       
  2362                 maskRect = spRect;
       
  2363                 }
       
  2364 
       
  2365             aBgContext->SetLayerImage( ELayerFlatMain, KAknsIIDNone );
       
  2366 
       
  2367             aBgContext->SetLayerImage( ELayerFlatCba, KAknsIIDNone );
       
  2368 
       
  2369             MAknsSkinInstance* si = AknsUtils::SkinInstance();
       
  2370             CAknsItemData* idata  = NULL;
       
  2371             if ( si )
       
  2372                 {
       
  2373                 TRAP_IGNORE(
       
  2374                     idata = si->CreateUncachedItemDataL( KAknsIIDQsnFrStatusFlat,
       
  2375                                                          EAknsITImageTable ) );
       
  2376                 }
       
  2377 
       
  2378             if ( idata ) // 9 piece frame used
       
  2379                 {
       
  2380                 aBgContext->SetLayerImage(
       
  2381                     ELayerFlatBackground,
       
  2382                     idleLayout ? KAknsIIDQsnBgScreenIdle :
       
  2383                                  KAknsIIDQsnBgScreen );
       
  2384                 aBgContext->SetLayerRect( ELayerFlatBackground, screen );
       
  2385 
       
  2386                 TAknWindowLineLayout layout( AknLayoutScalable_Avkon::bg_status_flat_pane_g2().LayoutLine() );
       
  2387                 layoutRect.LayoutRect( spRect, layout );
       
  2388                 aBgContext->SetLayerImage( ELayerFlatTl, KAknsIIDQsnFrStatusFlatCornerTl );
       
  2389                 aBgContext->SetLayerRect( ELayerFlatTl, layoutRect.Rect() );
       
  2390 
       
  2391                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g3().LayoutLine();
       
  2392                 layoutRect.LayoutRect( spRect, layout );
       
  2393                 aBgContext->SetLayerImage( ELayerFlatTr, KAknsIIDQsnFrStatusFlatCornerTr );
       
  2394                 aBgContext->SetLayerRect( ELayerFlatTr, layoutRect.Rect());
       
  2395 
       
  2396                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g4().LayoutLine();
       
  2397                 layoutRect.LayoutRect( spRect, layout );
       
  2398                 aBgContext->SetLayerImage( ELayerFlatBl, KAknsIIDQsnFrStatusFlatCornerBl );
       
  2399                 aBgContext->SetLayerRect( ELayerFlatBl, layoutRect.Rect() );
       
  2400 
       
  2401                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g5().LayoutLine();
       
  2402                 layoutRect.LayoutRect( spRect, layout );
       
  2403                 aBgContext->SetLayerImage( ELayerFlatBr, KAknsIIDQsnFrStatusFlatCornerBr );
       
  2404                 aBgContext->SetLayerRect( ELayerFlatBr, layoutRect.Rect() );
       
  2405 
       
  2406                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g6().LayoutLine();
       
  2407                 layoutRect.LayoutRect( spRect, layout );
       
  2408                 aBgContext->SetLayerImage( ELayerFlatT,  KAknsIIDQsnFrStatusFlatSideT);
       
  2409                 aBgContext->SetLayerRect( ELayerFlatT, layoutRect.Rect() );
       
  2410 
       
  2411                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g7().LayoutLine();
       
  2412                 layoutRect.LayoutRect( spRect, layout );
       
  2413                 aBgContext->SetLayerImage( ELayerFlatB, KAknsIIDQsnFrStatusFlatSideB );
       
  2414                 aBgContext->SetLayerRect( ELayerFlatB, layoutRect.Rect() );
       
  2415 
       
  2416                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g9().LayoutLine();
       
  2417                 layoutRect.LayoutRect( spRect, layout );
       
  2418                 aBgContext->SetLayerImage( ELayerFlatR, KAknsIIDQsnFrStatusFlatSideR );
       
  2419                 aBgContext->SetLayerRect( ELayerFlatR, layoutRect.Rect() );
       
  2420 
       
  2421                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g8().LayoutLine();
       
  2422                 layoutRect.LayoutRect( spRect, layout );
       
  2423                 aBgContext->SetLayerImage( ELayerFlatL, KAknsIIDQsnFrStatusFlatSideL );
       
  2424                 aBgContext->SetLayerRect( ELayerFlatL, layoutRect.Rect() );
       
  2425 
       
  2426                 layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g1().LayoutLine();
       
  2427                 layoutRect.LayoutRect( spRect, layout );
       
  2428                 aBgContext->SetLayerImage( ELayerFlatCenter, KAknsIIDQsnFrStatusFlatCenter );
       
  2429                 aBgContext->SetLayerRect( ELayerFlatCenter, layoutRect.Rect() );
       
  2430 
       
  2431                 delete idata;
       
  2432                 }
       
  2433             else
       
  2434                 {
       
  2435                 aBgContext->SetLayerImage( ELayerFlatBackground,
       
  2436                                            KAknsIIDQsnFrStatusFlat );
       
  2437                 aBgContext->SetLayerRect( ELayerFlatBackground, spRect );
       
  2438                 }
       
  2439 
       
  2440             break;
       
  2441             }
       
  2442 
       
  2443         default:
  2584         default:
  2444             {
  2585             {
  2445             for ( TInt n = 0; n < ELayerFlatN; n++ )
  2586             for ( TInt n = 0; n < ELayerFlatN; n++ )
  2446                 {
  2587                 {
  2447                 aBgContext->SetLayerImage( n, KAknsIIDNone );
  2588                 aBgContext->SetLayerImage( n, KAknsIIDNone );
  2468 
  2609 
  2469     if ( iControl )
  2610     if ( iControl )
  2470         {
  2611         {
  2471         iControl->HandleResourceChange( aType );
  2612         iControl->HandleResourceChange( aType );
  2472         }
  2613         }
       
  2614     }
       
  2615 
       
  2616 
       
  2617 // ---------------------------------------------------------------------------
       
  2618 // Sets the parent window of the container control and the child controls
       
  2619 // inside it.
       
  2620 // ---------------------------------------------------------------------------
       
  2621 //
       
  2622 void CEikStatusPaneContainer::SetParentWindowL(
       
  2623     RWindowGroup* aParentWindowGroup,
       
  2624     CCoeControl* aParentControl,
       
  2625     CRedrawStoreHandler* aRedrawStoreHandler )
       
  2626     {
       
  2627     if ( aParentWindowGroup )
       
  2628         {
       
  2629         MakeVisible( EFalse );
       
  2630     
       
  2631         SetMopParent( iEikonEnv->EikAppUi() );
       
  2632         SetParent( NULL );
       
  2633 
       
  2634         if ( OwnsWindow() )
       
  2635             {
       
  2636             CloseWindow();
       
  2637             }
       
  2638 
       
  2639         CreateWindowL( aParentWindowGroup );
       
  2640 
       
  2641         // Enable the transparency only in HomeScreen where it's needed
       
  2642         // for performance reasons.
       
  2643         if ( InIdleApplication() )
       
  2644             {
       
  2645             EnableWindowTransparency();
       
  2646             }
       
  2647         else
       
  2648             {
       
  2649             Window().SetBackgroundColor(
       
  2650                 iEikonEnv->ControlColor( EColorStatusPaneBackground, *this ) );
       
  2651             }
       
  2652 
       
  2653         RWindow& window = Window();
       
  2654         if ( aRedrawStoreHandler )
       
  2655             {
       
  2656             aRedrawStoreHandler->SetStore( &window, KEnableRedrawStoring );
       
  2657             }
       
  2658         
       
  2659         window.SetPointerGrab( ETrue );
       
  2660         window.SetShadowDisabled( ETrue );
       
  2661         window.SetNonFading( !LafStatusPaneContainer::AllowFading() );
       
  2662         EnableDragEvents();
       
  2663 
       
  2664         SetContainersL( *iControl, *this );
       
  2665         
       
  2666         ActivateL();
       
  2667         }
       
  2668     else if ( aParentControl )
       
  2669         {
       
  2670         SetContainersL( *this, *aParentControl );
       
  2671         }
       
  2672     }
       
  2673 
       
  2674 
       
  2675 // ---------------------------------------------------------------------------
       
  2676 // Sets the background drawer for the container control.
       
  2677 // ---------------------------------------------------------------------------
       
  2678 //
       
  2679 void CEikStatusPaneContainer::SetBackgroundDrawer(
       
  2680     MCoeControlBackground* aBackground )
       
  2681     {
       
  2682     if ( aBackground && InIdleApplication() )
       
  2683         {
       
  2684         // In Home Screen the application draws also the status
       
  2685         // pane background.
       
  2686         aBackground = NULL;
       
  2687         }
       
  2688     
       
  2689     SetBackground( aBackground );
       
  2690     }
       
  2691 
       
  2692 
       
  2693 // ---------------------------------------------------------------------------
       
  2694 // Checks if the status pane container is in the Home Screen application.
       
  2695 // ---------------------------------------------------------------------------
       
  2696 //
       
  2697 TBool CEikStatusPaneContainer::InIdleApplication()
       
  2698     {
       
  2699     TBool retVal( EFalse );
       
  2700 
       
  2701     CEikApplication* app = iEikonEnv->EikAppUi()->Application();
       
  2702     if ( app && app->AppDllUid() == KActiveIdle2Uid  )
       
  2703         {
       
  2704         retVal = ETrue;
       
  2705         }
       
  2706 
       
  2707     return retVal;
  2473     }
  2708     }
  2474 
  2709 
  2475 
  2710 
  2476 // ---------------------------------------------------------------------------
  2711 // ---------------------------------------------------------------------------
  2477 // CEikStatusPaneContainer::Draw
  2712 // CEikStatusPaneContainer::Draw
  2651 
  2886 
  2652 
  2887 
  2653 /**
  2888 /**
  2654  * Internal extension class
  2889  * Internal extension class
  2655  */
  2890  */
  2656 class CEikStatusPaneBaseExtension : public CBase
  2891 class CEikStatusPaneBaseExtension : public CBase,
       
  2892                                     public MCoeControlBackground
  2657     {
  2893     {
  2658 public:
  2894 public:
  2659     static CEikStatusPaneBaseExtension* NewL()
  2895     static CEikStatusPaneBaseExtension* NewL()
  2660         {
  2896         {
  2661         CEikStatusPaneBaseExtension* self =
  2897         CEikStatusPaneBaseExtension* self =
  2673 
  2909 
  2674     ~CEikStatusPaneBaseExtension()
  2910     ~CEikStatusPaneBaseExtension()
  2675         {
  2911         {
  2676         };
  2912         };
  2677 
  2913 
       
  2914     // From base class MCoeControlBackground
       
  2915     // This is used for drawing background of all status pane containers.
       
  2916     void Draw( CWindowGc& aGc,
       
  2917                const CCoeControl& aControl,
       
  2918                const TRect& aRect ) const
       
  2919         {
       
  2920         if ( iCommonBgContext )
       
  2921             {
       
  2922             AknsDrawUtils::DrawBackground( AknsUtils::SkinInstance(),
       
  2923                                            AknsDrawUtils::ControlContext( &aControl ),
       
  2924                                            &aControl,
       
  2925                                            aGc,
       
  2926                                            TPoint( 0, 0 ),
       
  2927                                            aRect,
       
  2928                                            KAknsDrawParamDefault );
       
  2929             }
       
  2930         }
       
  2931 		
  2678 public:
  2932 public:
  2679 
  2933 
  2680     /** Resource id that last has been reuqested by app using switch layout. */
  2934     /** Resource id that last has been reuqested by app using switch layout. */
  2681 	TInt iLastRequestedResourceId;
  2935 	TInt iLastRequestedResourceId;
  2682 
  2936 
  2798 	    	clearer->EnableBlank();
  3052 	    	clearer->EnableBlank();
  2799 	    	forcedBlank = ETrue;
  3053 	    	forcedBlank = ETrue;
  2800 	    	}
  3054 	    	}
  2801     	}
  3055     	}
  2802 
  3056 
       
  3057     // Check if combined pane was used in the previous status pane layout
       
  3058     // to avoid unnecessary subpane parent hierarchy changes.
       
  3059     TBool combinedPaneInOldLayout(
       
  3060         PaneCapabilities(
       
  3061             TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() );
  2803 
  3062 
  2804     // If AknLayout system is used for placing statuspane elements, then
  3063     // If AknLayout system is used for placing statuspane elements, then
  2805     // we need to be less strict when new layout is applied or size change
  3064     // we need to be less strict when new layout is applied or size change
  2806     // is reported. This is because AknLayout data may change even when
  3065     // is reported. This is because AknLayout data may change even when
  2807     // statuspane layout id doesn't e.g. in dynamic variant changes etc.
  3066     // statuspane layout id doesn't e.g. in dynamic variant changes etc.
  2828 	CEikStatusPaneLayout* newLayout = iModel->CurrentLayout();
  3087 	CEikStatusPaneLayout* newLayout = iModel->CurrentLayout();
  2829 	if ( newLayout != oldLayout || aknLayoutUsed )
  3088 	if ( newLayout != oldLayout || aknLayoutUsed )
  2830 		{
  3089 		{
  2831 		// Need to refresh the model's layout.
  3090 		// Need to refresh the model's layout.
  2832 	    iModel->AknLayoutRefresh();
  3091 	    iModel->AknLayoutRefresh();
       
  3092 
       
  3093         // Update the combined pane's subpane parent hierarchy if necessary. 
       
  3094         TBool combinedPaneInCurrentLayout(
       
  3095             PaneCapabilities(
       
  3096                 TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() );
       
  3097         if ( !COMPARE_BOOLS( combinedPaneInOldLayout,
       
  3098                              combinedPaneInCurrentLayout ) )
       
  3099             {
       
  3100             SetCombinedPaneVisibilityL( combinedPaneInCurrentLayout );
       
  3101             }
  2833 
  3102 
  2834         TBool drawNavi = ETrue;
  3103         TBool drawNavi = ETrue;
  2835 
  3104 
  2836 		if ( clearer )
  3105 		if ( clearer )
  2837 			{
  3106 			{
  3079 
  3348 
  3080 	iModel = CreateModelL( aCoreResId );
  3349 	iModel = CreateModelL( aCoreResId );
  3081 	iControls =
  3350 	iControls =
  3082 	    new (ELeave) CContainerControls( KEikStatusPaneControlGranularity );
  3351 	    new (ELeave) CContainerControls( KEikStatusPaneControlGranularity );
  3083 	CreatePanesL();
  3352 	CreatePanesL();
       
  3353 	
       
  3354 	SetCombinedPaneVisibilityL(
       
  3355 	    PaneCapabilities(
       
  3356             TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() );
       
  3357 	
  3084 	ApplyLayoutL( iModel->CurrentLayout(), ENoDraw );
  3358 	ApplyLayoutL( iModel->CurrentLayout(), ENoDraw );
  3085 
  3359 
  3086 	// Clearer is not needed anymore if all panes are drawn in app side.
  3360 	// Clearer is not needed anymore if all panes are drawn in app side.
  3087 	//iExtension->iBlankStatuspane = CAknStatuspaneClearer::NewL(*iParentWindowGroup, 0, !IsApp());
  3361 	//iExtension->iBlankStatuspane = CAknStatuspaneClearer::NewL(*iParentWindowGroup, 0, !IsApp());
  3088     //iExtension->iBlankStatuspane->SetSkinBackgroundContext(CurrentLayoutResId());
  3362     //iExtension->iBlankStatuspane->SetSkinBackgroundContext(CurrentLayoutResId());
  3127             iExtension->iCommonBgContext->GetControlContext( 0 ) ),
  3401             iExtension->iCommonBgContext->GetControlContext( 0 ) ),
  3128         static_cast<CAknsMaskedLayerBackgroundControlContext*>(
  3402         static_cast<CAknsMaskedLayerBackgroundControlContext*>(
  3129             iExtension->iCommonBgContext->GetControlContext( 1 ) ),
  3403             iExtension->iCommonBgContext->GetControlContext( 1 ) ),
  3130         iExtension->iDataSubscriber,
  3404         iExtension->iDataSubscriber,
  3131         *iExtension->iRedrawStoreHandler );
  3405         *iExtension->iRedrawStoreHandler );
       
  3406 
       
  3407     cont->SetBackgroundDrawer( iExtension );
       
  3408 
  3132     CleanupStack::PushL( cont );
  3409     CleanupStack::PushL( cont );
  3133     iControls->AppendL( cont );
  3410     iControls->AppendL( cont );
  3134     CleanupStack::Pop( cont );
  3411     CleanupStack::Pop( cont );
  3135     }
  3412     }
  3136 
  3413 
  3162 
  3439 
  3163      // In stacon, make a second prepare and draw. This is due to that stacon
  3440      // In stacon, make a second prepare and draw. This is due to that stacon
  3164     // has two background contextes.
  3441     // has two background contextes.
  3165     if ( ( layoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT ||
  3442     if ( ( layoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT ||
  3166            layoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT ||
  3443            layoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT ||
  3167            layoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT ) )
  3444            layoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT ||
       
  3445            layoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT ||
       
  3446            layoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ) )
  3168         {
  3447         {
  3169         partOfCombinedContext =
  3448         partOfCombinedContext =
  3170             iExtension->iCommonBgContext->GetControlContext( 1 );
  3449             iExtension->iCommonBgContext->GetControlContext( 1 );
  3171 
  3450 
  3172         CEikStatusPaneContainer::PrepareBackgroundContext(
  3451         CEikStatusPaneContainer::PrepareBackgroundContext(
  3505             }
  3784             }
  3506         }
  3785         }
  3507 
  3786 
  3508     // Return largest bounding rect.
  3787     // Return largest bounding rect.
  3509     return largestBoundingRect;
  3788     return largestBoundingRect;
       
  3789     }
       
  3790 
       
  3791 
       
  3792 // ---------------------------------------------------------------------------
       
  3793 // CEikStatusPaneBase::SetCombinedPaneVisibility
       
  3794 // Updates the parent hierarchy of subpanes in the combined pane based
       
  3795 // on whether or not the combined pane is used in the current status pane
       
  3796 // layout.
       
  3797 // ---------------------------------------------------------------------------
       
  3798 //
       
  3799 void CEikStatusPaneBase::SetCombinedPaneVisibilityL( TBool aVisible )
       
  3800     {
       
  3801     CEikStatusPaneContainer* combinedPane =
       
  3802         Find( TUid::Uid( EEikStatusPaneUidCombined ) );
       
  3803     if ( combinedPane )
       
  3804         {
       
  3805         CCoeControl* combinedPaneControl = combinedPane->Control();
       
  3806 
       
  3807         // The subpane container controls inside combined pane are it's
       
  3808         // component controls.
       
  3809         TInt count( combinedPaneControl->CountComponentControls() );
       
  3810 
       
  3811         for ( TInt i = 0; i < count; ++i )
       
  3812             {
       
  3813             CEikStatusPaneContainer* subPane =
       
  3814                 static_cast<CEikStatusPaneContainer*>(
       
  3815                     combinedPaneControl->ComponentControl( i ) );
       
  3816             if ( subPane )
       
  3817                 {
       
  3818                 if ( aVisible )
       
  3819                     {
       
  3820                     subPane->SetParentWindowL( NULL,
       
  3821                                                combinedPaneControl,
       
  3822                                                NULL );
       
  3823                     // Background is drawn by the combined pane so remove
       
  3824                     // the subpane's own background drawer. 
       
  3825                     subPane->SetBackgroundDrawer( NULL );
       
  3826                     }
       
  3827                 else
       
  3828                     {
       
  3829                     subPane->SetParentWindowL(
       
  3830                         iParentWindowGroup,
       
  3831                         NULL,
       
  3832                         iExtension ? iExtension->iRedrawStoreHandler : NULL );
       
  3833                     subPane->SetBackgroundDrawer( iExtension );
       
  3834                     }
       
  3835                 }
       
  3836             }
       
  3837         }
  3510     }
  3838     }
  3511 
  3839 
  3512 
  3840 
  3513 /**
  3841 /**
  3514  * Visitor class for collecting the sub-pane areas to a single region.
  3842  * Visitor class for collecting the sub-pane areas to a single region.