commonuisupport/uikon/coresrc/EIKSCNCL.CPP
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 1997-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 #include "EIKSCNCL.H"
       
    17 #include <coemain.h>
       
    18 #include <eiksvdef.h>
       
    19 #include <eikdef.h>
       
    20 #include <eikenv.h>
       
    21 #include <eiksrvs.h>
       
    22 
       
    23 CEikScreenClearerWin::CEikScreenClearerWin()
       
    24 	{}
       
    25 
       
    26 CEikScreenClearerWin::~CEikScreenClearerWin()
       
    27 	{
       
    28 	iEikonEnv->WsSession().Flush();
       
    29 	if (iEikSrvStatus == KErrNone)
       
    30 		{
       
    31 		iEikSrv.UnblankScreen();
       
    32 		iEikSrv.Close();
       
    33 		}
       
    34 	}
       
    35 
       
    36 void CEikScreenClearerWin::ConstructL()
       
    37 // Use eikserv to blank the screen if possible, otherwise create a blank window.
       
    38 	{
       
    39 	// try to open eiksrvs thread to see if it exists
       
    40 	if (RThread().Name().Compare(EIKAPPUI_SERVER_THREAD_NAME)!=0)
       
    41 		{
       
    42 		// check if the server is present
       
    43 		TFindServer find(EIKAPPUI_SERVER_NAME);
       
    44  		TFullName name;
       
    45  		iEikSrvStatus = (find.Next(name) == KErrNone ? iEikSrv.Connect() : KErrNotFound); 
       
    46 		}
       
    47 	else
       
    48 		iEikSrvStatus = KErrInUse;		// this thread is eiksrv !
       
    49 
       
    50 	if (iEikSrvStatus == KErrNone)
       
    51 		iEikSrv.BlankScreen();
       
    52 	else
       
    53 		{
       
    54 		CreateWindowL();
       
    55 		SetBlank();
       
    56 		SetExtentToWholeScreen();
       
    57 		ActivateL();
       
    58 		SetPointerCapture(ETrue);
       
    59 		DrawableWindow()->ClaimPointerGrab();
       
    60 		DrawNow();
       
    61 		}
       
    62 
       
    63 	iCoeEnv->WsSession().PurgePointerEvents();
       
    64 	}
       
    65 
       
    66 EXPORT_C CEikScreenClearerWin* CEikScreenClearerWin::NewLC()
       
    67 	{
       
    68 	CEikScreenClearerWin* self = new(ELeave) CEikScreenClearerWin;
       
    69 	CleanupStack::PushL(self);
       
    70 	self->ConstructL();
       
    71 	return self;
       
    72 	}