examples/sfexamples/GfxWorkbench/src/GfxWorkbenchAppUi.cpp

00001 /*
00002 Copyright (c) 2002-2011 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:  CGfxWorkbenchAppUi implementation
00028 */
00029 
00030 
00031 // INCLUDE FILES
00032 #include <avkon.hrh>
00033 #include <aknnotewrappers.h>
00034 #include <stringloader.h>
00035 #include <GfxWorkbench.rsg>
00036 #include <f32file.h>
00037 #include <s32file.h>
00038 
00039 #include "GfxWorkbench.pan"
00040 #include "GfxWorkbenchAppUi.h"
00041 #include "GfxWorkbenchAppView.h"
00042 #include "GfxWorkbench.hrh"
00043 #include "GfxVideoPlayer.h"
00044 #include "GfxDirectScreenView.h"
00045 #include "GfxDirectScreenBitmapView.h"
00046 #include "GfxBitBlitView.h"
00047 #include "GfxIclview.h"
00048 
00049 _LIT( KFileName, "C:\\private\\E2E23815\\GfxWorkbench.txt" );
00050 _LIT( KText, "GFX Demo");
00051 
00052 // ============================ MEMBER FUNCTIONS ===============================
00053 
00054 
00055 // -----------------------------------------------------------------------------
00056 // CGfxWorkbenchAppUi::ConstructL()
00057 // Symbian 2nd phase constructor can leave.
00058 // -----------------------------------------------------------------------------
00059 //
00060 void CGfxWorkbenchAppUi::ConstructL()
00061         {
00062         // Initialise app UI with standard value.
00063         BaseConstructL(CAknAppUi::EAknEnableSkin);
00064 
00065         // Create view object
00066         iAppView = CGfxWorkbenchAppView::NewL( ClientRect() );
00067         }
00068 // -----------------------------------------------------------------------------
00069 // CGfxWorkbenchAppUi::CGfxWorkbenchAppUi()
00070 // C++ default constructor can NOT contain any code, that might leave.
00071 // -----------------------------------------------------------------------------
00072 //
00073 CGfxWorkbenchAppUi::CGfxWorkbenchAppUi()
00074         {
00075         // No implementation required
00076         }
00077 
00078 // -----------------------------------------------------------------------------
00079 // CGfxWorkbenchAppUi::~CGfxWorkbenchAppUi()
00080 // Destructor.
00081 // -----------------------------------------------------------------------------
00082 //
00083 CGfxWorkbenchAppUi::~CGfxWorkbenchAppUi()
00084         {
00085         ClearView();
00086         
00087         delete iAppView,iAppView = NULL;
00088 
00089         }
00090 
00091 // -----------------------------------------------------------------------------
00092 // CGfxWorkbenchAppUi::HandleCommandL()
00093 // Takes care of command handling.
00094 // -----------------------------------------------------------------------------
00095 //
00096 void CGfxWorkbenchAppUi::HandleCommandL( TInt aCommand )
00097         {
00098         switch( aCommand )
00099                 {
00100                 case EEikCmdExit:
00101                 case EAknSoftkeyExit:
00102                         Exit();
00103                         break;
00104 
00105                 case ECommand1:
00106                         {
00107                         CmdDirectScreenL();
00108                         }
00109                         break;
00110                 case ECommand2:
00111                         {
00112                         CmdDirectScreenBitmapL();
00113                         }
00114                         break;
00115                 case ECommand3:
00116                         {
00117                         CmdPlayVideoL();
00118                         }
00119                         break;
00120                 case ECommand4:
00121                         CmdProfileBitBlitL();
00122                         break;
00123                 case ECommand5:
00124                         CmdIclL();
00125                         break;
00126                 case ECommand6:
00127                         CmdDirectScreenGcL();
00128                         break;
00129                         
00130                 default:
00131                         Panic( EGfxWorkbenchUi );
00132                         break;
00133                 }
00134         }
00135 
00136 void CGfxWorkbenchAppUi::CmdPlayVideoL()
00137         {
00138         SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
00139               
00140         ClearView();
00141         iVideoControl = CVideoPlayerControl::NewL(ClientRect());
00142         iVideoControl->StartL();
00143         }
00144 
00145 void CGfxWorkbenchAppUi::CmdDirectScreenL()
00146         {
00147         ClearView();
00148         iDirectScreenView = CGfxDirectScreenView::NewL(ClientRect());
00149         iDirectScreenView->StartL(EFalse);
00150         }
00151 
00152 void CGfxWorkbenchAppUi::CmdDirectScreenGcL()
00153         {
00154         ClearView();
00155         iDirectScreenView = CGfxDirectScreenView::NewL(ClientRect());
00156         iDirectScreenView->StartL(ETrue);
00157         }
00158 
00159 void CGfxWorkbenchAppUi::CmdDirectScreenBitmapL()
00160         {
00161         ClearView();
00162         iDirectBitmapView = CGfxDirectScreenBitmapView::NewL(ClientRect());
00163         iDirectBitmapView->StartL();
00164         }
00165 
00166 void CGfxWorkbenchAppUi::ClearView()
00167         {
00168         delete iDirectBitmapView,iDirectBitmapView=NULL;
00169         delete iDirectScreenView, iDirectScreenView=NULL;
00170         delete iVideoControl, iVideoControl=NULL;
00171         delete iBitBlitView, iBitBlitView=NULL;
00172         delete iIclView, iIclView=NULL;
00173         }
00174 
00175 void CGfxWorkbenchAppUi::CmdProfileBitBlitL()
00176         {
00177         ClearView();
00178         iBitBlitView = CGfxBitBlitView::NewL(ClientRect());
00179         iBitBlitView->StartL();
00180         }
00181 
00182 void CGfxWorkbenchAppUi::CmdIclL()
00183         {
00184         ClearView();
00185         iIclView = CGfxIclView::NewL(ClientRect());
00186         iIclView->StartL();
00187         }
00188         
00189 
00190 // -----------------------------------------------------------------------------
00191 //  Called by the framework when the application status pane
00192 //  size is changed.  Passes the new client rectangle to the
00193 //  AppView
00194 // -----------------------------------------------------------------------------
00195 //
00196 void CGfxWorkbenchAppUi::HandleStatusPaneSizeChange()
00197         {
00198         iAppView->SetRect( ClientRect() );
00199         } 
00200 
00201 // End of File

Generated by  doxygen 1.6.2