appfw/viewserver/inc/VWSWEVNT.H
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 1999-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 #ifndef __VWSWEVNT_H__
       
    17 #define __VWSWEVNT_H__
       
    18 
       
    19 #include <w32std.h>
       
    20 
       
    21 
       
    22 //
       
    23 // Forward declarations.
       
    24 //
       
    25 
       
    26 class CVwsServer;
       
    27 
       
    28 
       
    29 /**
       
    30  * The CVwsWServEventHandler class actively monitors the window server for screen device change notifications.
       
    31  */ 
       
    32 class CVwsWServEventHandler : public CActive
       
    33 	{
       
    34 public:
       
    35  	static CVwsWServEventHandler* NewL(CVwsServer& aServer, RWsSession& aWsSession, TBool aIgnoreFirstScreenDeviceChangedEvent);
       
    36 
       
    37 	~CVwsWServEventHandler();
       
    38 	void Queue();
       
    39 private: // From CActive.
       
    40 	void RunL();
       
    41 	void DoCancel();
       
    42 	TInt RunError(TInt aError);
       
    43 private:
       
    44 	CVwsWServEventHandler(CVwsServer& aServer, RWsSession& aWsSession, TBool aIgnoreFirstScreenDeviceChangedEvent);
       
    45 	void ConstructL();
       
    46 private:
       
    47 	CVwsServer& iServer;
       
    48 	RWsSession& iWsSession;
       
    49 	TBool		iIgnoreNextScreenDeviceChangedEvent;
       
    50 	};
       
    51 
       
    52 /**
       
    53  * The CVwsWServRedrawer class handles redraw events for the window used by the view server to manage WSERV activity
       
    54  * during view transistions. The window is created in front of normal applications and is put up for the duration of
       
    55  * a view transistion. The window is transparent for ordinary view switches and opaque for screen orientation changes. 
       
    56  */ 
       
    57 class CVwsWServRedrawer : public CActive
       
    58 	{
       
    59 public:
       
    60 	static CVwsWServRedrawer* NewL(RWsSession& aWsSession, CWindowGc& aGc, RWindow& aWindow);
       
    61 	~CVwsWServRedrawer();
       
    62 	void SetDrawMode(TBool aOpaque);
       
    63 	void Queue();
       
    64 private: // From CActive
       
    65 	void RunL();
       
    66 	void DoCancel();
       
    67 private:
       
    68 	void HandleRedrawEvent(const TRect& aRect);
       
    69 	void ConstructL();
       
    70 	CVwsWServRedrawer(RWsSession& aWsSession, CWindowGc& aGc, RWindow& aWindow);
       
    71 private:
       
    72 	RWsSession& iWsSession;
       
    73 	CWindowGc& iGc;
       
    74 	RWindow& iWindow;
       
    75 	TBool iOpaque;
       
    76 	};
       
    77 
       
    78 /**
       
    79  * The CVwsWServSessionHandler class connects to the window server and manages WSERV activity.
       
    80  * It uses an event handler to detect screen device changes for the view server and puts up a window in front of normal
       
    81  * applications to manage activity during view transistions.
       
    82  */ 
       
    83 class CVwsWServSessionHandler : public CBase
       
    84 	{
       
    85 public:
       
    86 	static CVwsWServSessionHandler* NewL(CVwsServer& aServer);
       
    87 	~CVwsWServSessionHandler();
       
    88 	void DisplayWindow();
       
    89 	void HideWindow();
       
    90 	void ConfigureScreenDevice();
       
    91 	TInt GetScreenMode();
       
    92 	void UpdateScreenAndDisplayWindow();
       
    93 	inline RWsSession& WsSession() const;
       
    94 	void SetWindowBackgroundColor(const TRgb& aBgColor);
       
    95 private:
       
    96 	void ConstructL();
       
    97 	void CreateWServSessionL();
       
    98 	CVwsWServSessionHandler(CVwsServer& aServer);
       
    99 
       
   100 	CVwsWServEventHandler* iWServEventHandler;
       
   101 	CVwsWServRedrawer* iWServRedrawer;
       
   102 	CVwsServer& iServer;
       
   103 	TBool iFirstDisplay;
       
   104 
       
   105 	RWsSession iWsSession;
       
   106 	CWsScreenDevice* iScreen;
       
   107 	CWindowGc* iGc;
       
   108 	RWindowGroup iRootWin;
       
   109 	RWindow* iWindow;
       
   110 	};
       
   111 
       
   112 
       
   113 //
       
   114 // Inlines
       
   115 //
       
   116 
       
   117 inline RWsSession& CVwsWServSessionHandler::WsSession() const
       
   118 	{ return((RWsSession&)iWsSession); }
       
   119 
       
   120 #endif