|
1 // Copyright (c) 2006-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 // CWsWindowRedraw and associated classes definitions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __WNREDRAW_H__ |
|
19 #define __WNREDRAW_H__ |
|
20 |
|
21 #include "server.h" |
|
22 #include "panics.h" |
|
23 |
|
24 class CPlaybackGc; |
|
25 |
|
26 // |
|
27 // Base class defining how a window is redrawn, i.e. Backed up, redraw from client, blanked... |
|
28 // |
|
29 class CWsWindowRedraw : public CBase |
|
30 { |
|
31 public: |
|
32 ~CWsWindowRedraw(); |
|
33 virtual void ConstructL(); |
|
34 virtual TBool CommandL(TInt aOpcode, TWsWinCmdUnion &aCmd)=0; |
|
35 virtual TRgb BackColor() const=0; |
|
36 virtual TBool NeedsRedraw() const=0; |
|
37 virtual TBool GetRedrawRect(TRect &aRect) const=0; |
|
38 virtual void ClipInvalidRegion(const TRect &aRect); |
|
39 virtual void Resize(const TSize &aSize, const TSize &aOldSize); |
|
40 virtual CWsBackedUpWindow *Backup() const; |
|
41 virtual void Scroll(const TRect &aClipRect, const TPoint &aOffset,const TRect &aRect); |
|
42 virtual void UpdateAnimArea(); |
|
43 virtual void PrepareForResizeL(const TSize &aSize, TSize &aOldSize); |
|
44 virtual void Moved() {} |
|
45 virtual void ClearRedrawStore(TBool aClearPendingRedraw=EFalse); |
|
46 virtual TBool DrawCommand(CWsGc* aGc,const TAny *aCmdData); |
|
47 virtual void GcAttributeChange(CWsGc* aGc,const TAny *aCmdData); |
|
48 virtual void GcDeactivate(CWsGc* aGc); |
|
49 inline CWsWindow *WsWin(); // Link back to main window class |
|
50 virtual void ClientExposing(); |
|
51 virtual void DrawWindow()=0; |
|
52 TInt DrawBackgroundColor(const TRegion* aRegion); |
|
53 virtual TBool Contains(const TArray<TGraphicDrawerId>& aDrawers,const TRegion& aRegion) const; |
|
54 void DrawAnims(CFbsBitGc * aGc, const TRegion& aRegion); |
|
55 const TRegion * GlobalRedrawRegion(); |
|
56 virtual TBool ReleaseMemory(MWsMemoryRelease::TMemoryReleaseLevel aLevel); |
|
57 virtual CFbsDevice* OutputDevice() const; |
|
58 virtual void VisibleRegionChange(); |
|
59 virtual TBool ReadyToDraw() const; |
|
60 void PreDrawWindow(CFbsBitGc * aGc, const TRegion &aRegion); |
|
61 void PostDrawWindow(CFbsBitGc * aGc); |
|
62 virtual void Invalidate(const TRect *) {} |
|
63 virtual TInt SizeInBytes() const { return 0; } |
|
64 virtual void WindowClosing(); |
|
65 |
|
66 protected: |
|
67 CWsWindowRedraw(CWsWindow *aWin); |
|
68 void SetReply(TInt aReply); |
|
69 void OwnerPanic(TClientPanic aPanic); |
|
70 inline void QueueRedraw(); |
|
71 inline CScreen* Screen() const; |
|
72 inline CWsClientWindow *CliWin() const; |
|
73 void DrawAnimsL(CFbsBitGc * aGc, const TRegion& aRegion); |
|
74 protected: |
|
75 CWsWindow *iWsWin; // Link back to main window class |
|
76 const TRegion * iGlobalRedrawRegion;// During a scheduled draw, this is the area scheduled to be drawn. |
|
77 }; |
|
78 |
|
79 class CWsBlankWindow : public CWsWindowRedraw |
|
80 { |
|
81 public: |
|
82 CWsBlankWindow(CWsWindow *aWin); |
|
83 ~CWsBlankWindow(); |
|
84 |
|
85 //from CWsWindowRedraw |
|
86 TBool CommandL(TInt aOpcode, TWsWinCmdUnion &aCmd); |
|
87 TBool NeedsRedraw() const; |
|
88 TBool GetRedrawRect(TRect &aRect) const; |
|
89 |
|
90 void SetColor(TRgb aColor); |
|
91 inline void SetBackgroundClear(); |
|
92 inline TBool IsBackgroundColor(); |
|
93 void DrawWindow(); |
|
94 private: |
|
95 TRgb BackColor() const; |
|
96 private: |
|
97 TRgb iColor; |
|
98 TBool iNoColor; |
|
99 }; |
|
100 |
|
101 #include "window.h" |
|
102 |
|
103 inline CWsWindow *CWsWindowRedraw::WsWin() |
|
104 { |
|
105 return iWsWin; |
|
106 } |
|
107 |
|
108 inline CScreen* CWsWindowRedraw::Screen() const |
|
109 { |
|
110 return iWsWin->Screen(); |
|
111 } |
|
112 |
|
113 inline CWsClientWindow *CWsWindowRedraw::CliWin() const |
|
114 { |
|
115 return (CWsClientWindow *)iWsWin; |
|
116 } |
|
117 |
|
118 inline void CWsBlankWindow::SetBackgroundClear() |
|
119 { |
|
120 iNoColor=ETrue; |
|
121 } |
|
122 |
|
123 inline TBool CWsBlankWindow::IsBackgroundColor() |
|
124 { |
|
125 return !iNoColor; |
|
126 } |
|
127 |
|
128 inline void CWsWindowRedraw::QueueRedraw() |
|
129 { |
|
130 if (iWsWin->IsActive()) |
|
131 { |
|
132 iWsWin->WsOwner()->RedrawQueue()->AddInvalid(this); |
|
133 } |
|
134 } |
|
135 |
|
136 inline const TRegion * CWsWindowRedraw::GlobalRedrawRegion() |
|
137 { |
|
138 return iGlobalRedrawRegion; |
|
139 } |
|
140 |
|
141 #endif |