Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Wnd.cpp

Issue 1243883003: Fix else-after-returns throughout pdfium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, Address comments. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_FontMap.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "../../include/pdfwindow/PDFWindow.h" 9 #include "../../include/pdfwindow/PDFWindow.h"
10 #include "../../include/pdfwindow/PWL_Wnd.h" 10 #include "../../include/pdfwindow/PWL_Wnd.h"
11 #include "../../include/pdfwindow/PWL_Utils.h" 11 #include "../../include/pdfwindow/PWL_Utils.h"
12 #include "../../include/pdfwindow/PWL_ScrollBar.h" 12 #include "../../include/pdfwindow/PWL_ScrollBar.h"
13 13
14 /* -------------------------- CPWL_Timer -------------------------- */ 14 /* -------------------------- CPWL_Timer -------------------------- */
15 15
16 static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() 16 static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap()
17 { 17 {
18 // Leak the object at shutdown. 18 // Leak the object at shutdown.
19 static auto timeMap = new std::map<int32_t, CPWL_Timer*>; 19 static auto timeMap = new std::map<int32_t, CPWL_Timer*>;
20 return *timeMap; 20 return *timeMap;
21 } 21 }
22 22
23 CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemH andler) : 23 CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemH andler) :
24 » m_nTimerID(0), 24 m_nTimerID(0),
25 » m_pAttached(pAttached), 25 m_pAttached(pAttached),
26 » m_pSystemHandler(pSystemHandler) 26 m_pSystemHandler(pSystemHandler)
27 { 27 {
28 » ASSERT(m_pAttached != NULL); 28 ASSERT(m_pAttached != NULL);
29 » ASSERT(m_pSystemHandler != NULL); 29 ASSERT(m_pSystemHandler != NULL);
30 } 30 }
31 31
32 CPWL_Timer::~CPWL_Timer() 32 CPWL_Timer::~CPWL_Timer()
33 { 33 {
34 » KillPWLTimer(); 34 KillPWLTimer();
35 } 35 }
36 36
37 int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse) 37 int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse)
38 { 38 {
39 if (m_nTimerID != 0) 39 if (m_nTimerID != 0)
40 KillPWLTimer(); 40 KillPWLTimer();
41 m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc); 41 m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc);
42 42
43 GetPWLTimeMap()[m_nTimerID] = this; 43 GetPWLTimeMap()[m_nTimerID] = this;
44 return m_nTimerID; 44 return m_nTimerID;
(...skipping 26 matching lines...) Expand all
71 { 71 {
72 } 72 }
73 73
74 CPWL_TimerHandler::~CPWL_TimerHandler() 74 CPWL_TimerHandler::~CPWL_TimerHandler()
75 { 75 {
76 delete m_pTimer; 76 delete m_pTimer;
77 } 77 }
78 78
79 void CPWL_TimerHandler::BeginTimer(int32_t nElapse) 79 void CPWL_TimerHandler::BeginTimer(int32_t nElapse)
80 { 80 {
81 » if (!m_pTimer) 81 if (!m_pTimer)
82 » » m_pTimer = new CPWL_Timer(this, GetSystemHandler()); 82 m_pTimer = new CPWL_Timer(this, GetSystemHandler());
83 83
84 » if (m_pTimer) 84 if (m_pTimer)
85 » » m_pTimer->SetPWLTimer(nElapse); 85 m_pTimer->SetPWLTimer(nElapse);
86 } 86 }
87 87
88 void CPWL_TimerHandler::EndTimer() 88 void CPWL_TimerHandler::EndTimer()
89 { 89 {
90 » if (m_pTimer) 90 if (m_pTimer)
91 » » m_pTimer->KillPWLTimer(); 91 m_pTimer->KillPWLTimer();
92 } 92 }
93 93
94 void CPWL_TimerHandler::TimerProc() 94 void CPWL_TimerHandler::TimerProc()
95 { 95 {
96 } 96 }
97 97
98 /* --------------------------- CPWL_MsgControl ---------------------------- */ 98 /* --------------------------- CPWL_MsgControl ---------------------------- */
99 99
100 class CPWL_MsgControl 100 class CPWL_MsgControl
101 { 101 {
102 » friend class CPWL_Wnd; 102 friend class CPWL_Wnd;
103 103
104 public: 104 public:
105 » CPWL_MsgControl(CPWL_Wnd * pWnd) 105 CPWL_MsgControl(CPWL_Wnd * pWnd)
106 » { 106 {
107 //» » PWL_TRACE("new CPWL_MsgControl\n"); 107 // PWL_TRACE("new CPWL_MsgControl\n");
108 » » m_pCreatedWnd = pWnd; 108 m_pCreatedWnd = pWnd;
109 » » Default(); 109 Default();
110 » } 110 }
111 111
112 » ~CPWL_MsgControl() 112 ~CPWL_MsgControl()
113 » { 113 {
114 //» » PWL_TRACE("~CPWL_MsgControl\n"); 114 // PWL_TRACE("~CPWL_MsgControl\n");
115 » » Default(); 115 Default();
116 » } 116 }
117 117
118 » void Default() 118 void Default()
119 » { 119 {
120 » » m_aMousePath.RemoveAll(); 120 m_aMousePath.RemoveAll();
121 » » m_aKeyboardPath.RemoveAll(); 121 m_aKeyboardPath.RemoveAll();
122 » » m_pMainMouseWnd = NULL; 122 m_pMainMouseWnd = NULL;
123 » » m_pMainKeyboardWnd = NULL; 123 m_pMainKeyboardWnd = NULL;
124 » } 124 }
125 125
126 » FX_BOOL IsWndCreated(const CPWL_Wnd * pWnd) const 126 FX_BOOL IsWndCreated(const CPWL_Wnd * pWnd) const
127 » { 127 {
128 » » return m_pCreatedWnd == pWnd; 128 return m_pCreatedWnd == pWnd;
129 » } 129 }
130 130
131 » FX_BOOL IsMainCaptureMouse(const CPWL_Wnd * pWnd) const 131 FX_BOOL IsMainCaptureMouse(const CPWL_Wnd * pWnd) const
132 » { 132 {
133 » » return pWnd == m_pMainMouseWnd; 133 return pWnd == m_pMainMouseWnd;
134 » } 134 }
135 135
136 » FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const 136 FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const
137 » { 137 {
138 » » if (pWnd) 138 if (pWnd)
139 » » » for( int32_t i=0,sz=m_aMousePath.GetSize(); i<sz; i++) 139 for( int32_t i=0,sz=m_aMousePath.GetSize(); i<sz; i++)
140 » » » » if (m_aMousePath.GetAt(i) == pWnd) 140 if (m_aMousePath.GetAt(i) == pWnd)
141 » » » » » return TRUE; 141 return TRUE;
142 142
143 » » return FALSE; 143 return FALSE;
144 » } 144 }
145 145
146 » FX_BOOL IsMainCaptureKeyboard(const CPWL_Wnd * pWnd) const 146 FX_BOOL IsMainCaptureKeyboard(const CPWL_Wnd * pWnd) const
147 » { 147 {
148 » » return pWnd == m_pMainKeyboardWnd; 148 return pWnd == m_pMainKeyboardWnd;
149 » } 149 }
150 150
151 151
152 » FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const 152 FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const
153 » { 153 {
154 » » if (pWnd) 154 if (pWnd)
155 » » » for( int32_t i=0,sz=m_aKeyboardPath.GetSize(); i<sz; i++ ) 155 for( int32_t i=0,sz=m_aKeyboardPath.GetSize(); i<sz; i++)
156 » » » » if (m_aKeyboardPath.GetAt(i) == pWnd) 156 if (m_aKeyboardPath.GetAt(i) == pWnd)
157 » » » » » return TRUE; 157 return TRUE;
158 158
159 » » return FALSE; 159 return FALSE;
160 » } 160 }
161 161
162 » void SetFocus(CPWL_Wnd * pWnd) 162 void SetFocus(CPWL_Wnd * pWnd)
163 » { 163 {
164 » » m_aKeyboardPath.RemoveAll(); 164 m_aKeyboardPath.RemoveAll();
165 165
166 » » if (pWnd) 166 if (pWnd)
167 » » { 167 {
168 » » » m_pMainKeyboardWnd = pWnd; 168 m_pMainKeyboardWnd = pWnd;
169 169
170 » » » CPWL_Wnd * pParent = pWnd; 170 CPWL_Wnd * pParent = pWnd;
171 » » » while (pParent) 171 while (pParent)
172 » » » { 172 {
173 » » » » m_aKeyboardPath.Add(pParent); 173 m_aKeyboardPath.Add(pParent);
174 » » » » pParent = pParent->GetParentWindow(); 174 pParent = pParent->GetParentWindow();
175 » » » } 175 }
176 176
177 » » » pWnd->OnSetFocus(); 177 pWnd->OnSetFocus();
178 » » } 178 }
179 » } 179 }
180 180
181 » void KillFocus() 181 void KillFocus()
182 » { 182 {
183 » » if (m_aKeyboardPath.GetSize() > 0) 183 if (m_aKeyboardPath.GetSize() > 0)
184 » » » if (CPWL_Wnd* pWnd = m_aKeyboardPath.GetAt(0)) 184 if (CPWL_Wnd* pWnd = m_aKeyboardPath.GetAt(0))
185 » » » » pWnd->OnKillFocus(); 185 pWnd->OnKillFocus();
186 186
187 » » m_pMainKeyboardWnd = NULL; 187 m_pMainKeyboardWnd = NULL;
188 » » m_aKeyboardPath.RemoveAll(); 188 m_aKeyboardPath.RemoveAll();
189 » } 189 }
190 190
191 » void SetCapture(CPWL_Wnd * pWnd) 191 void SetCapture(CPWL_Wnd * pWnd)
192 » { 192 {
193 » » m_aMousePath.RemoveAll(); 193 m_aMousePath.RemoveAll();
194 194
195 » » if (pWnd) 195 if (pWnd)
196 » » { 196 {
197 » » » m_pMainMouseWnd = pWnd; 197 m_pMainMouseWnd = pWnd;
198 198
199 » » » CPWL_Wnd * pParent = pWnd; 199 CPWL_Wnd * pParent = pWnd;
200 » » » while (pParent) 200 while (pParent)
201 » » » { 201 {
202 » » » » m_aMousePath.Add(pParent); 202 m_aMousePath.Add(pParent);
203 » » » » pParent = pParent->GetParentWindow(); 203 pParent = pParent->GetParentWindow();
204 » » » } 204 }
205 » » } 205 }
206 » } 206 }
207 207
208 » void ReleaseCapture() 208 void ReleaseCapture()
209 » { 209 {
210 » » m_pMainMouseWnd = NULL; 210 m_pMainMouseWnd = NULL;
211 » » m_aMousePath.RemoveAll(); 211 m_aMousePath.RemoveAll();
212 » } 212 }
213 213
214 private: 214 private:
215 » CFX_ArrayTemplate<CPWL_Wnd*>» m_aMousePath; 215 CFX_ArrayTemplate<CPWL_Wnd*> m_aMousePath;
216 » CFX_ArrayTemplate<CPWL_Wnd*>» m_aKeyboardPath; 216 CFX_ArrayTemplate<CPWL_Wnd*> m_aKeyboardPath;
217 » CPWL_Wnd*» » » » » » m_pCreatedWnd; 217 CPWL_Wnd* m_pCreatedWnd;
218 » CPWL_Wnd*» » » » » » m_pMainMouseWnd; 218 CPWL_Wnd* m_pMainMouseWnd;
219 » CPWL_Wnd*» » » » » » m_pMainKeyboardW nd; 219 CPWL_Wnd* m_pMainKeyboardWnd;
220 }; 220 };
221 221
222 /* --------------------------- CPWL_Wnd ---------------------------- */ 222 /* --------------------------- CPWL_Wnd ---------------------------- */
223 223
224 CPWL_Wnd::CPWL_Wnd() : 224 CPWL_Wnd::CPWL_Wnd() :
225 » m_pVScrollBar(NULL), 225 m_pVScrollBar(NULL),
226 » m_rcWindow(), 226 m_rcWindow(),
227 » m_rcClip(), 227 m_rcClip(),
228 » m_bCreated(FALSE), 228 m_bCreated(FALSE),
229 » m_bVisible(FALSE), 229 m_bVisible(FALSE),
230 » m_bNotifying(FALSE), 230 m_bNotifying(FALSE),
231 » m_bEnabled(TRUE) 231 m_bEnabled(TRUE)
232 { 232 {
233 } 233 }
234 234
235 CPWL_Wnd::~CPWL_Wnd() 235 CPWL_Wnd::~CPWL_Wnd()
236 { 236 {
237 » ASSERT(m_bCreated == FALSE); 237 ASSERT(m_bCreated == FALSE);
238 } 238 }
239 239
240 CFX_ByteString CPWL_Wnd::GetClassName() const 240 CFX_ByteString CPWL_Wnd::GetClassName() const
241 { 241 {
242 » return "CPWL_Wnd"; 242 return "CPWL_Wnd";
243 } 243 }
244 244
245 void CPWL_Wnd::Create(const PWL_CREATEPARAM & cp) 245 void CPWL_Wnd::Create(const PWL_CREATEPARAM & cp)
246 { 246 {
247 » if (!IsValid()) 247 if (!IsValid())
248 » { 248 {
249 » » m_sPrivateParam = cp; 249 m_sPrivateParam = cp;
250 250
251 » » OnCreate(m_sPrivateParam); 251 OnCreate(m_sPrivateParam);
252 252
253 » » m_sPrivateParam.rcRectWnd.Normalize(); 253 m_sPrivateParam.rcRectWnd.Normalize();
254 » » m_rcWindow = m_sPrivateParam.rcRectWnd; 254 m_rcWindow = m_sPrivateParam.rcRectWnd;
255 » » m_rcClip = CPWL_Utils::InflateRect(m_rcWindow,1.0f); 255 m_rcClip = CPWL_Utils::InflateRect(m_rcWindow,1.0f);
256 256
257 » » CreateMsgControl(); 257 CreateMsgControl();
258 258
259 » » if (m_sPrivateParam.pParentWnd) 259 if (m_sPrivateParam.pParentWnd)
260 » » » m_sPrivateParam.pParentWnd->OnNotify(this, PNM_ADDCHILD) ; 260 m_sPrivateParam.pParentWnd->OnNotify(this, PNM_ADDCHILD);
261 261
262 » » PWL_CREATEPARAM ccp = m_sPrivateParam; 262 PWL_CREATEPARAM ccp = m_sPrivateParam;
263 263
264 » » ccp.dwFlags &= 0xFFFF0000L; //remove sub styles 264 ccp.dwFlags &= 0xFFFF0000L; //remove sub styles
265 » » ccp.mtChild = CPDF_Matrix(1,0,0,1,0,0); 265 ccp.mtChild = CPDF_Matrix(1,0,0,1,0,0);
266 266
267 » » CreateScrollBar(ccp); 267 CreateScrollBar(ccp);
268 » » CreateChildWnd(ccp); 268 CreateChildWnd(ccp);
269 269
270 » » m_bVisible = HasFlag(PWS_VISIBLE); 270 m_bVisible = HasFlag(PWS_VISIBLE);
271 271
272 » » OnCreated(); 272 OnCreated();
273 273
274 » » RePosChildWnd(); 274 RePosChildWnd();
275 » » m_bCreated = TRUE; 275 m_bCreated = TRUE;
276 » } 276 }
277 } 277 }
278 278
279 void CPWL_Wnd::OnCreate(PWL_CREATEPARAM & cp) 279 void CPWL_Wnd::OnCreate(PWL_CREATEPARAM & cp)
280 { 280 {
281 } 281 }
282 282
283 void CPWL_Wnd::OnCreated() 283 void CPWL_Wnd::OnCreated()
284 { 284 {
285 } 285 }
286 286
287 void CPWL_Wnd::OnDestroy() 287 void CPWL_Wnd::OnDestroy()
288 { 288 {
289 } 289 }
290 290
291 void CPWL_Wnd::Destroy() 291 void CPWL_Wnd::Destroy()
292 { 292 {
293 » KillFocus(); 293 KillFocus();
294 294
295 » OnDestroy(); 295 OnDestroy();
296 296
297 » if (m_bCreated) 297 if (m_bCreated)
298 » { 298 {
299 » » for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --) 299 for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --)
300 » » { 300 {
301 » » » if (CPWL_Wnd * pChild = m_aChildren[i]) 301 if (CPWL_Wnd * pChild = m_aChildren[i])
302 » » » { 302 {
303 » » » » pChild->Destroy(); 303 pChild->Destroy();
304 » » » » delete pChild; 304 delete pChild;
305 » » » » pChild = NULL; 305 pChild = NULL;
306 » » » } 306 }
307 » » } 307 }
308 308
309 » » if (m_sPrivateParam.pParentWnd) 309 if (m_sPrivateParam.pParentWnd)
310 » » » m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHI LD); 310 m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHILD);
311 » » m_bCreated = FALSE; 311 m_bCreated = FALSE;
312 » } 312 }
313 313
314 » DestroyMsgControl(); 314 DestroyMsgControl();
315 315
316 » FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM)); 316 FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM));
317 » m_aChildren.RemoveAll(); 317 m_aChildren.RemoveAll();
318 » m_pVScrollBar = NULL; 318 m_pVScrollBar = NULL;
319 } 319 }
320 320
321 void CPWL_Wnd::Move(const CPDF_Rect & rcNew, FX_BOOL bReset,FX_BOOL bRefresh) 321 void CPWL_Wnd::Move(const CPDF_Rect & rcNew, FX_BOOL bReset,FX_BOOL bRefresh)
322 { 322 {
323 » if (IsValid()) 323 if (IsValid())
324 » { 324 {
325 » » CPDF_Rect rcOld = GetWindowRect(); 325 CPDF_Rect rcOld = GetWindowRect();
326 326
327 » » m_rcWindow = rcNew; 327 m_rcWindow = rcNew;
328 » » m_rcWindow.Normalize(); 328 m_rcWindow.Normalize();
329 329
330 » » if (rcOld.left != rcNew.left || rcOld.right != rcNew.right || 330 if (rcOld.left != rcNew.left || rcOld.right != rcNew.right ||
331 » » » rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom) 331 rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom)
332 » » { 332 {
333 » » » if (bReset) 333 if (bReset)
334 » » » { 334 {
335 » » » » RePosChildWnd(); 335 RePosChildWnd();
336 » » » } 336 }
337 337
338 » » } 338 }
339 » » if (bRefresh) 339 if (bRefresh)
340 » » { 340 {
341 » » » InvalidateRectMove(rcOld,rcNew); 341 InvalidateRectMove(rcOld,rcNew);
342 » » } 342 }
343 343
344 » » m_sPrivateParam.rcRectWnd = m_rcWindow; 344 m_sPrivateParam.rcRectWnd = m_rcWindow;
345 » } 345 }
346 } 346 }
347 347
348 void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rc New) 348 void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rc New)
349 { 349 {
350 » CPDF_Rect rcUnion = rcOld; 350 CPDF_Rect rcUnion = rcOld;
351 » rcUnion.Union(rcNew); 351 rcUnion.Union(rcNew);
352 352
353 » InvalidateRect(&rcUnion); 353 InvalidateRect(&rcUnion);
354 } 354 }
355 355
356 void CPWL_Wnd::GetAppearanceStream(CFX_ByteString & sAppStream) 356 void CPWL_Wnd::GetAppearanceStream(CFX_ByteString & sAppStream)
357 { 357 {
358 » if (IsValid()) 358 if (IsValid())
359 » { 359 {
360 » » CFX_ByteTextBuf sTextBuf; 360 CFX_ByteTextBuf sTextBuf;
361 » » GetAppearanceStream(sTextBuf); 361 GetAppearanceStream(sTextBuf);
362 » » sAppStream += sTextBuf.GetByteString(); 362 sAppStream += sTextBuf.GetByteString();
363 » } 363 }
364 } 364 }
365 365
366 void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf & sAppStream) 366 void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf & sAppStream)
367 { 367 {
368 » if (IsValid() && IsVisible()) 368 if (IsValid() && IsVisible())
369 » { 369 {
370 » » GetThisAppearanceStream(sAppStream); 370 GetThisAppearanceStream(sAppStream);
371 » » GetChildAppearanceStream(sAppStream); 371 GetChildAppearanceStream(sAppStream);
372 » } 372 }
373 } 373 }
374 374
375 //if don't set,Get default apperance stream 375 //if don't set,Get default apperance stream
376 void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) 376 void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream)
377 { 377 {
378 CPDF_Rect rectWnd = GetWindowRect(); 378 CPDF_Rect rectWnd = GetWindowRect();
379 if (!rectWnd.IsEmpty()) { 379 if (!rectWnd.IsEmpty()) {
380 CFX_ByteTextBuf sThis; 380 CFX_ByteTextBuf sThis;
381 381
382 if (HasFlag(PWS_BACKGROUND)) 382 if (HasFlag(PWS_BACKGROUND))
383 sThis << CPWL_Utils::GetRectFillAppStream(rectWnd, GetBackgroundColo r()); 383 sThis << CPWL_Utils::GetRectFillAppStream(rectWnd, GetBackgroundColo r());
384 384
385 if (HasFlag(PWS_BORDER)) { 385 if (HasFlag(PWS_BORDER)) {
386 sThis << CPWL_Utils::GetBorderAppStream( 386 sThis << CPWL_Utils::GetBorderAppStream(
387 rectWnd, 387 rectWnd,
388 (FX_FLOAT)GetBorderWidth(), 388 (FX_FLOAT)GetBorderWidth(),
389 GetBorderColor(), 389 GetBorderColor(),
390 GetBorderLeftTopColor(GetBorderStyle()), 390 GetBorderLeftTopColor(GetBorderStyle()),
391 GetBorderRightBottomColor(GetBorderStyle()), 391 GetBorderRightBottomColor(GetBorderStyle()),
392 GetBorderStyle(), 392 GetBorderStyle(),
393 GetBorderDash()); 393 GetBorderDash());
394 } 394 }
395 395
396 sAppStream << sThis; 396 sAppStream << sThis;
397 } 397 }
398 } 398 }
399 399
400 void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream) 400 void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream)
401 { 401 {
402 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 402 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
403 » { 403 {
404 » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) 404 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
405 » » { 405 {
406 » » » pChild->GetAppearanceStream(sAppStream); 406 pChild->GetAppearanceStream(sAppStream);
407 » » } 407 }
408 » } 408 }
409 } 409 }
410 410
411 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce) 411 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce)
412 { 412 {
413 » if (IsValid() && IsVisible()) 413 if (IsValid() && IsVisible())
414 » { 414 {
415 » » DrawThisAppearance(pDevice,pUser2Device); 415 DrawThisAppearance(pDevice,pUser2Device);
416 » » DrawChildAppearance(pDevice,pUser2Device); 416 DrawChildAppearance(pDevice,pUser2Device);
417 » } 417 }
418 } 418 }
419 419
420 void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2 Device) 420 void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2 Device)
421 { 421 {
422 » CPDF_Rect rectWnd = GetWindowRect(); 422 CPDF_Rect rectWnd = GetWindowRect();
423 » if (!rectWnd.IsEmpty()) 423 if (!rectWnd.IsEmpty())
424 » { 424 {
425 » » if (HasFlag(PWS_BACKGROUND)) 425 if (HasFlag(PWS_BACKGROUND))
426 » » { 426 {
427 » » » CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rectWnd,(FX _FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); 427 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rectWnd,(FX_FLOAT)(GetB orderWidth()+GetInnerBorderWidth()));
428 » » » CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rcClient, GetBackgroundColor(), GetTransparency()); 428 CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rcClient, GetBackgroun dColor(), GetTransparency());
429 » » } 429 }
430 430
431 » » if (HasFlag(PWS_BORDER)) 431 if (HasFlag(PWS_BORDER))
432 » » » CPWL_Utils::DrawBorder(pDevice, 432 CPWL_Utils::DrawBorder(pDevice,
433 » » » » » » » » pUser2Device, 433 pUser2Device,
434 » » » » » » » » rectWnd, 434 rectWnd,
435 » » » » » » » » (FX_FLOAT)GetBor derWidth(), 435 (FX_FLOAT)GetBorderWidth(),
436 » » » » » » » » GetBorderColor() , 436 GetBorderColor(),
437 » » » » » » » » GetBorderLeftTop Color(GetBorderStyle()), 437 GetBorderLeftTopColor(GetBorderStyle()),
438 » » » » » » » » GetBorderRightBo ttomColor(GetBorderStyle()), 438 GetBorderRightBottomColor(GetBorderStyle()),
439 » » » » » » » » GetBorderStyle() , 439 GetBorderStyle(),
440 » » » » » » » » GetBorderDash(), 440 GetBorderDash(),
441 » » » » » » » » GetTransparency( )); 441 GetTransparency());
442 » } 442 }
443 } 443 }
444 444
445 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser 2Device) 445 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser 2Device)
446 { 446 {
447 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 447 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
448 » { 448 {
449 » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) 449 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
450 » » { 450 {
451 » » » CPDF_Matrix mt = pChild->GetChildMatrix(); 451 CPDF_Matrix mt = pChild->GetChildMatrix();
452 » » » if (mt.IsIdentity()) 452 if (mt.IsIdentity())
453 » » » { 453 {
454 » » » » pChild->DrawAppearance(pDevice,pUser2Device); 454 pChild->DrawAppearance(pDevice,pUser2Device);
455 » » » } 455 }
456 » » » else 456 else
457 » » » { 457 {
458 » » » » mt.Concat(*pUser2Device); 458 mt.Concat(*pUser2Device);
459 » » » » pChild->DrawAppearance(pDevice,&mt); 459 pChild->DrawAppearance(pDevice,&mt);
460 » » » } 460 }
461 » » } 461 }
462 » } 462 }
463 } 463 }
464 464
465 void CPWL_Wnd::InvalidateRect(CPDF_Rect* pRect) 465 void CPWL_Wnd::InvalidateRect(CPDF_Rect* pRect)
466 { 466 {
467 » if (IsValid()) 467 if (IsValid())
468 » { 468 {
469 » » CPDF_Rect rcRefresh = pRect ? *pRect : GetWindowRect(); 469 CPDF_Rect rcRefresh = pRect ? *pRect : GetWindowRect();
470 470
471 » » if (!HasFlag(PWS_NOREFRESHCLIP)) 471 if (!HasFlag(PWS_NOREFRESHCLIP))
472 » » { 472 {
473 » » » CPDF_Rect rcClip = GetClipRect(); 473 CPDF_Rect rcClip = GetClipRect();
474 » » » if (!rcClip.IsEmpty()) 474 if (!rcClip.IsEmpty())
475 » » » { 475 {
476 » » » » rcRefresh.Intersect(rcClip); 476 rcRefresh.Intersect(rcClip);
477 » » » } 477 }
478 » » } 478 }
479 479
480 » » FX_RECT rcWin = PWLtoWnd(rcRefresh); 480 FX_RECT rcWin = PWLtoWnd(rcRefresh);
481 » » rcWin.left -= PWL_INVALIDATE_INFLATE; 481 rcWin.left -= PWL_INVALIDATE_INFLATE;
482 » » rcWin.top -= PWL_INVALIDATE_INFLATE; 482 rcWin.top -= PWL_INVALIDATE_INFLATE;
483 » » rcWin.right += PWL_INVALIDATE_INFLATE; 483 rcWin.right += PWL_INVALIDATE_INFLATE;
484 » » rcWin.bottom += PWL_INVALIDATE_INFLATE; 484 rcWin.bottom += PWL_INVALIDATE_INFLATE;
485 485
486 » » if (IFX_SystemHandler* pSH = GetSystemHandler()) 486 if (IFX_SystemHandler* pSH = GetSystemHandler())
487 » » { 487 {
488 » » » if (FX_HWND hWnd = GetAttachedHWnd()) 488 if (FX_HWND hWnd = GetAttachedHWnd())
489 » » » { 489 {
490 » » » » pSH->InvalidateRect(hWnd, rcWin); 490 pSH->InvalidateRect(hWnd, rcWin);
491 » » » } 491 }
492 » » } 492 }
493 » } 493 }
494 } 494 }
495 495
496 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name)\ 496 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name)\
497 FX_BOOL CPWL_Wnd::key_method_name(FX_WORD nChar, FX_DWORD nFlag)\ 497 FX_BOOL CPWL_Wnd::key_method_name(FX_WORD nChar, FX_DWORD nFlag)\
498 {\ 498 {\
499 » if (IsValid() && IsVisible() && IsEnabled())\ 499 if (IsValid() && IsVisible() && IsEnabled())\
500 » {\ 500 {\
501 » » if (IsWndCaptureKeyboard(this))\ 501 if (IsWndCaptureKeyboard(this))\
502 » » {\ 502 {\
503 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\ 503 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\
504 » » » {\ 504 {\
505 » » » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\ 505 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\
506 » » » » {\ 506 {\
507 » » » » » if (IsWndCaptureKeyboard(pChild))\ 507 if (IsWndCaptureKeyboard(pChild))\
508 » » » » » {\ 508 {\
509 » » » » » » return pChild->key_method_name(n Char,nFlag);\ 509 return pChild->key_method_name(nChar,nFlag);\
510 » » » » » }\ 510 }\
511 » » » » }\ 511 }\
512 » » » }\ 512 }\
513 » » }\ 513 }\
514 » }\ 514 }\
515 » return FALSE;\ 515 return FALSE;\
516 } 516 }
517 517
518 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)\ 518 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)\
519 FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point & point, FX_DWORD nFlag)\ 519 FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point & point, FX_DWORD nFlag)\
520 {\ 520 {\
521 » if (IsValid() && IsVisible() && IsEnabled())\ 521 if (IsValid() && IsVisible() && IsEnabled())\
522 » {\ 522 {\
523 » » if (IsWndCaptureMouse(this))\ 523 if (IsWndCaptureMouse(this))\
524 » » {\ 524 {\
525 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\ 525 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\
526 » » » {\ 526 {\
527 » » » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\ 527 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\
528 » » » » {\ 528 {\
529 » » » » » if (IsWndCaptureMouse(pChild))\ 529 if (IsWndCaptureMouse(pChild))\
530 » » » » » {\ 530 {\
531 » » » » » » return pChild->mouse_method_name (pChild->ParentToChild(point),nFlag);\ 531 return pChild->mouse_method_name(pChild->ParentToChild(p oint),nFlag);\
532 » » » » » }\ 532 }\
533 » » » » }\ 533 }\
534 » » » }\ 534 }\
535 » » » SetCursor();\ 535 SetCursor();\
536 » » }\ 536 }\
537 » » else\ 537 else\
538 » » {\ 538 {\
539 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\ 539 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\
540 » » » {\ 540 {\
541 » » » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\ 541 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\
542 » » » » {\ 542 {\
543 » » » » » if (pChild->WndHitTest(pChild->ParentToC hild(point)))\ 543 if (pChild->WndHitTest(pChild->ParentToChild(point)))\
544 » » » » » {\ 544 {\
545 » » » » » » return pChild->mouse_method_name (pChild->ParentToChild(point),nFlag);\ 545 return pChild->mouse_method_name(pChild->ParentToChild(p oint),nFlag);\
546 » » » » » }\ 546 }\
547 » » » » }\ 547 }\
548 » » » }\ 548 }\
549 » » » if (WndHitTest(point))\ 549 if (WndHitTest(point))\
550 » » » » SetCursor();\ 550 SetCursor();\
551 » » }\ 551 }\
552 » }\ 552 }\
553 » return FALSE;\ 553 return FALSE;\
554 } 554 }
555 555
556 PWL_IMPLEMENT_KEY_METHOD(OnKeyDown) 556 PWL_IMPLEMENT_KEY_METHOD(OnKeyDown)
557 PWL_IMPLEMENT_KEY_METHOD(OnKeyUp) 557 PWL_IMPLEMENT_KEY_METHOD(OnKeyUp)
558 PWL_IMPLEMENT_KEY_METHOD(OnChar) 558 PWL_IMPLEMENT_KEY_METHOD(OnChar)
559 559
560 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk) 560 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk)
561 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown) 561 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown)
562 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp) 562 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp)
563 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk) 563 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk)
564 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown) 564 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown)
565 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp) 565 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp)
566 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) 566 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown)
567 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) 567 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp)
568 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) 568 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove)
569 569
570 FX_BOOL»CPWL_Wnd::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag) 570 FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag)
571 { 571 {
572 » if (IsValid() && IsVisible() && IsEnabled()) 572 if (IsValid() && IsVisible() && IsEnabled())
573 » { 573 {
574 » » SetCursor(); 574 SetCursor();
575 » » if (IsWndCaptureKeyboard(this)) 575 if (IsWndCaptureKeyboard(this))
576 » » { 576 {
577 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 577 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
578 » » » { 578 {
579 » » » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) 579 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
580 » » » » { 580 {
581 » » » » » if (IsWndCaptureKeyboard(pChild)) 581 if (IsWndCaptureKeyboard(pChild))
582 » » » » » { 582 {
583 » » » » » » return pChild->OnMouseWheel(zDel ta,pChild->ParentToChild(point), nFlag); 583 return pChild->OnMouseWheel(zDelta,pChild->ParentToChild (point), nFlag);
584 » » » » » } 584 }
585 » » » » } 585 }
586 » » » } 586 }
587 » » } 587 }
588 » } 588 }
589 » return FALSE; 589 return FALSE;
590 } 590 }
591 591
592 void CPWL_Wnd::AddChild(CPWL_Wnd * pWnd) 592 void CPWL_Wnd::AddChild(CPWL_Wnd * pWnd)
593 { 593 {
594 » m_aChildren.Add(pWnd); 594 m_aChildren.Add(pWnd);
595 } 595 }
596 596
597 void CPWL_Wnd::RemoveChild(CPWL_Wnd * pWnd) 597 void CPWL_Wnd::RemoveChild(CPWL_Wnd * pWnd)
598 { 598 {
599 » for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --) 599 for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --)
600 » { 600 {
601 » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 601 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
602 » » { 602 {
603 » » » if (pChild == pWnd) 603 if (pChild == pWnd)
604 » » » { 604 {
605 » » » » m_aChildren.RemoveAt(i); 605 m_aChildren.RemoveAt(i);
606 » » » » break; 606 break;
607 » » » } 607 }
608 » » } 608 }
609 » } 609 }
610 } 610 }
611 611
612 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) 612 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam)
613 { 613 {
614 » switch (msg) 614 switch (msg)
615 » { 615 {
616 » case PNM_ADDCHILD: 616 case PNM_ADDCHILD:
617 » » AddChild(pWnd); 617 AddChild(pWnd);
618 » » break; 618 break;
619 » case PNM_REMOVECHILD: 619 case PNM_REMOVECHILD:
620 » » RemoveChild(pWnd); 620 RemoveChild(pWnd);
621 » » break; 621 break;
622 » default: 622 default:
623 » » break; 623 break;
624 » } 624 }
625 } 625 }
626 626
627 FX_BOOL CPWL_Wnd::IsValid() const 627 FX_BOOL CPWL_Wnd::IsValid() const
628 { 628 {
629 » return m_bCreated; 629 return m_bCreated;
630 } 630 }
631 631
632 PWL_CREATEPARAM CPWL_Wnd::GetCreationParam() const 632 PWL_CREATEPARAM CPWL_Wnd::GetCreationParam() const
633 { 633 {
634 » return m_sPrivateParam; 634 return m_sPrivateParam;
635 } 635 }
636 636
637 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const 637 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const
638 { 638 {
639 » return m_sPrivateParam.pParentWnd; 639 return m_sPrivateParam.pParentWnd;
640 } 640 }
641 641
642 CPDF_Rect CPWL_Wnd::GetOriginWindowRect() const 642 CPDF_Rect CPWL_Wnd::GetOriginWindowRect() const
643 { 643 {
644 » return m_sPrivateParam.rcRectWnd; 644 return m_sPrivateParam.rcRectWnd;
645 } 645 }
646 646
647 CPDF_Rect CPWL_Wnd::GetWindowRect() const 647 CPDF_Rect CPWL_Wnd::GetWindowRect() const
648 { 648 {
649 » return m_rcWindow; 649 return m_rcWindow;
650 } 650 }
651 651
652 CPDF_Rect CPWL_Wnd::GetClientRect() const 652 CPDF_Rect CPWL_Wnd::GetClientRect() const
653 { 653 {
654 » CPDF_Rect rcWindow = GetWindowRect(); 654 CPDF_Rect rcWindow = GetWindowRect();
655 » CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,(FX_FLOAT)(GetBord erWidth()+GetInnerBorderWidth())); 655 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,(FX_FLOAT)(GetBorderWi dth()+GetInnerBorderWidth()));
656 656 if (CPWL_ScrollBar* pVSB = GetVScrollBar())
657 » if (CPWL_ScrollBar * pVSB = GetVScrollBar()) 657 rcClient.right -= pVSB->GetScrollBarWidth();
658 » » rcClient.right -= pVSB->GetScrollBarWidth(); 658
659 659 rcClient.Normalize();
660 » rcClient.Normalize(); 660 return rcWindow.Contains(rcClient) ? rcClient : CPDF_Rect();
661
662 » if (rcWindow.Contains(rcClient))
663 » » return rcClient;
664 » else
665 » » return CPDF_Rect();
666 } 661 }
667 662
668 CPDF_Point CPWL_Wnd::GetCenterPoint() const 663 CPDF_Point CPWL_Wnd::GetCenterPoint() const
669 { 664 {
670 » CPDF_Rect rcClient = GetClientRect(); 665 CPDF_Rect rcClient = GetClientRect();
671 666 return CPDF_Point((rcClient.left + rcClient.right) * 0.5f,
672 » return CPDF_Point((rcClient.left + rcClient.right) * 0.5f, 667 (rcClient.top + rcClient.bottom) * 0.5f);
673 » » (rcClient.top + rcClient.bottom) * 0.5f);
674 } 668 }
675 669
676 CPDF_Rect CPWL_Wnd::GetClientCenterSquare() const 670 CPDF_Rect CPWL_Wnd::GetClientCenterSquare() const
677 { 671 {
678 » return CPWL_Utils::GetCenterSquare(GetClientRect()); 672 return CPWL_Utils::GetCenterSquare(GetClientRect());
679 } 673 }
680 674
681 CPDF_Rect CPWL_Wnd::GetWindowCenterSquare() const 675 CPDF_Rect CPWL_Wnd::GetWindowCenterSquare() const
682 { 676 {
683 » return CPWL_Utils::GetCenterSquare(CPWL_Utils::DeflateRect(GetWindowRect (),0.1f)); 677 return CPWL_Utils::GetCenterSquare(CPWL_Utils::DeflateRect(GetWindowRect(),0 .1f));
684 } 678 }
685 679
686 FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const 680 FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const
687 { 681 {
688 » return (m_sPrivateParam.dwFlags & dwFlags) != 0; 682 return (m_sPrivateParam.dwFlags & dwFlags) != 0;
689 } 683 }
690 684
691 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags) 685 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags)
692 { 686 {
693 » m_sPrivateParam.dwFlags &= ~dwFlags; 687 m_sPrivateParam.dwFlags &= ~dwFlags;
694 } 688 }
695 689
696 void CPWL_Wnd::AddFlag(FX_DWORD dwFlags) 690 void CPWL_Wnd::AddFlag(FX_DWORD dwFlags)
697 { 691 {
698 » m_sPrivateParam.dwFlags |= dwFlags; 692 m_sPrivateParam.dwFlags |= dwFlags;
699 } 693 }
700 694
701 CPWL_Color CPWL_Wnd::GetBackgroundColor() const 695 CPWL_Color CPWL_Wnd::GetBackgroundColor() const
702 { 696 {
703 » return m_sPrivateParam.sBackgroundColor; 697 return m_sPrivateParam.sBackgroundColor;
704 } 698 }
705 699
706 void CPWL_Wnd::SetBackgroundColor(const CPWL_Color & color) 700 void CPWL_Wnd::SetBackgroundColor(const CPWL_Color & color)
707 { 701 {
708 » m_sPrivateParam.sBackgroundColor = color; 702 m_sPrivateParam.sBackgroundColor = color;
709 } 703 }
710 704
711 void CPWL_Wnd::SetTextColor(const CPWL_Color & color) 705 void CPWL_Wnd::SetTextColor(const CPWL_Color & color)
712 { 706 {
713 » m_sPrivateParam.sTextColor = color; 707 m_sPrivateParam.sTextColor = color;
714 } 708 }
715 709
716 void CPWL_Wnd::SetTextStrokeColor(const CPWL_Color & color) 710 void CPWL_Wnd::SetTextStrokeColor(const CPWL_Color & color)
717 { 711 {
718 » m_sPrivateParam.sTextStrokeColor = color; 712 m_sPrivateParam.sTextStrokeColor = color;
719 } 713 }
720 714
721 CPWL_Color CPWL_Wnd::GetTextColor() const 715 CPWL_Color CPWL_Wnd::GetTextColor() const
722 { 716 {
723 » return m_sPrivateParam.sTextColor; 717 return m_sPrivateParam.sTextColor;
724 } 718 }
725 719
726 CPWL_Color CPWL_Wnd::GetTextStrokeColor() const 720 CPWL_Color CPWL_Wnd::GetTextStrokeColor() const
727 { 721 {
728 » return m_sPrivateParam.sTextStrokeColor; 722 return m_sPrivateParam.sTextStrokeColor;
729 } 723 }
730 724
731 int32_t CPWL_Wnd::GetBorderStyle() const 725 int32_t CPWL_Wnd::GetBorderStyle() const
732 { 726 {
733 » return m_sPrivateParam.nBorderStyle; 727 return m_sPrivateParam.nBorderStyle;
734 } 728 }
735 729
736 void CPWL_Wnd::SetBorderStyle(int32_t nBorderStyle) 730 void CPWL_Wnd::SetBorderStyle(int32_t nBorderStyle)
737 { 731 {
738 » if (HasFlag(PWS_BORDER)) 732 if (HasFlag(PWS_BORDER))
739 » » m_sPrivateParam.nBorderStyle = nBorderStyle; 733 m_sPrivateParam.nBorderStyle = nBorderStyle;
740 } 734 }
741 735
742 int32_t CPWL_Wnd::GetBorderWidth() const 736 int32_t CPWL_Wnd::GetBorderWidth() const
743 { 737 {
744 » if (HasFlag(PWS_BORDER)) 738 if (HasFlag(PWS_BORDER))
745 » » return m_sPrivateParam.dwBorderWidth; 739 return m_sPrivateParam.dwBorderWidth;
746 740
747 » return 0; 741 return 0;
748 } 742 }
749 743
750 int32_t CPWL_Wnd::GetInnerBorderWidth() const 744 int32_t CPWL_Wnd::GetInnerBorderWidth() const
751 { 745 {
752 » /* 746 /*
753 » switch (GetBorderStyle()) 747 switch (GetBorderStyle())
754 » { 748 {
755 » case PBS_BEVELED: 749 case PBS_BEVELED:
756 » case PBS_INSET: 750 case PBS_INSET:
757 » » return GetBorderWidth() / 2; 751 return GetBorderWidth() / 2;
758 » } 752 }
759 » */ 753 */
760 » return 0; 754 return 0;
761 } 755 }
762 756
763 void CPWL_Wnd::SetBorderWidth(int32_t nBorderWidth) 757 void CPWL_Wnd::SetBorderWidth(int32_t nBorderWidth)
764 { 758 {
765 » if (HasFlag(PWS_BORDER)) 759 if (HasFlag(PWS_BORDER))
766 » » m_sPrivateParam.dwBorderWidth = nBorderWidth; 760 m_sPrivateParam.dwBorderWidth = nBorderWidth;
767 } 761 }
768 762
769 CPWL_Color CPWL_Wnd::GetBorderColor() const 763 CPWL_Color CPWL_Wnd::GetBorderColor() const
770 { 764 {
771 » if (HasFlag(PWS_BORDER)) 765 if (HasFlag(PWS_BORDER))
772 » » return m_sPrivateParam.sBorderColor; 766 return m_sPrivateParam.sBorderColor;
773 767
774 » return CPWL_Color(); 768 return CPWL_Color();
775 } 769 }
776 770
777 void CPWL_Wnd::SetBorderColor(const CPWL_Color & color) 771 void CPWL_Wnd::SetBorderColor(const CPWL_Color & color)
778 { 772 {
779 » if (HasFlag(PWS_BORDER)) 773 if (HasFlag(PWS_BORDER))
780 » » m_sPrivateParam.sBorderColor = color; 774 m_sPrivateParam.sBorderColor = color;
781 } 775 }
782 776
783 CPWL_Dash CPWL_Wnd::GetBorderDash() const 777 CPWL_Dash CPWL_Wnd::GetBorderDash() const
784 { 778 {
785 » return m_sPrivateParam.sDash; 779 return m_sPrivateParam.sDash;
786 } 780 }
787 781
788 void* CPWL_Wnd::GetAttachedData() const 782 void* CPWL_Wnd::GetAttachedData() const
789 { 783 {
790 » return m_sPrivateParam.pAttachedData; 784 return m_sPrivateParam.pAttachedData;
791 } 785 }
792 786
793 void CPWL_Wnd::SetBorderDash(const CPWL_Dash & sDash) 787 void CPWL_Wnd::SetBorderDash(const CPWL_Dash & sDash)
794 { 788 {
795 » if (HasFlag(PWS_BORDER)) 789 if (HasFlag(PWS_BORDER))
796 » » m_sPrivateParam.sDash = sDash; 790 m_sPrivateParam.sDash = sDash;
797 } 791 }
798 792
799 CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const 793 CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const
800 { 794 {
801 » if (HasFlag(PWS_VSCROLL)) 795 if (HasFlag(PWS_VSCROLL))
802 » » return m_pVScrollBar; 796 return m_pVScrollBar;
803 797
804 » return NULL; 798 return NULL;
805 } 799 }
806 800
807 void CPWL_Wnd::CreateScrollBar(const PWL_CREATEPARAM & cp) 801 void CPWL_Wnd::CreateScrollBar(const PWL_CREATEPARAM & cp)
808 { 802 {
809 » CreateVScrollBar(cp); 803 CreateVScrollBar(cp);
810 } 804 }
811 805
812 void CPWL_Wnd::CreateVScrollBar(const PWL_CREATEPARAM & cp) 806 void CPWL_Wnd::CreateVScrollBar(const PWL_CREATEPARAM & cp)
813 { 807 {
814 » if (!m_pVScrollBar && HasFlag(PWS_VSCROLL)) 808 if (!m_pVScrollBar && HasFlag(PWS_VSCROLL))
815 » { 809 {
816 » » PWL_CREATEPARAM scp = cp; 810 PWL_CREATEPARAM scp = cp;
817 811
818 » » //flags 812 //flags
819 » » scp.dwFlags = PWS_CHILD| PWS_BACKGROUND | PWS_AUTOTRANSPARENT | PWS_NOREFRESHCLIP; 813 scp.dwFlags = PWS_CHILD| PWS_BACKGROUND | PWS_AUTOTRANSPARENT | PWS_NORE FRESHCLIP;
820 814
821 » » scp.pParentWnd = this; 815 scp.pParentWnd = this;
822 » » scp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; 816 scp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR;
823 » » scp.eCursorType = FXCT_ARROW; 817 scp.eCursorType = FXCT_ARROW;
824 » » scp.nTransparency = PWL_SCROLLBAR_TRANSPARANCY; 818 scp.nTransparency = PWL_SCROLLBAR_TRANSPARANCY;
825 819
826 » » if ((m_pVScrollBar = new CPWL_ScrollBar(SBT_VSCROLL))) 820 if ((m_pVScrollBar = new CPWL_ScrollBar(SBT_VSCROLL)))
827 » » » m_pVScrollBar->Create(scp); 821 m_pVScrollBar->Create(scp);
828 » } 822 }
829 } 823 }
830 824
831 void CPWL_Wnd::SetCapture() 825 void CPWL_Wnd::SetCapture()
832 { 826 {
833 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 827 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
834 » » pMsgCtrl->SetCapture(this); 828 pMsgCtrl->SetCapture(this);
835 } 829 }
836 830
837 void CPWL_Wnd::ReleaseCapture() 831 void CPWL_Wnd::ReleaseCapture()
838 { 832 {
839 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 833 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
840 » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 834 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
841 » » » pChild->ReleaseCapture(); 835 pChild->ReleaseCapture();
842 836
843 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 837 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
844 » » pMsgCtrl->ReleaseCapture(); 838 pMsgCtrl->ReleaseCapture();
845 } 839 }
846 840
847 void CPWL_Wnd::SetFocus() 841 void CPWL_Wnd::SetFocus()
848 { 842 {
849 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 843 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
850 » { 844 {
851 » » if (!pMsgCtrl->IsMainCaptureKeyboard(this)) 845 if (!pMsgCtrl->IsMainCaptureKeyboard(this))
852 » » » pMsgCtrl->KillFocus(); 846 pMsgCtrl->KillFocus();
853 » » pMsgCtrl->SetFocus(this); 847 pMsgCtrl->SetFocus(this);
854 » } 848 }
855 } 849 }
856 850
857 void CPWL_Wnd::KillFocus() 851 void CPWL_Wnd::KillFocus()
858 { 852 {
859 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 853 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
860 » { 854 {
861 » » if (pMsgCtrl->IsWndCaptureKeyboard(this)) 855 if (pMsgCtrl->IsWndCaptureKeyboard(this))
862 » » » pMsgCtrl->KillFocus(); 856 pMsgCtrl->KillFocus();
863 » } 857 }
864 } 858 }
865 859
866 void CPWL_Wnd::OnSetFocus() 860 void CPWL_Wnd::OnSetFocus()
867 { 861 {
868 } 862 }
869 863
870 void CPWL_Wnd::OnKillFocus() 864 void CPWL_Wnd::OnKillFocus()
871 { 865 {
872 } 866 }
873 867
874 FX_BOOL»CPWL_Wnd::WndHitTest(const CPDF_Point & point) const 868 FX_BOOL CPWL_Wnd::WndHitTest(const CPDF_Point & point) const
875 { 869 {
876 » return IsValid() && IsVisible() && GetWindowRect().Contains(point.x,poin t.y); 870 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x,point.y) ;
877 } 871 }
878 872
879 FX_BOOL CPWL_Wnd::ClientHitTest(const CPDF_Point & point) const 873 FX_BOOL CPWL_Wnd::ClientHitTest(const CPDF_Point & point) const
880 { 874 {
881 » return IsValid() && IsVisible() && GetClientRect().Contains(point.x,poin t.y); 875 return IsValid() && IsVisible() && GetClientRect().Contains(point.x,point.y) ;
882 } 876 }
883 877
884 const CPWL_Wnd * CPWL_Wnd::GetRootWnd() const 878 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const
885 { 879 {
886 » if (m_sPrivateParam.pParentWnd) 880 if (m_sPrivateParam.pParentWnd)
887 » » return m_sPrivateParam.pParentWnd->GetRootWnd(); 881 return m_sPrivateParam.pParentWnd->GetRootWnd();
888 » else 882
889 » » return this; 883 return this;
890 } 884 }
891 885
892 void CPWL_Wnd::SetVisible(FX_BOOL bVisible) 886 void CPWL_Wnd::SetVisible(FX_BOOL bVisible)
893 { 887 {
894 » if (IsValid()) 888 if (IsValid())
895 » { 889 {
896 » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 890 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
897 » » { 891 {
898 » » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 892 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
899 » » » { 893 {
900 » » » » pChild->SetVisible(bVisible); 894 pChild->SetVisible(bVisible);
901 » » » } 895 }
902 » » } 896 }
903 897
904 » » if (bVisible != m_bVisible) 898 if (bVisible != m_bVisible)
905 » » { 899 {
906 » » » m_bVisible = bVisible; 900 m_bVisible = bVisible;
907 » » » RePosChildWnd(); 901 RePosChildWnd();
908 » » » InvalidateRect(); 902 InvalidateRect();
909 » » } 903 }
910 » } 904 }
911 } 905 }
912 906
913 void CPWL_Wnd::SetClipRect(const CPDF_Rect & rect) 907 void CPWL_Wnd::SetClipRect(const CPDF_Rect & rect)
914 { 908 {
915 » m_rcClip = rect; 909 m_rcClip = rect;
916 » m_rcClip.Normalize(); 910 m_rcClip.Normalize();
917 } 911 }
918 912
919 CPDF_Rect CPWL_Wnd::GetClipRect() const 913 CPDF_Rect CPWL_Wnd::GetClipRect() const
920 { 914 {
921 » return m_rcClip; 915 return m_rcClip;
922 } 916 }
923 917
924 FX_BOOL»CPWL_Wnd::IsReadOnly() const 918 FX_BOOL CPWL_Wnd::IsReadOnly() const
925 { 919 {
926 » return HasFlag(PWS_READONLY); 920 return HasFlag(PWS_READONLY);
927 } 921 }
928 922
929 void CPWL_Wnd::RePosChildWnd() 923 void CPWL_Wnd::RePosChildWnd()
930 { 924 {
931 » CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT) (GetBorderWidth()+GetInnerBorderWidth())); 925 CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(Get BorderWidth()+GetInnerBorderWidth()));
932 926
933 » CPWL_ScrollBar * pVSB = GetVScrollBar(); 927 CPWL_ScrollBar * pVSB = GetVScrollBar();
934 928
935 » CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH, 929 CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH,
936 » » » » » » » rcContent.bottom, 930 rcContent.bottom,
937 » » » » » » » rcContent.right-1.0f, 931 rcContent.right-1.0f,
938 » » » » » » » rcContent.top); 932 rcContent.top);
939 933
940 » if (pVSB) pVSB->Move(rcVScroll,TRUE,FALSE); 934 if (pVSB) pVSB->Move(rcVScroll,TRUE,FALSE);
941 } 935 }
942 936
943 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp) 937 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp)
944 { 938 {
945 } 939 }
946 940
947 void CPWL_Wnd::SetCursor() 941 void CPWL_Wnd::SetCursor()
948 { 942 {
949 » if (IsValid()) 943 if (IsValid())
950 » { 944 {
951 » » if (IFX_SystemHandler* pSH = GetSystemHandler()) 945 if (IFX_SystemHandler* pSH = GetSystemHandler())
952 » » { 946 {
953 » » » int32_t nCursorType = GetCreationParam().eCursorType; 947 int32_t nCursorType = GetCreationParam().eCursorType;
954 » » » pSH->SetCursor(nCursorType); 948 pSH->SetCursor(nCursorType);
955 » » } 949 }
956 » } 950 }
957 } 951 }
958 952
959 void CPWL_Wnd::CreateMsgControl() 953 void CPWL_Wnd::CreateMsgControl()
960 { 954 {
961 » if (!m_sPrivateParam.pMsgControl) 955 if (!m_sPrivateParam.pMsgControl)
962 » » m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this); 956 m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this);
963 } 957 }
964 958
965 void CPWL_Wnd::DestroyMsgControl() 959 void CPWL_Wnd::DestroyMsgControl()
966 { 960 {
967 » if (CPWL_MsgControl* pMsgControl = GetMsgControl()) 961 if (CPWL_MsgControl* pMsgControl = GetMsgControl())
968 » » if (pMsgControl->IsWndCreated(this)) 962 if (pMsgControl->IsWndCreated(this))
969 » » » delete pMsgControl; 963 delete pMsgControl;
970 } 964 }
971 965
972 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const 966 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const
973 { 967 {
974 » return m_sPrivateParam.pMsgControl; 968 return m_sPrivateParam.pMsgControl;
975 } 969 }
976 970
977 FX_BOOL CPWL_Wnd::IsCaptureMouse() const 971 FX_BOOL CPWL_Wnd::IsCaptureMouse() const
978 { 972 {
979 » return IsWndCaptureMouse(this); 973 return IsWndCaptureMouse(this);
980 } 974 }
981 975
982 FX_BOOL CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd * pWnd) const 976 FX_BOOL CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd * pWnd) const
983 { 977 {
984 » if (CPWL_MsgControl * pCtrl = GetMsgControl()) 978 if (CPWL_MsgControl * pCtrl = GetMsgControl())
985 » » return pCtrl->IsWndCaptureMouse(pWnd); 979 return pCtrl->IsWndCaptureMouse(pWnd);
986 980
987 » return FALSE; 981 return FALSE;
988 } 982 }
989 983
990 FX_BOOL CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const 984 FX_BOOL CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const
991 { 985 {
992 » if (CPWL_MsgControl * pCtrl = GetMsgControl()) 986 if (CPWL_MsgControl * pCtrl = GetMsgControl())
993 » » return pCtrl->IsWndCaptureKeyboard(pWnd); 987 return pCtrl->IsWndCaptureKeyboard(pWnd);
994 988
995 » return FALSE; 989 return FALSE;
996 } 990 }
997 991
998 FX_BOOL CPWL_Wnd::IsFocused() const 992 FX_BOOL CPWL_Wnd::IsFocused() const
999 { 993 {
1000 » if (CPWL_MsgControl * pCtrl = GetMsgControl()) 994 if (CPWL_MsgControl * pCtrl = GetMsgControl())
1001 » » return pCtrl->IsMainCaptureKeyboard(this); 995 return pCtrl->IsMainCaptureKeyboard(this);
1002 996
1003 » return FALSE; 997 return FALSE;
1004 } 998 }
1005 999
1006 CPDF_Rect CPWL_Wnd::GetFocusRect() const 1000 CPDF_Rect CPWL_Wnd::GetFocusRect() const
1007 { 1001 {
1008 » return CPWL_Utils::InflateRect(GetWindowRect(),1); 1002 return CPWL_Utils::InflateRect(GetWindowRect(),1);
1009 } 1003 }
1010 1004
1011 FX_FLOAT CPWL_Wnd::GetFontSize() const 1005 FX_FLOAT CPWL_Wnd::GetFontSize() const
1012 { 1006 {
1013 » return m_sPrivateParam.fFontSize; 1007 return m_sPrivateParam.fFontSize;
1014 } 1008 }
1015 1009
1016 void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) 1010 void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize)
1017 { 1011 {
1018 » m_sPrivateParam.fFontSize = fFontSize; 1012 m_sPrivateParam.fFontSize = fFontSize;
1019 } 1013 }
1020 1014
1021 IFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const 1015 IFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const
1022 { 1016 {
1023 » return m_sPrivateParam.pSystemHandler; 1017 return m_sPrivateParam.pSystemHandler;
1024 } 1018 }
1025 1019
1026 IPWL_FocusHandler* CPWL_Wnd::GetFocusHandler() const 1020 IPWL_FocusHandler* CPWL_Wnd::GetFocusHandler() const
1027 { 1021 {
1028 » return m_sPrivateParam.pFocusHandler; 1022 return m_sPrivateParam.pFocusHandler;
1029 } 1023 }
1030 1024
1031 IPWL_Provider* CPWL_Wnd::GetProvider() const 1025 IPWL_Provider* CPWL_Wnd::GetProvider() const
1032 { 1026 {
1033 » return m_sPrivateParam.pProvider; 1027 return m_sPrivateParam.pProvider;
1034 } 1028 }
1035 1029
1036 IFX_Edit_FontMap* CPWL_Wnd::GetFontMap() const 1030 IFX_Edit_FontMap* CPWL_Wnd::GetFontMap() const
1037 { 1031 {
1038 » return m_sPrivateParam.pFontMap; 1032 return m_sPrivateParam.pFontMap;
1039 } 1033 }
1040 1034
1041 CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(int32_t nBorderStyle) const 1035 CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(int32_t nBorderStyle) const
1042 { 1036 {
1043 » CPWL_Color color; 1037 CPWL_Color color;
1044 1038
1045 » switch (nBorderStyle) 1039 switch (nBorderStyle)
1046 » { 1040 {
1047 » » case PBS_SOLID: 1041 case PBS_SOLID:
1048 » » » break; 1042 break;
1049 » » case PBS_DASH: 1043 case PBS_DASH:
1050 » » » break; 1044 break;
1051 » » case PBS_BEVELED: 1045 case PBS_BEVELED:
1052 » » » color = CPWL_Color(COLORTYPE_GRAY,1); 1046 color = CPWL_Color(COLORTYPE_GRAY,1);
1053 » » » break; 1047 break;
1054 » » case PBS_INSET: 1048 case PBS_INSET:
1055 » » » color = CPWL_Color(COLORTYPE_GRAY,0.5f); 1049 color = CPWL_Color(COLORTYPE_GRAY,0.5f);
1056 » » » break; 1050 break;
1057 » » case PBS_UNDERLINED: 1051 case PBS_UNDERLINED:
1058 » » » break; 1052 break;
1059 » } 1053 }
1060 1054
1061 » return color; 1055 return color;
1062 } 1056 }
1063 1057
1064 CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const 1058 CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const
1065 { 1059 {
1066 » CPWL_Color color; 1060 CPWL_Color color;
1067 1061
1068 » switch (nBorderStyle) 1062 switch (nBorderStyle)
1069 » { 1063 {
1070 » » case PBS_SOLID: 1064 case PBS_SOLID:
1071 » » » break; 1065 break;
1072 » » case PBS_DASH: 1066 case PBS_DASH:
1073 » » » break; 1067 break;
1074 » » case PBS_BEVELED: 1068 case PBS_BEVELED:
1075 » » » color = CPWL_Utils::DevideColor(GetBackgroundColor(),2); 1069 color = CPWL_Utils::DevideColor(GetBackgroundColor(),2);
1076 » » » break; 1070 break;
1077 » » case PBS_INSET: 1071 case PBS_INSET:
1078 » » » color = CPWL_Color(COLORTYPE_GRAY,0.75f); 1072 color = CPWL_Color(COLORTYPE_GRAY,0.75f);
1079 » » » break; 1073 break;
1080 » » case PBS_UNDERLINED: 1074 case PBS_UNDERLINED:
1081 » » » break; 1075 break;
1082 » } 1076 }
1083 1077
1084 » return color; 1078 return color;
1085 } 1079 }
1086 1080
1087 /* ----------------------------------------------------------------- */ 1081 /* ----------------------------------------------------------------- */
1088 1082
1089 int32_t CPWL_Wnd::GetTransparency() 1083 int32_t CPWL_Wnd::GetTransparency()
1090 { 1084 {
1091 » return m_sPrivateParam.nTransparency; 1085 return m_sPrivateParam.nTransparency;
1092 } 1086 }
1093 1087
1094 void CPWL_Wnd::SetTransparency(int32_t nTransparency) 1088 void CPWL_Wnd::SetTransparency(int32_t nTransparency)
1095 { 1089 {
1096 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 1090 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
1097 » { 1091 {
1098 » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 1092 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
1099 » » { 1093 {
1100 » » » pChild->SetTransparency(nTransparency); 1094 pChild->SetTransparency(nTransparency);
1101 » » } 1095 }
1102 » } 1096 }
1103 1097
1104 » m_sPrivateParam.nTransparency = nTransparency; 1098 m_sPrivateParam.nTransparency = nTransparency;
1105 } 1099 }
1106 1100
1107 CPDF_Matrix» CPWL_Wnd::GetWindowMatrix() const 1101 CPDF_Matrix CPWL_Wnd::GetWindowMatrix() const
1108 { 1102 {
1109 » CPDF_Matrix mt = GetChildToRoot(); 1103 CPDF_Matrix mt = GetChildToRoot();
1110 1104
1111 » if (IPWL_Provider* pProvider = GetProvider()) 1105 if (IPWL_Provider* pProvider = GetProvider())
1112 » { 1106 {
1113 » » mt.Concat(pProvider->GetWindowMatrix(GetAttachedData())); 1107 mt.Concat(pProvider->GetWindowMatrix(GetAttachedData()));
1114 » » return mt; 1108 return mt;
1115 » } 1109 }
1116 1110
1117 » return mt; 1111 return mt;
1118 } 1112 }
1119 1113
1120 void CPWL_Wnd::PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const 1114 void CPWL_Wnd::PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const
1121 { 1115 {
1122 » CPDF_Matrix mt = GetWindowMatrix(); 1116 CPDF_Matrix mt = GetWindowMatrix();
1123 » CPDF_Point pt = point; 1117 CPDF_Point pt = point;
1124 » mt.Transform(pt.x,pt.y); 1118 mt.Transform(pt.x,pt.y);
1125 » x = (int32_t)(pt.x+0.5); 1119 x = (int32_t)(pt.x+0.5);
1126 » y = (int32_t)(pt.y+0.5); 1120 y = (int32_t)(pt.y+0.5);
1127 } 1121 }
1128 1122
1129 FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect & rect) const 1123 FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect & rect) const
1130 { 1124 {
1131 » CPDF_Rect rcTemp = rect; 1125 CPDF_Rect rcTemp = rect;
1132 » CPDF_Matrix mt = GetWindowMatrix(); 1126 CPDF_Matrix mt = GetWindowMatrix();
1133 » mt.TransformRect(rcTemp); 1127 mt.TransformRect(rcTemp);
1134 » return FX_RECT((int32_t)(rcTemp.left+0.5), (int32_t)(rcTemp.bottom+0.5), (int32_t)(rcTemp.right+0.5), (int32_t)(rcTemp.top+0.5)); 1128 return FX_RECT((int32_t)(rcTemp.left+0.5), (int32_t)(rcTemp.bottom+0.5), (in t32_t)(rcTemp.right+0.5), (int32_t)(rcTemp.top+0.5));
1135 } 1129 }
1136 1130
1137 FX_HWND CPWL_Wnd::GetAttachedHWnd() const 1131 FX_HWND CPWL_Wnd::GetAttachedHWnd() const
1138 { 1132 {
1139 » return m_sPrivateParam.hAttachedWnd; 1133 return m_sPrivateParam.hAttachedWnd;
1140 } 1134 }
1141 1135
1142 CPDF_Point CPWL_Wnd::ChildToParent(const CPDF_Point& point) const 1136 CPDF_Point CPWL_Wnd::ChildToParent(const CPDF_Point& point) const
1143 { 1137 {
1144 » CPDF_Matrix mt = GetChildMatrix(); 1138 CPDF_Matrix mt = GetChildMatrix();
1145 » if (mt.IsIdentity()) 1139 if (mt.IsIdentity())
1146 » » return point; 1140 return point;
1147 » else 1141
1148 » { 1142 CPDF_Point pt = point;
1149 » » CPDF_Point pt = point; 1143 mt.Transform(pt.x,pt.y);
1150 » » mt.Transform(pt.x,pt.y); 1144 return pt;
1151 » » return pt;
1152 » }
1153 } 1145 }
1154 1146
1155 CPDF_Rect CPWL_Wnd::ChildToParent(const CPDF_Rect& rect) const 1147 CPDF_Rect CPWL_Wnd::ChildToParent(const CPDF_Rect& rect) const
1156 { 1148 {
1157 » CPDF_Matrix mt = GetChildMatrix(); 1149 CPDF_Matrix mt = GetChildMatrix();
1158 » if (mt.IsIdentity()) 1150 if (mt.IsIdentity())
1159 » » return rect; 1151 return rect;
1160 » else 1152
1161 » { 1153 CPDF_Rect rc = rect;
1162 » » CPDF_Rect rc = rect; 1154 mt.TransformRect(rc);
1163 » » mt.TransformRect(rc); 1155 return rc;
1164 » » return rc;
1165 » }
1166 } 1156 }
1167 1157
1168 CPDF_Point CPWL_Wnd::ParentToChild(const CPDF_Point& point) const 1158 CPDF_Point CPWL_Wnd::ParentToChild(const CPDF_Point& point) const
1169 { 1159 {
1170 » CPDF_Matrix mt = GetChildMatrix(); 1160 CPDF_Matrix mt = GetChildMatrix();
1171 » if (mt.IsIdentity()) 1161 if (mt.IsIdentity())
1172 » » return point; 1162 return point;
1173 » else 1163
1174 » { 1164 mt.SetReverse(mt);
1175 » » mt.SetReverse(mt); 1165 CPDF_Point pt = point;
1176 » » CPDF_Point pt = point; 1166 mt.Transform(pt.x,pt.y);
1177 » » mt.Transform(pt.x,pt.y); 1167 return pt;
1178 » » return pt;
1179 » }
1180 } 1168 }
1181 1169
1182 CPDF_Rect CPWL_Wnd::ParentToChild(const CPDF_Rect& rect) const 1170 CPDF_Rect CPWL_Wnd::ParentToChild(const CPDF_Rect& rect) const
1183 { 1171 {
1184 » CPDF_Matrix mt = GetChildMatrix(); 1172 CPDF_Matrix mt = GetChildMatrix();
1185 » if (mt.IsIdentity()) 1173 if (mt.IsIdentity())
1186 » » return rect; 1174 return rect;
1187 » else 1175
1188 » { 1176 mt.SetReverse(mt);
1189 » » mt.SetReverse(mt); 1177 CPDF_Rect rc = rect;
1190 » » CPDF_Rect rc = rect; 1178 mt.TransformRect(rc);
1191 » » mt.TransformRect(rc); 1179 return rc;
1192 » » return rc;
1193 » }
1194 } 1180 }
1195 1181
1196 CPDF_Matrix CPWL_Wnd::GetChildToRoot() const 1182 CPDF_Matrix CPWL_Wnd::GetChildToRoot() const
1197 { 1183 {
1198 » CPDF_Matrix mt(1,0,0,1,0,0); 1184 CPDF_Matrix mt(1, 0, 0, 1, 0, 0);
1199 1185 if (HasFlag(PWS_CHILD))
1200 » if (HasFlag(PWS_CHILD)) 1186 {
1201 » { 1187 const CPWL_Wnd* pParent = this;
1202 » » const CPWL_Wnd* pParent = this; 1188 while (pParent)
1203 » » while (pParent) 1189 {
1204 » » { 1190 mt.Concat(pParent->GetChildMatrix());
1205 » » » mt.Concat(pParent->GetChildMatrix()); 1191 pParent = pParent->GetParentWindow();
1206 » » » pParent = pParent->GetParentWindow(); 1192 }
1207 » » } 1193 }
1208 » } 1194 return mt;
1209
1210 » return mt;
1211 } 1195 }
1212 1196
1213 CPDF_Matrix CPWL_Wnd::GetChildMatrix() const 1197 CPDF_Matrix CPWL_Wnd::GetChildMatrix() const
1214 { 1198 {
1215 » if (HasFlag(PWS_CHILD)) 1199 if (HasFlag(PWS_CHILD))
1216 » » return m_sPrivateParam.mtChild; 1200 return m_sPrivateParam.mtChild;
1217 1201
1218 » return CPDF_Matrix(1,0,0,1,0,0); 1202 return CPDF_Matrix(1,0,0,1,0,0);
1219 } 1203 }
1220 1204
1221 void CPWL_Wnd::SetChildMatrix(const CPDF_Matrix& mt) 1205 void CPWL_Wnd::SetChildMatrix(const CPDF_Matrix& mt)
1222 { 1206 {
1223 » m_sPrivateParam.mtChild = mt; 1207 m_sPrivateParam.mtChild = mt;
1224 } 1208 }
1225 1209
1226 const CPWL_Wnd*»CPWL_Wnd::GetFocused() const 1210 const CPWL_Wnd* CPWL_Wnd::GetFocused() const
1227 { 1211 {
1228 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 1212 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
1229 » { 1213 {
1230 » » return pMsgCtrl->m_pMainKeyboardWnd; 1214 return pMsgCtrl->m_pMainKeyboardWnd;
1231 » } 1215 }
1232 1216
1233 » return NULL; 1217 return NULL;
1234 } 1218 }
1235 1219
1236 void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) 1220 void CPWL_Wnd::EnableWindow(FX_BOOL bEnable)
1237 { 1221 {
1238 » if (m_bEnabled != bEnable) 1222 if (m_bEnabled != bEnable)
1239 » { 1223 {
1240 » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 1224 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
1241 » » { 1225 {
1242 » » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 1226 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
1243 » » » { 1227 {
1244 » » » » pChild->EnableWindow(bEnable); 1228 pChild->EnableWindow(bEnable);
1245 » » » } 1229 }
1246 » » } 1230 }
1247 1231
1248 » » m_bEnabled = bEnable; 1232 m_bEnabled = bEnable;
1249 1233
1250 » » if (bEnable) 1234 if (bEnable)
1251 » » » OnEnabled(); 1235 OnEnabled();
1252 » » else 1236 else
1253 » » » OnDisabled(); 1237 OnDisabled();
1254 » } 1238 }
1255 } 1239 }
1256 1240
1257 FX_BOOL CPWL_Wnd::IsEnabled() 1241 FX_BOOL CPWL_Wnd::IsEnabled()
1258 { 1242 {
1259 » return m_bEnabled; 1243 return m_bEnabled;
1260 } 1244 }
1261 1245
1262 void CPWL_Wnd::OnEnabled() 1246 void CPWL_Wnd::OnEnabled()
1263 { 1247 {
1264 } 1248 }
1265 1249
1266 void CPWL_Wnd::OnDisabled() 1250 void CPWL_Wnd::OnDisabled()
1267 { 1251 {
1268 } 1252 }
1269 1253
1270 FX_BOOL CPWL_Wnd::IsCTRLpressed(FX_DWORD nFlag) const 1254 FX_BOOL CPWL_Wnd::IsCTRLpressed(FX_DWORD nFlag) const
1271 { 1255 {
1272 » if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1256 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1273 » { 1257 {
1274 » » return pSystemHandler->IsCTRLKeyDown(nFlag); 1258 return pSystemHandler->IsCTRLKeyDown(nFlag);
1275 » } 1259 }
1276 1260
1277 » return FALSE; 1261 return FALSE;
1278 } 1262 }
1279 1263
1280 FX_BOOL»CPWL_Wnd::IsSHIFTpressed(FX_DWORD nFlag) const 1264 FX_BOOL CPWL_Wnd::IsSHIFTpressed(FX_DWORD nFlag) const
1281 { 1265 {
1282 » if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1266 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1283 » { 1267 {
1284 » » return pSystemHandler->IsSHIFTKeyDown(nFlag); 1268 return pSystemHandler->IsSHIFTKeyDown(nFlag);
1285 » } 1269 }
1286 1270
1287 » return FALSE; 1271 return FALSE;
1288 } 1272 }
1289 1273
1290 FX_BOOL»CPWL_Wnd::IsALTpressed(FX_DWORD nFlag) const 1274 FX_BOOL CPWL_Wnd::IsALTpressed(FX_DWORD nFlag) const
1291 { 1275 {
1292 » if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1276 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1293 » { 1277 {
1294 » » return pSystemHandler->IsALTKeyDown(nFlag); 1278 return pSystemHandler->IsALTKeyDown(nFlag);
1295 » } 1279 }
1296 1280
1297 » return FALSE; 1281 return FALSE;
1298 } 1282 }
1299 1283
1300 FX_BOOL»CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const 1284 FX_BOOL CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const
1301 { 1285 {
1302 » if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1286 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1303 » { 1287 {
1304 » » return pSystemHandler->IsINSERTKeyDown(nFlag); 1288 return pSystemHandler->IsINSERTKeyDown(nFlag);
1305 » } 1289 }
1306 1290
1307 » return FALSE; 1291 return FALSE;
1308 } 1292 }
1309
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_FontMap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698