exampleapps/alfexstickers/src/alfexstickersappui.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2008 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:   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <avkon.hrh>
       
    20 #include <aknnotewrappers.h> 
       
    21 
       
    22 #include <alf/alfdisplay.h> 
       
    23 #include <alf/alfenv.h> 
       
    24 #include <alf/alfcontrolgroup.h>
       
    25 #include <alf/alfroster.h>
       
    26 
       
    27 
       
    28 #include "AlfExStickers.pan"
       
    29 #include "AlfExStickersAppUi.h"
       
    30 #include "AlfExStickers.hrh"
       
    31 #include "AlfExStickersControl.h"
       
    32 
       
    33 const TInt KAlfExStickersControlGroupId = 1;
       
    34 
       
    35 // ConstructL is called by the application framework
       
    36 void CAlfExStickersAppUi::ConstructL()
       
    37     {
       
    38     BaseConstructL(EAknEnableSkin);
       
    39     iEnv = CAlfEnv::NewL();
       
    40     TRect rect;
       
    41     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect);
       
    42     CAlfDisplay& display = 
       
    43         iEnv->NewDisplayL(rect, CAlfEnv::ENewDisplayAsCoeControl);
       
    44 
       
    45     display.SetClearBackgroundL(CAlfDisplay::EClearWithSkinBackground);
       
    46     
       
    47     CAlfControlGroup& group = 
       
    48         iEnv->NewControlGroupL(KAlfExStickersControlGroupId);
       
    49 
       
    50     CAlfExStickersControl* control = CAlfExStickersControl::NewLC(*iEnv, &iCoeEnv->FsSession());
       
    51     group.AppendL(control);
       
    52     CleanupStack::Pop(control);
       
    53     
       
    54     iCoeEnv->FsSession();
       
    55     
       
    56     
       
    57     display.Roster().ShowL(group);
       
    58     
       
    59     }
       
    60 
       
    61 
       
    62 CAlfExStickersAppUi::CAlfExStickersAppUi()                              
       
    63     {
       
    64 	// no implementation required
       
    65     }
       
    66 
       
    67 
       
    68 CAlfExStickersAppUi::~CAlfExStickersAppUi()
       
    69     {
       
    70     delete iEnv;
       
    71     }
       
    72 
       
    73 
       
    74 // handle any menu commands
       
    75 void CAlfExStickersAppUi::HandleCommandL(TInt aCommand)
       
    76     {
       
    77     switch(aCommand)
       
    78         {
       
    79         case EEikCmdExit:
       
    80         case EAknSoftkeyExit:
       
    81             Exit();
       
    82             break;
       
    83           
       
    84         /*
       
    85         case EAlfExStickersCommand1:
       
    86             {
       
    87             _LIT(message,"Hello!");
       
    88             CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
       
    89             informationNote->ExecuteLD(message);
       
    90             }
       
    91             break;
       
    92 		*/
       
    93         default:
       
    94             Panic(EAlfExStickersBasicUi);
       
    95             break;
       
    96         }
       
    97     }
       
    98 
       
    99 void CAlfExStickersAppUi::HandleResourceChangeL( TInt aType )
       
   100     {
       
   101     CAknAppUi::HandleResourceChangeL( aType );
       
   102 
       
   103     if ( iEnv && aType == KEikDynamicLayoutVariantSwitch )
       
   104         {
       
   105         iEnv->NotifyLayoutChangedL();
       
   106         }
       
   107     }
       
   108     
       
   109 void CAlfExStickersAppUi::HandleWsEventL(const TWsEvent &aEvent, CCoeControl* aDestination)
       
   110     {
       
   111     switch(aEvent.Type())
       
   112         {
       
   113         case KAknFullOrPartialForegroundLost:
       
   114             iEnv->Release();
       
   115             break;
       
   116         case KAknFullOrPartialForegroundGained:
       
   117             iEnv->RestoreL();
       
   118             break;
       
   119         default:
       
   120             break;
       
   121         }
       
   122     CAknAppUi::HandleWsEventL(aEvent, aDestination);
       
   123     }