os/graphics/graphicstest/uibench/s60/src/tests_zorder/glplanetsapp.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1  // Copyright (c) 2006-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 "glplanetsapp.h"
    18 
    19 #include <e32debug.h>
    20 #include <eikenv.h>
    21 #include <eikstart.h>
    22 
    23 
    24 _LIT( KParentQueueName, "zorder");
    25 
    26 
    27 void CGLPlanetsAppUi::ConstructL()
    28     {
    29 	// Create app framework
    30 	CEikAppUi::BaseConstructL(ENoAppResourceFile);
    31 	iAppView = new(ELeave) CGLPlanetsAppView(*this);
    32 	iAppView->ConstructL(ClientRect());
    33 	AddToStackL(iAppView);    
    34 	iAppView->ActivateL();
    35     }
    36 
    37 CGLPlanetsAppUi::~CGLPlanetsAppUi()
    38 	{
    39 	delete iGLPlanets;
    40 	if (iAppView)
    41 		{	
    42 		RemoveFromStack(iAppView);
    43 		delete iAppView;
    44 		}
    45 	}
    46 
    47 /** Process command parameters */
    48 TBool CGLPlanetsAppUi::ProcessCommandParametersL(CApaCommandLine &aCommandLine)
    49 	{
    50 	TPtrC backgroundColor = aCommandLine.ExecutableName();
    51 	iGLPlanets = CGLPlanets::NewL(iAppView->Window(), backgroundColor, this, KParentQueueName());
    52 	iGLPlanets->Start();
    53 	return CEikAppUi::ProcessCommandParametersL(aCommandLine);
    54 	}
    55 
    56 void CGLPlanetsAppUi::Terminate()
    57 	{
    58 	PrepareToExit();
    59 	CActiveScheduler::Stop();
    60 	}
    61 
    62 void CGLPlanetsAppUi::BringToFront()
    63 	{
    64 	RWindow window = iAppView->Window();
    65 	RWsSession wsSession = iAppView->ControlEnv()->WsSession();
    66 	wsSession.SetWindowGroupOrdinalPosition(window.WindowGroupId(), 0);
    67 	wsSession.Flush();
    68 	wsSession.Finish();
    69 	}
    70 
    71 
    72 CGLPlanetsAppView::CGLPlanetsAppView(CGLPlanetsAppUi& aAppUi): iAppUi(aAppUi)
    73 	{
    74 	// empty
    75 	}
    76 
    77 void CGLPlanetsAppView::ConstructL(const TRect& aRect)
    78     {
    79 	CreateWindowL();
    80     SetRect(aRect);
    81 	}
    82 
    83 CGLPlanetsAppView::~CGLPlanetsAppView()
    84 	{
    85 	// empty
    86 	}
    87 
    88 
    89 CGLPlanetsAppDocument::CGLPlanetsAppDocument(CEikApplication& aApp)	: CEikDocument(aApp)
    90 	{
    91 	// empty
    92 	}
    93 
    94 CEikAppUi* CGLPlanetsAppDocument::CreateAppUiL()
    95 	{
    96     return new(ELeave) CGLPlanetsAppUi;
    97 	}
    98 
    99 
   100 TUid CGLPlanetsApp::AppDllUid() const
   101 	{
   102 	return TUid::Uid(0x101FCABE);
   103 	}
   104 
   105 CApaDocument* CGLPlanetsApp::CreateDocumentL()
   106 	{
   107 	return new(ELeave) CGLPlanetsAppDocument(*this);
   108 	}
   109 
   110 //
   111 // Exported function
   112 //
   113 
   114 /** Application factory function */
   115 LOCAL_C CApaApplication* NewApplication()
   116 	{
   117 	return new CGLPlanetsApp;
   118 	}
   119 
   120 GLDEF_C TInt E32Main()
   121 	{	
   122 	return EikStart::RunApplication(NewApplication);
   123 	}