examples/S60CppExamples/ClientServerSync/client/src/cssyncappui.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : cssyncappui.cpp
00004 *  Part of     : CSSync
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2006 Nokia Corporation.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 
00017 // INCLUDE FILES
00018 #include <eikmenup.h>
00019 #include <avkon.hrh>
00020 
00021 #include "CSSync.pan"
00022 #include "CSSyncAppUi.h"
00023 #include "CSSyncAppView.h"
00024 #include "CSSyncDocument.h"
00025 #include "CSSync.hrh"
00026 
00027 
00028 // ========================= MEMBER FUNCTIONS ==================================
00029 
00030 // -----------------------------------------------------------------------------
00031 // CCSSyncAppUi::CCSSyncAppUi()
00032 // C++ default constructor can NOT contain any code, that might leave.
00033 // -----------------------------------------------------------------------------
00034 //
00035 CCSSyncAppUi::CCSSyncAppUi()
00036     {
00037     // No implementation required
00038     }
00039 
00040 // -----------------------------------------------------------------------------
00041 // CCSSyncAppUi::ConstructL()
00042 // Symbian 2nd phase constructor can leave.
00043 // -----------------------------------------------------------------------------
00044 //
00045 void CCSSyncAppUi::ConstructL()
00046     {
00047     BaseConstructL();
00048 
00049     iAppView = CCSSyncAppView::NewL( ClientRect(), *SyncDocument() );
00050 
00051     AddToStackL( iAppView );
00052     }
00053 
00054 // -----------------------------------------------------------------------------
00055 // CCSSyncAppUi::~CCSSyncAppUi()
00056 // Destructor.
00057 // -----------------------------------------------------------------------------
00058 //
00059 CCSSyncAppUi::~CCSSyncAppUi()
00060     {
00061     if ( iAppView )
00062         {
00063         iEikonEnv->RemoveFromStack( iAppView );
00064         delete iAppView;
00065         iAppView = NULL;
00066         }
00067     }
00068 
00069 // -----------------------------------------------------------------------------
00070 // CCSSyncAppUi::SyncDocument()
00071 // Casts iDocument member from CAknAppUi to CCSSyncDocument.
00072 // -----------------------------------------------------------------------------
00073 //
00074 CCSSyncDocument* CCSSyncAppUi::SyncDocument() const
00075     {
00076     return static_cast<CCSSyncDocument*>( iDocument );
00077     }
00078 
00079 // -----------------------------------------------------------------------------
00080 // CCSSyncAppUi::HandleCommandL()
00081 // Handles user menu selections.
00082 // -----------------------------------------------------------------------------
00083 //
00084 void CCSSyncAppUi::HandleCommandL( TInt aCommand )
00085     {
00086     switch( aCommand )
00087         {
00088         case EEikCmdExit:
00089         case EAknSoftkeyExit:
00090             Exit();
00091             break;
00092 
00093         case EDisplayTime:
00094             // Pull the time from the server
00095             SyncDocument()->UpdateTime();
00096 
00097             // Get view to display the new time
00098             iAppView->DrawNow();
00099             break;
00100 
00101         default:
00102             break;
00103         }
00104     }
00105 
00106 // -----------------------------------------------------------------------------
00107 // CCSSyncAppUi::HandleResourceChangeL( TInt aType )
00108 // Called by framework when layout is changed.
00109 // -----------------------------------------------------------------------------
00110 //
00111 void CCSSyncAppUi::HandleResourceChangeL( TInt aType )
00112     {
00113     CAknAppUi::HandleResourceChangeL( aType );
00114 
00115     if ( aType==KEikDynamicLayoutVariantSwitch )
00116         {
00117         iAppView->SetRect( ClientRect() );
00118         }
00119     //Controls derived from CCoeControl, handled in container class
00120     iAppView->HandleResourceChange( aType );
00121     }
00122 
00123 // End of File

Generated by  doxygen 1.6.2