appfw/apparchitecture/tef/ticoncaptionoverride.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code.
       
    20 */
       
    21 
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <eikstart.h>
       
    25 #include "ticoncaptionoverride.h"
       
    26 
       
    27 const TUid KIconCapOverrideAppUid = {0x2001B674}; // test application UID
       
    28 
       
    29 CIconCaptionOverrideView* CIconCaptionOverrideView::NewL( const TRect& aRect )
       
    30     {
       
    31     CIconCaptionOverrideView* self = CIconCaptionOverrideView::NewLC( aRect );
       
    32     CleanupStack::Pop( self );
       
    33     return self;
       
    34     }
       
    35 
       
    36 CIconCaptionOverrideView* CIconCaptionOverrideView::NewLC( const TRect& aRect )
       
    37     {
       
    38     CIconCaptionOverrideView* self = new ( ELeave ) CIconCaptionOverrideView;
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL( aRect );
       
    41     return self;
       
    42     }
       
    43 
       
    44 void CIconCaptionOverrideView::ConstructL( const TRect& aRect )
       
    45     {
       
    46     // Create a window for this application view
       
    47     CreateWindowL();
       
    48 
       
    49     // Set the windows size
       
    50     SetRect( aRect );
       
    51 
       
    52     // Activate the window, which makes it ready to be drawn
       
    53     ActivateL();
       
    54     }
       
    55 
       
    56 CIconCaptionOverrideView::CIconCaptionOverrideView()
       
    57     {
       
    58     // No implementation required
       
    59     }
       
    60 
       
    61 CIconCaptionOverrideView::~CIconCaptionOverrideView()
       
    62     {
       
    63     // No implementation required
       
    64     }
       
    65 
       
    66 void CIconCaptionOverrideView::Draw( const TRect& /*aRect*/ ) const
       
    67     {
       
    68     // Get the standard graphics context
       
    69     CWindowGc& gc = SystemGc();
       
    70 
       
    71     // Gets the control's extent
       
    72     TRect drawRect( Rect());
       
    73 
       
    74     // Clears the screen
       
    75     gc.Clear( drawRect );
       
    76     
       
    77   	}
       
    78 
       
    79 void CIconCaptionOverrideView::SizeChanged()
       
    80     {  
       
    81     DrawNow();
       
    82     }
       
    83 
       
    84 void CIconCaptionOverrideAppUi::ConstructL()
       
    85     {
       
    86     // Initialise app UI. Without EAknEnableSkin the dialogs do not render properly in 3.x.
       
    87     //BaseConstructL(EAknEnableSkin);
       
    88 	BaseConstructL();
       
    89 
       
    90 	// Create view object
       
    91 	iAppView = CIconCaptionOverrideView::NewL( ClientRect() );	
       
    92 	}
       
    93 
       
    94 CIconCaptionOverrideAppUi::CIconCaptionOverrideAppUi()
       
    95     {
       
    96     // No implementation required
       
    97     }
       
    98 
       
    99 CIconCaptionOverrideAppUi::~CIconCaptionOverrideAppUi()
       
   100     {
       
   101     if ( iAppView )
       
   102         {
       
   103         delete iAppView;
       
   104         iAppView = NULL;        
       
   105         }
       
   106     }
       
   107 
       
   108 void CIconCaptionOverrideAppUi::HandleCommandL( TInt aCommand )
       
   109     {
       
   110     switch( aCommand )
       
   111         {
       
   112         case EEikCmdExit:
       
   113         //case EAknSoftkeyExit:
       
   114             Exit();
       
   115             break;
       
   116         default:
       
   117             break;
       
   118         }
       
   119     }
       
   120 
       
   121 /*void CIconCaptionOverrideAppUi::HandleStatusPaneSizeChange()
       
   122 	{
       
   123 	iAppView->SetRect( ClientRect() );
       
   124 	}
       
   125 */
       
   126 CIconCaptionOverrideDocument* CIconCaptionOverrideDocument::NewL( CEikApplication&
       
   127                                                           aApp )
       
   128     {
       
   129     CIconCaptionOverrideDocument* self = NewLC( aApp );
       
   130     CleanupStack::Pop( self );
       
   131     return self;
       
   132     }
       
   133 
       
   134 CIconCaptionOverrideDocument* CIconCaptionOverrideDocument::NewLC( CEikApplication&
       
   135                                                            aApp )
       
   136     {
       
   137     CIconCaptionOverrideDocument* self =
       
   138         new ( ELeave ) CIconCaptionOverrideDocument( aApp );
       
   139 
       
   140     CleanupStack::PushL( self );
       
   141     self->ConstructL();
       
   142     return self;
       
   143     }
       
   144 
       
   145 void CIconCaptionOverrideDocument::ConstructL()
       
   146     {
       
   147     // No implementation required
       
   148     }
       
   149 
       
   150 CIconCaptionOverrideDocument::CIconCaptionOverrideDocument( CEikApplication& aApp )
       
   151     : CEikDocument( aApp )
       
   152     {
       
   153     // No implementation required
       
   154     }
       
   155 
       
   156 CIconCaptionOverrideDocument::~CIconCaptionOverrideDocument()
       
   157     {
       
   158     // No implementation required
       
   159     }
       
   160     
       
   161 CEikAppUi* CIconCaptionOverrideDocument::CreateAppUiL()
       
   162     {
       
   163     // Create the application user interface, and return a pointer to it;
       
   164     // the framework takes ownership of this object
       
   165     return ( static_cast <CEikAppUi*> ( new ( ELeave )
       
   166                                         CIconCaptionOverrideAppUi ) );
       
   167     }
       
   168 
       
   169 CApaDocument* CIconCaptionOverrideApplication::CreateDocumentL()
       
   170     {
       
   171     return (static_cast<CApaDocument*>
       
   172                     ( CIconCaptionOverrideDocument::NewL( *this ) ) );
       
   173     }
       
   174 
       
   175 TUid CIconCaptionOverrideApplication::AppDllUid() const
       
   176     {
       
   177     return KIconCapOverrideAppUid;
       
   178     }
       
   179 
       
   180 LOCAL_C CApaApplication* NewApplication()
       
   181 	{
       
   182 	return new CIconCaptionOverrideApplication;
       
   183 	}
       
   184 
       
   185 GLDEF_C TInt E32Main()
       
   186 	{
       
   187 	return EikStart::RunApplication( NewApplication );
       
   188 	}
       
   189 
       
   190 
       
   191