graphicstest/uibench/s60/testlauncher/src/testlauncherappview.cpp
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1  // Copyright (c) 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 #include "testlauncherappView.h"
       
    18 
       
    19 #include <coemain.h>
       
    20 #include <aknutils.h>
       
    21 #include <gdi.h>
       
    22 
       
    23 
       
    24 CHelloWorldBasicAppView* CHelloWorldBasicAppView::NewL( const TRect& aRect )
       
    25     {
       
    26     CHelloWorldBasicAppView* self = CHelloWorldBasicAppView::NewLC( aRect );
       
    27     CleanupStack::Pop( self );
       
    28     return self;
       
    29     }
       
    30 
       
    31 CHelloWorldBasicAppView* CHelloWorldBasicAppView::NewLC( const TRect& aRect )
       
    32     {
       
    33     CHelloWorldBasicAppView* self = new (ELeave) CHelloWorldBasicAppView;
       
    34     CleanupStack::PushL(self);
       
    35     self->ConstructL(aRect);
       
    36     return self;
       
    37     }
       
    38 
       
    39 void CHelloWorldBasicAppView::ConstructL(const TRect& aRect)
       
    40     {
       
    41 	TFontSpec fs(_L("Courier"), 16);
       
    42 	CWsScreenDevice* scr = CEikonEnv::Static()->ScreenDevice();
       
    43 	User::LeaveIfError(scr->GetNearestFontInPixels(iFont, fs));
       
    44 
       
    45     // Create a window for this application view
       
    46     CreateWindowL();
       
    47 
       
    48     // Set the windows size
       
    49     SetRect(aRect);
       
    50 
       
    51     // Activate the window, which makes it ready to be drawn
       
    52     ActivateL();
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CHelloWorldBasicAppView::CHelloWorldBasicAppView()
       
    57 // C++ default constructor can NOT contain any code, that might leave.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 CHelloWorldBasicAppView::CHelloWorldBasicAppView():	iDir(1)
       
    61     {
       
    62     // No implementation required
       
    63     }
       
    64 
       
    65 CHelloWorldBasicAppView::~CHelloWorldBasicAppView()
       
    66     {
       
    67     CWsScreenDevice* scr = CEikonEnv::Static()->ScreenDevice();
       
    68 	scr->ReleaseFont(iFont);
       
    69     }
       
    70 
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CHelloWorldBasicAppView::Draw()
       
    74 // Draws the display.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 void CHelloWorldBasicAppView::Draw( const TRect& /*aRect*/ ) const
       
    78     {
       
    79     CWindowGc& gc = SystemGc();
       
    80     _LIT(KMsgP1, "This application enables you to launch ");
       
    81     _LIT(KMsgP2, "tests using testexecute.");
       
    82     gc.Clear();
       
    83     gc.UseFont(iFont);
       
    84     gc.DrawText(KMsgP1, TPoint(10,20));
       
    85     gc.DrawText(KMsgP2, TPoint(10,35));
       
    86     gc.DiscardFont();
       
    87     }