windowing/windowserver/nga/SERVER/openwfc/Direct.H
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2000-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 // Definition of Direct Screen Access class
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __DIRECT_H__
       
    19 #define __DIRECT_H__
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <e32base.h>
       
    23 #include "W32STD.H"
       
    24 #include "w32cmd.h"
       
    25 #include "OBJECT.H"
       
    26 #include "CLIENT.H"
       
    27 #include <e32msgqueue.h>
       
    28 
       
    29 class CWsClientWindow;
       
    30 class CWsDirectScreenAccess;
       
    31 class CDsaMsgQueue;
       
    32 
       
    33 NONSHARABLE_CLASS(CWsAbortDirect) : public CActive
       
    34 	{
       
    35 public:
       
    36 	CWsAbortDirect(CWsDirectScreenAccess* aDirect,CDsaMsgQueue* aParent);
       
    37 	~CWsAbortDirect();
       
    38 	void Started();
       
    39 	void Complete(TInt aReason);
       
    40 private:
       
    41 	//Pure virtual function from CActive
       
    42 	void RunL();
       
    43 	void DoCancel();
       
    44 private:
       
    45 	CWsDirectScreenAccess* iDirect;
       
    46 	CDsaMsgQueue* iParent;
       
    47 	};
       
    48 
       
    49 NONSHARABLE_CLASS(CDsaMsgQueue) : public CBase
       
    50 {
       
    51 	public:
       
    52 		static CDsaMsgQueue* NewL(CWsDirectScreenAccess* aDirect);
       
    53 		~CDsaMsgQueue();
       
    54 		TInt CreateSendQueue();
       
    55 		TInt CreateRecQueue();
       
    56 		RMsgQueueBase* SendQueue();
       
    57 		RMsgQueueBase* RecQueue();
       
    58 		void Cancel();
       
    59 		void Complete();
       
    60 		void CompleteAbort();
       
    61 		void Started();
       
    62 		TInt Send(TInt aData);
       
    63 		TInt ReceiveData();
       
    64 		TRequestStatus& Status()
       
    65 		{
       
    66 			return iAborted->iStatus;
       
    67 		}
       
    68 		
       
    69 	private:
       
    70 		CDsaMsgQueue();
       
    71 		void ConstructL(CWsDirectScreenAccess* aDirect);
       
    72 	private:
       
    73 		RMsgQueueBase iSendQueue;
       
    74 		RMsgQueueBase iRecQueue;
       
    75 		CWsAbortDirect* iAborted;
       
    76 	};
       
    77 
       
    78 class CWsDirectScreenAccess : public CWsScreenObject
       
    79 	{
       
    80 public:
       
    81 	enum TStatus
       
    82 		{
       
    83 		EDirectStatusTimeNotCreated,
       
    84 		EDirectStatusNone,
       
    85 		EDirectStatusInitialising,
       
    86 		EDirectStatusRunning,
       
    87 		EDirectStatusCompleted,
       
    88 		EDirectStatusCanceling,
       
    89 		EDirectStatusAbortedWindow,
       
    90 		EDirectStatusAbortedGlobal,
       
    91 		EDirectStatusAborted=EDirectStatusAbortedWindow,
       
    92 		};
       
    93 public:
       
    94 	static CWsDirectScreenAccess* NewL(CWsClient* aOwner,TBool aRegionTrackingOnly);
       
    95 	~CWsDirectScreenAccess();
       
    96 	void Request(TInt handle);
       
    97 	void GetRegion(TInt aNumRects);
       
    98 	void Cancel();
       
    99 	void Aborted();
       
   100 	void AbortNow();
       
   101 	TInt GetSendQueue();
       
   102 	TInt GetRecQueue();
       
   103 	void SignalAbort(RDirectScreenAccess::TTerminationReasons aReason);
       
   104 	inline TRequestStatus& AbortStatus() {return iMsgQueue->Status();}
       
   105 	void CancelAbortObject();
       
   106 	void Abort();
       
   107 	//Pure virtual function from CWsObject
       
   108 	void CommandL(TInt aOpcode, const TAny* aCmdData);
       
   109 	inline TBool IsVisible() const;
       
   110 	inline TBool IsRegionTrackingOnly();
       
   111 	TBool IsAbortRequired(const TRegion& aTopVisibleRegion) const;
       
   112 	inline CWsClientWindow* ClientWindow() const;
       
   113 public:
       
   114 	TSglQueLink iLink;
       
   115 	TSglQueLink iMultipleDSALink;
       
   116 	TSglQueLink iAbortLink; // Used to build a list of DSA objects that need to be aborted on a specific window
       
   117 private:
       
   118 	inline CWsDirectScreenAccess(CWsClient* aOwner): CWsScreenObject(aOwner,WS_HANDLE_DIRECT, aOwner->Screen()) {}
       
   119 	void ConstructL(TBool aRegionTrackingOnly);
       
   120 	TInt Initiate();
       
   121 	void Terminate1();
       
   122 	void Terminate2();
       
   123 	void CorrectScreen();
       
   124 #if defined(_DEBUG)
       
   125 	TBool OnQueue();
       
   126 #endif
       
   127 private:
       
   128 	CWsClientWindow* iWin;
       
   129 	RWsRegion iVisible;
       
   130 	CDsaMsgQueue* iMsgQueue;
       
   131 	TStatus iStatus;
       
   132 	RDirectScreenAccess::TTerminationReasons iAbortReason;
       
   133 	TBool iRegionTrackingOnly;
       
   134 	};
       
   135 
       
   136 inline TBool CWsDirectScreenAccess::IsVisible() const
       
   137 	{
       
   138 	return !iVisible.IsEmpty();
       
   139 	}
       
   140 inline CWsClientWindow* CWsDirectScreenAccess::ClientWindow() const
       
   141 	{
       
   142 	return iWin;
       
   143 	}
       
   144 
       
   145 inline TBool CWsDirectScreenAccess::IsRegionTrackingOnly()
       
   146 	{
       
   147 	return iRegionTrackingOnly;
       
   148 	}
       
   149 #endif