|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
|
3 <title>TB10.1 Example Applications: examples/Graphics/WS/transparent/transparent_util.cpp Source File</title> |
|
4 <link href="doxygen.css" rel="stylesheet" type="text/css"> |
|
5 <link href="tabs.css" rel="stylesheet" type="text/css"> |
|
6 </head><body> |
|
7 <!-- Generated by Doxygen 1.5.3 --> |
|
8 <h1>examples/Graphics/WS/transparent/transparent_util.cpp</h1><a href="transparent__util_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).</span> |
|
9 <a name="l00002"></a>00002 <span class="comment">// All rights reserved.</span> |
|
10 <a name="l00003"></a>00003 <span class="comment">// This component and the accompanying materials are made available</span> |
|
11 <a name="l00004"></a>00004 <span class="comment">// under the terms of "Eclipse Public License v1.0"</span> |
|
12 <a name="l00005"></a>00005 <span class="comment">// which accompanies this distribution, and is available</span> |
|
13 <a name="l00006"></a>00006 <span class="comment">// at the URL "http://www.eclipse.org/legal/epl-v10.html".</span> |
|
14 <a name="l00007"></a>00007 <span class="comment">//</span> |
|
15 <a name="l00008"></a>00008 <span class="comment">// Initial Contributors:</span> |
|
16 <a name="l00009"></a>00009 <span class="comment">// Nokia Corporation - initial contribution.</span> |
|
17 <a name="l00010"></a>00010 <span class="comment">//</span> |
|
18 <a name="l00011"></a>00011 <span class="comment">// Contributors:</span> |
|
19 <a name="l00012"></a>00012 <span class="comment">//</span> |
|
20 <a name="l00013"></a>00013 <span class="comment">// Description:</span> |
|
21 <a name="l00014"></a>00014 <span class="comment">// This provides various functions for window event handling, control and access.</span> |
|
22 <a name="l00015"></a>00015 <span class="comment">//</span> |
|
23 <a name="l00016"></a>00016 |
|
24 <a name="l00017"></a>00017 |
|
25 <a name="l00018"></a>00018 |
|
26 <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="transparent_8h.html">transparent.h</a>"</span> |
|
27 <a name="l00028"></a>00028 <span class="keyword">static</span> TInt CallDoChangeTransparencyL(TAny *aPtr) |
|
28 <a name="l00029"></a>00029 { |
|
29 <a name="l00030"></a>00030 <span class="keywordflow">return</span> (static_cast<CTransparentUtil *> (aPtr)->DoChangeTransparencyL()); |
|
30 <a name="l00031"></a>00031 } |
|
31 <a name="l00032"></a>00032 |
|
32 <a name="l00037"></a>00037 <span class="keyword">static</span> TInt CallDoSetTransparentRegion(TAny *aPtr) |
|
33 <a name="l00038"></a>00038 { |
|
34 <a name="l00039"></a>00039 <span class="keywordflow">return</span> (static_cast<CTransparentUtil *> (aPtr)->DoSetTransparentRegion()); |
|
35 <a name="l00040"></a>00040 } |
|
36 <a name="l00041"></a>00041 |
|
37 <a name="l00045"></a><a class="code" href="class_c_transparent_util.html#5ac75e00750e9cd60fdf575bf3e400e4">00045</a> <a class="code" href="class_c_transparent_util.html#5ac75e00750e9cd60fdf575bf3e400e4">CTransparentUtil::CTransparentUtil</a>() |
|
38 <a name="l00046"></a>00046 { |
|
39 <a name="l00047"></a>00047 } |
|
40 <a name="l00048"></a>00048 |
|
41 <a name="l00053"></a><a class="code" href="class_c_transparent_util.html#9d8db23cebc357a94cfa21213db8a2ab">00053</a> <a class="code" href="class_c_transparent_util.html">CTransparentUtil</a>* <a class="code" href="class_c_transparent_util.html#9d8db23cebc357a94cfa21213db8a2ab">CTransparentUtil::NewL</a>() |
|
42 <a name="l00054"></a>00054 { |
|
43 <a name="l00055"></a>00055 <a class="code" href="class_c_transparent_util.html">CTransparentUtil</a>* <span class="keyword">self</span> = <span class="keyword">new</span>(ELeave) <a class="code" href="class_c_transparent_util.html#5ac75e00750e9cd60fdf575bf3e400e4">CTransparentUtil</a>(); |
|
44 <a name="l00056"></a>00056 CleanupStack::PushL(<span class="keyword">self</span>); |
|
45 <a name="l00057"></a>00057 <span class="keyword">self</span>->ConstructL(); |
|
46 <a name="l00058"></a>00058 CleanupStack::Pop(<span class="keyword">self</span>); |
|
47 <a name="l00059"></a>00059 <span class="keywordflow">return</span> <span class="keyword">self</span>; |
|
48 <a name="l00060"></a>00060 } |
|
49 <a name="l00061"></a>00061 |
|
50 <a name="l00065"></a><a class="code" href="class_c_transparent_util.html#cc7952414bc448ede845d4ee1a6306ab">00065</a> <a class="code" href="class_c_transparent_util.html#cc7952414bc448ede845d4ee1a6306ab">CTransparentUtil::~CTransparentUtil</a>() |
|
51 <a name="l00066"></a>00066 { |
|
52 <a name="l00067"></a>00067 <span class="keywordflow">if</span>(iPeriodicObject->IsActive()) |
|
53 <a name="l00068"></a>00068 { |
|
54 <a name="l00069"></a>00069 iPeriodicObject->Cancel(); |
|
55 <a name="l00070"></a>00070 } |
|
56 <a name="l00071"></a>00071 <span class="keyword">delete</span> iPeriodicObject; |
|
57 <a name="l00072"></a>00072 <span class="keyword">delete</span> iBitmapGc; |
|
58 <a name="l00073"></a>00073 <span class="keyword">delete</span> iBitmapDevice; |
|
59 <a name="l00074"></a>00074 <span class="keyword">delete</span> iEventHandler; |
|
60 <a name="l00075"></a>00075 |
|
61 <a name="l00076"></a>00076 iForegndWindowTrans.Close(); |
|
62 <a name="l00077"></a>00077 iFgndWinTransRegion.Close(); |
|
63 <a name="l00078"></a>00078 iBackgndWindow.Close(); |
|
64 <a name="l00079"></a>00079 iGroup.Close(); |
|
65 <a name="l00080"></a>00080 |
|
66 <a name="l00081"></a>00081 <span class="keyword">delete</span> iGc; |
|
67 <a name="l00082"></a>00082 <span class="keyword">delete</span> iScr; |
|
68 <a name="l00083"></a>00083 iWs.Close(); |
|
69 <a name="l00084"></a>00084 } |
|
70 <a name="l00085"></a>00085 |
|
71 <a name="l00093"></a><a class="code" href="class_c_transparent_util.html#913184d6e06574a7b843e17c021caad6">00093</a> <span class="keywordtype">void</span> <a class="code" href="class_c_transparent_util.html#913184d6e06574a7b843e17c021caad6">CTransparentUtil::ConstructL</a>() |
|
72 <a name="l00094"></a>00094 { |
|
73 <a name="l00095"></a>00095 <span class="comment">// Connect the client session to the window server.</span> |
|
74 <a name="l00096"></a>00096 User::LeaveIfError(iWs.Connect()); |
|
75 <a name="l00097"></a>00097 |
|
76 <a name="l00098"></a>00098 <span class="comment">// Construct a new screen device attached to the window server session.</span> |
|
77 <a name="l00099"></a>00099 iScr = <span class="keyword">new</span>(ELeave) CWsScreenDevice(iWs); |
|
78 <a name="l00100"></a>00100 User::LeaveIfError(iScr->Construct(0)); <span class="comment">// screen number (0 is first screen)</span> |
|
79 <a name="l00101"></a>00101 |
|
80 <a name="l00102"></a>00102 <span class="comment">// Create the graphics context but do not initialise</span> |
|
81 <a name="l00103"></a>00103 iGc = <span class="keyword">new</span>(ELeave) CWindowGc(iScr); |
|
82 <a name="l00104"></a>00104 |
|
83 <a name="l00105"></a>00105 <span class="comment">// Complete construction</span> |
|
84 <a name="l00106"></a>00106 User::LeaveIfError(iGc->Construct()); |
|
85 <a name="l00107"></a>00107 |
|
86 <a name="l00108"></a>00108 <span class="comment">// Create an initialised window group handle within the session.</span> |
|
87 <a name="l00109"></a>00109 iGroup = RWindowGroup(iWs); |
|
88 <a name="l00110"></a>00110 User::LeaveIfError(iGroup.Construct((TUint)&iGroup, ETrue)); |
|
89 <a name="l00111"></a>00111 |
|
90 <a name="l00112"></a>00112 <span class="comment">// Initialise the background window handle</span> |
|
91 <a name="l00113"></a>00113 iBackgndWindow = RWindow(iWs); |
|
92 <a name="l00114"></a>00114 |
|
93 <a name="l00115"></a>00115 <span class="comment">// Initialise the foreground window handle to demonstrate TransparencyVariance(). </span> |
|
94 <a name="l00116"></a>00116 iForegndWindowTrans = RWindow(iWs); |
|
95 <a name="l00117"></a>00117 |
|
96 <a name="l00118"></a>00118 <span class="comment">// Initialise the foreground window handle to demonstrate TransparentRegionL()</span> |
|
97 <a name="l00119"></a>00119 iFgndWinTransRegion = RWindow(iWs); |
|
98 <a name="l00120"></a>00120 |
|
99 <a name="l00121"></a>00121 <span class="comment">// Create the CPeriodic object to generate periodic events</span> |
|
100 <a name="l00122"></a>00122 iPeriodicObject=CPeriodic::NewL(CActive::EPriorityUserInput); |
|
101 <a name="l00123"></a>00123 |
|
102 <a name="l00124"></a>00124 <span class="comment">// Construct the event handler</span> |
|
103 <a name="l00125"></a>00125 iEventHandler = <a class="code" href="class_c_event_handler.html#0e709c6e924eb9799e69ea10e26824d6">CEventHandler::NewL</a>(iWs); |
|
104 <a name="l00126"></a>00126 |
|
105 <a name="l00127"></a>00127 <span class="comment">// Construct foreground and background windows</span> |
|
106 <a name="l00128"></a>00128 User::LeaveIfError(iBackgndWindow.Construct(iGroup, (TUint)&iBackgndWindow)); |
|
107 <a name="l00129"></a>00129 User::LeaveIfError(iForegndWindowTrans.Construct(iGroup, (TUint)&iForegndWindowTrans)); |
|
108 <a name="l00130"></a>00130 User::LeaveIfError(iFgndWinTransRegion.Construct(iGroup, (TUint)&iFgndWinTransRegion)); |
|
109 <a name="l00131"></a>00131 |
|
110 <a name="l00132"></a>00132 iForegndWindowTrans.SetRequiredDisplayMode(EColor16MA); |
|
111 <a name="l00133"></a>00133 iFgndWinTransRegion.SetRequiredDisplayMode(EColor16MA); |
|
112 <a name="l00134"></a>00134 |
|
113 <a name="l00135"></a>00135 <span class="comment">// Set background window size</span> |
|
114 <a name="l00136"></a>00136 TSize bgRectSize(iScr->SizeInPixels().iWidth/2,iScr->SizeInPixels().iHeight); |
|
115 <a name="l00137"></a>00137 iBackgndWindow.SetExtent(TPoint(),bgRectSize); |
|
116 <a name="l00138"></a>00138 iBackgndWindow.Activate(); |
|
117 <a name="l00139"></a>00139 |
|
118 <a name="l00140"></a>00140 <span class="comment">// Set the size of the foreground window to span the upper half of the background window</span> |
|
119 <a name="l00141"></a>00141 TSize fgRectSize(iScr->SizeInPixels().iWidth/2,iScr->SizeInPixels().iHeight/2); |
|
120 <a name="l00142"></a>00142 iForegndWindowTrans.SetExtent(TPoint(),fgRectSize); |
|
121 <a name="l00143"></a>00143 <span class="comment">//Enable the use of alpha channel to vary foreground window's transparency</span> |
|
122 <a name="l00144"></a>00144 User::LeaveIfError(iForegndWindowTrans.SetTransparencyAlphaChannel()); |
|
123 <a name="l00145"></a>00145 iForegndWindowTrans.Activate(); |
|
124 <a name="l00146"></a>00146 |
|
125 <a name="l00147"></a>00147 <span class="comment">// Set the size of the foreground window to overlap the bottom half of the background window</span> |
|
126 <a name="l00148"></a>00148 iFgndWinTransRegion.SetExtent(TPoint(0, iScr->SizeInPixels().iHeight/2),fgRectSize); |
|
127 <a name="l00149"></a>00149 |
|
128 <a name="l00150"></a>00150 <span class="comment">//Enable the use of alpha channel to vary foreground window's transparency</span> |
|
129 <a name="l00151"></a>00151 User::LeaveIfError(iFgndWinTransRegion.SetTransparencyAlphaChannel()); |
|
130 <a name="l00152"></a>00152 iFgndWinTransRegion.Activate(); |
|
131 <a name="l00153"></a>00153 |
|
132 <a name="l00154"></a>00154 TRect circleRect(TPoint(80,50), TSize(170, 170)); |
|
133 <a name="l00155"></a>00155 <span class="comment">//Draw the background window using the colour specified by the second parameter </span> |
|
134 <a name="l00156"></a>00156 <span class="comment">//and draw a circle on top of it with the colour specified by the third parameter. </span> |
|
135 <a name="l00157"></a>00157 _LIT(KBackGrndWindow, <span class="stringliteral">"Background window"</span>); |
|
136 <a name="l00158"></a>00158 <a class="code" href="class_c_transparent_util.html#253c26d5668451d3186cabe1744e364a">DrawWindow</a>(iBackgndWindow, TRgb(234,234,236), TRgb(0,255,0), circleRect , KBackGrndWindow); |
|
137 <a name="l00159"></a>00159 |
|
138 <a name="l00160"></a>00160 <span class="comment">//issue request to the event handler. </span> |
|
139 <a name="l00161"></a>00161 iEventHandler-><a class="code" href="class_c_event_handler.html#ac65df544e26e3ef06cc087b514c030a">IssueRequest</a>(); |
|
140 <a name="l00162"></a>00162 } |
|
141 <a name="l00163"></a>00163 |
|
142 <a name="l00171"></a><a class="code" href="class_c_transparent_util.html#253c26d5668451d3186cabe1744e364a">00171</a> <span class="keywordtype">void</span> <a class="code" href="class_c_transparent_util.html#253c26d5668451d3186cabe1744e364a">CTransparentUtil::DrawWindow</a>(RWindow& aWindow, TRgb aColor1, TRgb aColor2, TRect aRect, <span class="keyword">const</span> TDesC& aText) |
|
143 <a name="l00172"></a>00172 { |
|
144 <a name="l00173"></a>00173 aWindow.Invalidate(); |
|
145 <a name="l00174"></a>00174 aWindow.BeginRedraw(); |
|
146 <a name="l00175"></a>00175 iGc->Activate(aWindow); |
|
147 <a name="l00176"></a>00176 |
|
148 <a name="l00177"></a>00177 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
149 <a name="l00178"></a>00178 iGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
150 <a name="l00179"></a>00179 iGc->SetBrushColor(aColor1); |
|
151 <a name="l00180"></a>00180 iGc->Clear(); |
|
152 <a name="l00181"></a>00181 iGc->SetBrushColor(aColor2); |
|
153 <a name="l00182"></a>00182 iGc->DrawEllipse(aRect); |
|
154 <a name="l00183"></a>00183 iGc->UseFont(iEikonEnv->NormalFont()); |
|
155 <a name="l00184"></a>00184 iGc->DrawText(aText, TPoint(10, aWindow.Size().iHeight/2 + 5)); |
|
156 <a name="l00185"></a>00185 iGc->Deactivate(); |
|
157 <a name="l00186"></a>00186 aWindow.EndRedraw(); |
|
158 <a name="l00187"></a>00187 iWs.Flush(); |
|
159 <a name="l00188"></a>00188 } |
|
160 <a name="l00189"></a>00189 |
|
161 <a name="l00197"></a><a class="code" href="class_c_transparent_util.html#8789a4bf5bdbbd7ee94c91ac91a5c04f">00197</a> <span class="keywordtype">void</span> <a class="code" href="class_c_transparent_util.html#8789a4bf5bdbbd7ee94c91ac91a5c04f">CTransparentUtil::TransparencyVarianceL</a>() |
|
162 <a name="l00198"></a>00198 { |
|
163 <a name="l00199"></a>00199 <span class="comment">//Clear the foreground windows to the selected colour. </span> |
|
164 <a name="l00200"></a>00200 <a class="code" href="class_c_transparent_util.html#1b609f4a41da207c7a42610a42529752">ClearWindow</a>(iWs, iForegndWindowTrans, iGc, TRgb::Gray16(10)); |
|
165 <a name="l00201"></a>00201 |
|
166 <a name="l00202"></a>00202 <span class="comment">// Issue request to the active scheduler after receiving the event.</span> |
|
167 <a name="l00203"></a>00203 <span class="keywordflow">if</span>((iPeriodicObject->IsActive())) |
|
168 <a name="l00204"></a>00204 { |
|
169 <a name="l00205"></a>00205 iPeriodicObject->Cancel(); |
|
170 <a name="l00206"></a>00206 } |
|
171 <a name="l00207"></a>00207 iPeriodicObject->Start(0,<a class="code" href="transparent_8h.html#c2252065f9b9ad3eb46336220d1672ae">KDelay</a>,TCallBack(CallDoChangeTransparencyL,<span class="keyword">this</span>)); |
|
172 <a name="l00208"></a>00208 } |
|
173 <a name="l00209"></a>00209 |
|
174 <a name="l00217"></a><a class="code" href="class_c_transparent_util.html#1b609f4a41da207c7a42610a42529752">00217</a> <span class="keywordtype">void</span> <a class="code" href="class_c_transparent_util.html#1b609f4a41da207c7a42610a42529752">CTransparentUtil::ClearWindow</a>(RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TRgb aColor) |
|
175 <a name="l00218"></a>00218 { |
|
176 <a name="l00219"></a>00219 aWindow.Invalidate(); |
|
177 <a name="l00220"></a>00220 aWindow.BeginRedraw(); |
|
178 <a name="l00221"></a>00221 aGc->Activate(aWindow); |
|
179 <a name="l00222"></a>00222 aGc->SetBrushColor(aColor); |
|
180 <a name="l00223"></a>00223 aGc->Clear(); |
|
181 <a name="l00224"></a>00224 aGc->Deactivate(); |
|
182 <a name="l00225"></a>00225 aWindow.EndRedraw(); |
|
183 <a name="l00226"></a>00226 aSession.Flush(); |
|
184 <a name="l00227"></a>00227 } |
|
185 <a name="l00228"></a>00228 |
|
186 <a name="l00234"></a><a class="code" href="class_c_transparent_util.html#e5c53597e173f8e554c7f4fbda81a154">00234</a> TBool <a class="code" href="class_c_transparent_util.html#e5c53597e173f8e554c7f4fbda81a154">CTransparentUtil::DoChangeTransparencyL</a>() |
|
187 <a name="l00235"></a>00235 { |
|
188 <a name="l00236"></a>00236 <span class="comment">//iAlphaValue is the alpha value and the foreground window is redrawn to show </span> |
|
189 <a name="l00237"></a>00237 <span class="comment">//periodic transparency change. </span> |
|
190 <a name="l00238"></a>00238 iForegndWindowTrans.SetBackgroundColor( TRgb(255,0, 0, iAlphaValue)); |
|
191 <a name="l00239"></a>00239 |
|
192 <a name="l00240"></a>00240 TRect drawEllipse(TPoint(170, 45), TSize(65, 45)); |
|
193 <a name="l00241"></a>00241 _LIT(KForeGrndWindowforTrans, <span class="stringliteral">"Foreground window for Vary Tra..."</span>); |
|
194 <a name="l00242"></a>00242 <a class="code" href="class_c_transparent_util.html#253c26d5668451d3186cabe1744e364a">DrawWindow</a>(iForegndWindowTrans, TRgb(255,0,0,iAlphaValue), TRgb(100,100,100, iAlphaValue), drawEllipse, KForeGrndWindowforTrans); |
|
195 <a name="l00243"></a>00243 |
|
196 <a name="l00244"></a>00244 iAlphaValue += 20; |
|
197 <a name="l00245"></a>00245 <span class="keywordflow">if</span> (iAlphaValue < 255) |
|
198 <a name="l00246"></a>00246 { |
|
199 <a name="l00247"></a>00247 <span class="keywordflow">return</span> ETrue; |
|
200 <a name="l00248"></a>00248 } |
|
201 <a name="l00249"></a>00249 <span class="keywordflow">else</span> |
|
202 <a name="l00250"></a>00250 { |
|
203 <a name="l00251"></a>00251 iAlphaValue=0; |
|
204 <a name="l00252"></a>00252 iPeriodicObject->Cancel(); |
|
205 <a name="l00253"></a>00253 <span class="keywordflow">return</span> EFalse; |
|
206 <a name="l00254"></a>00254 } |
|
207 <a name="l00255"></a>00255 } |
|
208 <a name="l00256"></a>00256 |
|
209 <a name="l00263"></a><a class="code" href="class_c_transparent_util.html#5177889bde1510d758ef8e84b6416e5f">00263</a> <span class="keywordtype">void</span> <a class="code" href="class_c_transparent_util.html#5177889bde1510d758ef8e84b6416e5f">CTransparentUtil::TransparentRegionL</a>() |
|
210 <a name="l00264"></a>00264 { |
|
211 <a name="l00265"></a>00265 <span class="comment">//iBoolVisible is a boolean variable used to toggle the visibility of foreground</span> |
|
212 <a name="l00266"></a>00266 <span class="comment">//window on TransparentRegionL().. button press</span> |
|
213 <a name="l00267"></a>00267 <span class="keywordflow">if</span>(iBoolVisible) |
|
214 <a name="l00268"></a>00268 { |
|
215 <a name="l00269"></a>00269 iFgndWinTransRegion.SetVisible(EFalse); |
|
216 <a name="l00270"></a>00270 iBoolVisible = EFalse; |
|
217 <a name="l00271"></a>00271 iWs.Flush(); |
|
218 <a name="l00272"></a>00272 } |
|
219 <a name="l00273"></a>00273 <span class="keywordflow">else</span> |
|
220 <a name="l00274"></a>00274 { |
|
221 <a name="l00275"></a>00275 iFgndWinTransRegion.SetVisible(ETrue); |
|
222 <a name="l00276"></a>00276 |
|
223 <a name="l00277"></a>00277 <span class="comment">//set background colour of the foreground window as blue and alpha value as 50. </span> |
|
224 <a name="l00278"></a>00278 iFgndWinTransRegion.SetBackgroundColor(TRgb(0, 0 , 255 , 50)); |
|
225 <a name="l00279"></a>00279 |
|
226 <a name="l00280"></a>00280 <span class="comment">//create a rectsize which is half the size of the foreground window. </span> |
|
227 <a name="l00281"></a>00281 TSize rectsize1(iScr->SizeInPixels().iWidth/2,iScr->SizeInPixels().iHeight/4); |
|
228 <a name="l00282"></a>00282 TRect chopRect1(TPoint(0, iScr->SizeInPixels().iHeight/4), rectsize1); |
|
229 <a name="l00283"></a>00283 |
|
230 <a name="l00284"></a>00284 <span class="comment">//Take a region which is the lower half of the foreground window. </span> |
|
231 <a name="l00285"></a>00285 <a class="code" href="class_c_transparent_util.html#4135115c4d379b09d56f90cdd2f77d2a">iRegion</a> = TRegionFix<2>(chopRect1); |
|
232 <a name="l00286"></a>00286 <span class="comment">//Use SetTransparentRegion() to keep only the region specified by iRegion as transparent.</span> |
|
233 <a name="l00287"></a>00287 iFgndWinTransRegion.SetTransparentRegion(<a class="code" href="class_c_transparent_util.html#4135115c4d379b09d56f90cdd2f77d2a">iRegion</a>); |
|
234 <a name="l00288"></a>00288 |
|
235 <a name="l00289"></a>00289 <span class="comment">//Invalidate and begin redraw on the opaque region of the foreground window. </span> |
|
236 <a name="l00290"></a>00290 TRect chopRect2(TPoint(0, 0), rectsize1); |
|
237 <a name="l00291"></a>00291 <span class="comment">//Draw a circle on the opaque region of the foreground window. </span> |
|
238 <a name="l00292"></a>00292 TRect circleRect2(TPoint(60,20), TSize(40, 40)); |
|
239 <a name="l00293"></a>00293 _LIT(KOpqRegion, <span class="stringliteral">"Opaque region of the transparent window"</span>); |
|
240 <a name="l00294"></a>00294 <a class="code" href="class_c_transparent_util.html#b552b1972db4ef4c22a6733e8f48a959">DrawWindowRegion</a>(iFgndWinTransRegion, TRgb(255, 255, 0), TRgb(100, 100, 0), chopRect2, circleRect2, KOpqRegion, TPoint(10, 15)); |
|
241 <a name="l00295"></a>00295 |
|
242 <a name="l00296"></a>00296 <span class="comment">//Invalidate and begin redraw on the transparent region of the foreground window. </span> |
|
243 <a name="l00297"></a>00297 TRect circleRect3(TPoint(110,80), TSize(40, 40)); |
|
244 <a name="l00298"></a>00298 _LIT(KTransRegion, <span class="stringliteral">"Transparent region of the transparent window"</span>); |
|
245 <a name="l00299"></a>00299 <a class="code" href="class_c_transparent_util.html#b552b1972db4ef4c22a6733e8f48a959">DrawWindowRegion</a>(iFgndWinTransRegion, TRgb(0, 0 , 255 , 50), TRgb(255,0,0, 100), chopRect1, circleRect3, KTransRegion, TPoint(10, 75)); |
|
246 <a name="l00300"></a>00300 iBoolVisible = ETrue; |
|
247 <a name="l00301"></a>00301 } |
|
248 <a name="l00302"></a>00302 } |
|
249 <a name="l00303"></a>00303 |
|
250 <a name="l00314"></a><a class="code" href="class_c_transparent_util.html#b552b1972db4ef4c22a6733e8f48a959">00314</a> <span class="keywordtype">void</span> <a class="code" href="class_c_transparent_util.html#b552b1972db4ef4c22a6733e8f48a959">CTransparentUtil::DrawWindowRegion</a>(RWindow& aWindow, TRgb aColor1, TRgb aColor2, TRect aChopRect, TRect aRect, <span class="keyword">const</span> TDesC& aText, <span class="keyword">const</span> TPoint& aPoint) |
|
251 <a name="l00315"></a>00315 { |
|
252 <a name="l00316"></a>00316 aWindow.Invalidate(aChopRect); |
|
253 <a name="l00317"></a>00317 aWindow.BeginRedraw(aChopRect); |
|
254 <a name="l00318"></a>00318 iGc->Activate(aWindow); |
|
255 <a name="l00319"></a>00319 |
|
256 <a name="l00320"></a>00320 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
257 <a name="l00321"></a>00321 iGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
258 <a name="l00322"></a>00322 |
|
259 <a name="l00323"></a>00323 iGc->SetBrushColor(aColor1); |
|
260 <a name="l00324"></a>00324 iGc->Clear(); |
|
261 <a name="l00325"></a>00325 |
|
262 <a name="l00326"></a>00326 iGc->SetBrushColor(aColor2); |
|
263 <a name="l00327"></a>00327 iGc->DrawEllipse(aRect); |
|
264 <a name="l00328"></a>00328 iGc->SetBrushColor(TRgb(0, 0, 0)); |
|
265 <a name="l00329"></a>00329 iGc->UseFont(iEikonEnv->NormalFont()); |
|
266 <a name="l00330"></a>00330 iGc->DrawText(aText, aPoint); |
|
267 <a name="l00331"></a>00331 iGc->Deactivate(); |
|
268 <a name="l00332"></a>00332 aWindow.EndRedraw(); |
|
269 <a name="l00333"></a>00333 iWs.Flush(); |
|
270 <a name="l00334"></a>00334 } |
|
271 </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 21 10:32:58 2010 for TB10.1 Example Applications by |
|
272 <a href="http://www.doxygen.org/index.html"> |
|
273 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> |
|
274 </body> |
|
275 </html> |