|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #ifndef WINDOWMANAGER_H_ |
|
25 #define WINDOWMANAGER_H_ |
|
26 |
|
27 #include <e32msgqueue.h> |
|
28 #include <w32std.h> |
|
29 |
|
30 /** |
|
31 * Encapsulates the resources used to provide a window to render to via Graphic Surfaces. |
|
32 * Proxies certain methods so that they can be used by arbitary threads. |
|
33 */ |
|
34 class CWindowManager : public CActive |
|
35 { |
|
36 private: |
|
37 enum TCommand |
|
38 { |
|
39 ERegisterSurface, |
|
40 ESetBackgroundSurface |
|
41 }; |
|
42 |
|
43 struct TMessage |
|
44 { |
|
45 TCommand iCommand; |
|
46 TAny* iParam1; |
|
47 TInt iParam2; |
|
48 }; |
|
49 |
|
50 public: |
|
51 static CWindowManager* NewL(); |
|
52 ~CWindowManager(); |
|
53 |
|
54 TSize ScreenSize() const; |
|
55 |
|
56 TInt RegisterSurface(TSurfaceId& aSurfaceId); |
|
57 TInt SetBackgroundSurface(TSurfaceConfiguration& aSurfaceConfig, TBool aTriggerRedraw); |
|
58 void Flush(); |
|
59 |
|
60 private: |
|
61 CWindowManager(); |
|
62 void ConstructL(); |
|
63 |
|
64 void RunL(); |
|
65 void DoCancel(); |
|
66 |
|
67 TInt RunCommand(TCommand aCommand, TAny* aParam1, TInt aParam2 = 0); |
|
68 TInt DoCommand(TCommand aCommand, TAny* aParam1, TInt aParam2); |
|
69 |
|
70 private: |
|
71 RMsgQueue<TMessage> iMsgQueue; |
|
72 RSemaphore iSemaphore; |
|
73 TInt iReturnCode; |
|
74 TThreadId iCreatorThreadId; |
|
75 |
|
76 RWsSession iWsSession; |
|
77 CWsScreenDevice* iWsSd; // Screen Device for this WServ session. |
|
78 RWindowGroup iWindowGroup; // Window group of the AO windows. |
|
79 RWindow* iWindow; |
|
80 TSize iScreenSize; |
|
81 }; |
|
82 |
|
83 #endif /* WINDOWMANAGER_H_ */ |