|
1 /* |
|
2 * Copyright (c) 2005 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 #ifndef LCDWINDOWSURFACE_H |
|
20 #define LCDWINDOWSURFACE_H |
|
21 |
|
22 #include <w32std.h> |
|
23 #include "LcdSurface.h" |
|
24 |
|
25 typedef CFbsBitGc::TGraphicsOrientation TOrientation; |
|
26 |
|
27 /** |
|
28 * Coordinate transform from logical device coords to |
|
29 * phyical device coords is determined by the scale, |
|
30 * origin and orientation. |
|
31 */ |
|
32 struct TCoordinateSystem |
|
33 { |
|
34 TSize iSize; |
|
35 TSize iScale; |
|
36 TPoint iOrigin; |
|
37 TOrientation iOrientation; |
|
38 }; |
|
39 |
|
40 NONSHARABLE_CLASS(CLcdWindowSurface) |
|
41 : public CLcdSurface |
|
42 , private MDirectContent |
|
43 , private MDirectScreenAccess |
|
44 { |
|
45 public: |
|
46 /* We make the CONE dependency explicit here by requiring a CCoeControl for the window */ |
|
47 static CLcdWindowSurface* NewL(CCoeControl& aWindow, MDirectContainer& aContainer, TBool aUpdate); |
|
48 ~CLcdWindowSurface(); |
|
49 |
|
50 RWindow* Window() const; |
|
51 void GetCoordinateSystem(TCoordinateSystem& aCoords) const; |
|
52 |
|
53 virtual TSurfaceType Type() const; |
|
54 virtual void Update(const TRect& aRect); |
|
55 virtual void Begin(TAcceleratedBitmapInfo& aInfo, TBitmapLockCount& aCount); |
|
56 virtual void End(TBitmapLockCount& aCount); |
|
57 virtual TRect Bounds() const; |
|
58 virtual RRegion* VisibleRegion() const; |
|
59 virtual CBitmapContext* Context() const; |
|
60 virtual TImageType ImageType() const; |
|
61 |
|
62 private: |
|
63 virtual void MdcContainerWindowRectChanged(const TRect& /*aRect*/) {}; |
|
64 |
|
65 /** |
|
66 Notify content that container visiblity has changed. The content must not |
|
67 be displayed when it's container is invisible. |
|
68 @param "aVisible" ETrue if the container is visible, EFalse if it is invisible. |
|
69 */ |
|
70 virtual void MdcContainerVisibilityChanged(TBool aVisible); |
|
71 |
|
72 /** |
|
73 Notify content that the container bounds have changed. |
|
74 @param "aRect" Maximum area the content can occupy in screen co-ordinates. |
|
75 The content should be clipped to this area. |
|
76 */ |
|
77 virtual void MdcContentBoundsChanged(const TRect& aRect); |
|
78 |
|
79 /** |
|
80 Notify content that its display area has changed. |
|
81 This should only be called when the content is displayed on an Item. |
|
82 @param "aDisplayRect" Display area in Item co-ordinates. |
|
83 @param "aScreenRect" Display area in screen co-ordinates. |
|
84 */ |
|
85 virtual void MdcItemContentRectChanged(const TRect& aContentRect,const TRect& aScreenRect); |
|
86 |
|
87 virtual void MdcContainerDestroyed(); |
|
88 |
|
89 /** |
|
90 * Notify content that any drawing |
|
91 * via direct screen access must be aborted |
|
92 */ |
|
93 virtual void MdcAbortDSA(); |
|
94 |
|
95 /** |
|
96 * Allow the content to draw |
|
97 * via direct screen access after MdcAbortDSA |
|
98 */ |
|
99 virtual void MdcResumeDSA(); |
|
100 |
|
101 private: |
|
102 virtual void AbortNow(RDirectScreenAccess::TTerminationReasons); |
|
103 virtual void Restart(RDirectScreenAccess::TTerminationReasons); |
|
104 |
|
105 private: |
|
106 CLcdWindowSurface(MDirectContainer& aContainer, TBool aUpdate); |
|
107 void ConstructL(CCoeControl& aWindow); |
|
108 void ActivateL(RWindow* aWindow); |
|
109 void Deactivate(); |
|
110 TBool Start(); |
|
111 TInt DoUpdate(); |
|
112 |
|
113 private: |
|
114 MDirectContainer* iContainer; |
|
115 RWsSession& iWsSession; |
|
116 CWsScreenDevice& iWsDevice; |
|
117 TBool iUpdate; |
|
118 TImageType iImageType; |
|
119 RWindow* iWsWindow; |
|
120 CWindowGc* iWsContext; // backup context |
|
121 CDirectScreenAccess* iWsAccess; // primary context, region and update device |
|
122 TAcceleratedBitmapInfo iScreen; |
|
123 TCoordinateSystem iScreenCoords; |
|
124 TBool iEnabled; |
|
125 TBool iStarted; |
|
126 TBool iVisible; |
|
127 TRect iBounds; |
|
128 RRegion iEmptyRegion; |
|
129 RRegion iUpdateRegion; |
|
130 }; |
|
131 |
|
132 #endif // LCDWINDOWSURFACE_H |