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

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

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month 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/pdfwindow/PWL_Wnd.h ('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 "fpdfsdk/pdfwindow/PWL_ScrollBar.h" 9 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
10 #include "fpdfsdk/pdfwindow/PWL_Utils.h" 10 #include "fpdfsdk/pdfwindow/PWL_Utils.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 ~CPWL_MsgControl() { Default(); } 111 ~CPWL_MsgControl() { Default(); }
112 112
113 void Default() { 113 void Default() {
114 m_aMousePath.RemoveAll(); 114 m_aMousePath.RemoveAll();
115 m_aKeyboardPath.RemoveAll(); 115 m_aKeyboardPath.RemoveAll();
116 m_pMainMouseWnd = nullptr; 116 m_pMainMouseWnd = nullptr;
117 m_pMainKeyboardWnd = nullptr; 117 m_pMainKeyboardWnd = nullptr;
118 } 118 }
119 119
120 FX_BOOL IsWndCreated(const CPWL_Wnd* pWnd) const { 120 bool IsWndCreated(const CPWL_Wnd* pWnd) const {
121 return m_pCreatedWnd == pWnd; 121 return m_pCreatedWnd == pWnd;
122 } 122 }
123 123
124 FX_BOOL IsMainCaptureMouse(const CPWL_Wnd* pWnd) const { 124 bool IsMainCaptureMouse(const CPWL_Wnd* pWnd) const {
125 return pWnd == m_pMainMouseWnd; 125 return pWnd == m_pMainMouseWnd;
126 } 126 }
127 127
128 FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { 128 bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const {
129 if (pWnd) { 129 if (pWnd) {
130 for (int32_t i = 0, sz = m_aMousePath.GetSize(); i < sz; i++) { 130 for (int32_t i = 0, sz = m_aMousePath.GetSize(); i < sz; i++) {
131 if (m_aMousePath.GetAt(i) == pWnd) 131 if (m_aMousePath.GetAt(i) == pWnd)
132 return TRUE; 132 return true;
133 } 133 }
134 } 134 }
135 135
136 return FALSE; 136 return false;
137 } 137 }
138 138
139 FX_BOOL IsMainCaptureKeyboard(const CPWL_Wnd* pWnd) const { 139 bool IsMainCaptureKeyboard(const CPWL_Wnd* pWnd) const {
140 return pWnd == m_pMainKeyboardWnd; 140 return pWnd == m_pMainKeyboardWnd;
141 } 141 }
142 142
143 FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { 143 bool IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const {
144 if (pWnd) { 144 if (pWnd) {
145 for (int32_t i = 0, sz = m_aKeyboardPath.GetSize(); i < sz; i++) { 145 for (int32_t i = 0, sz = m_aKeyboardPath.GetSize(); i < sz; i++) {
146 if (m_aKeyboardPath.GetAt(i) == pWnd) 146 if (m_aKeyboardPath.GetAt(i) == pWnd)
147 return TRUE; 147 return true;
148 } 148 }
149 } 149 }
150 150
151 return FALSE; 151 return false;
152 } 152 }
153 153
154 void SetFocus(CPWL_Wnd* pWnd) { 154 void SetFocus(CPWL_Wnd* pWnd) {
155 m_aKeyboardPath.RemoveAll(); 155 m_aKeyboardPath.RemoveAll();
156 156
157 if (pWnd) { 157 if (pWnd) {
158 m_pMainKeyboardWnd = pWnd; 158 m_pMainKeyboardWnd = pWnd;
159 159
160 CPWL_Wnd* pParent = pWnd; 160 CPWL_Wnd* pParent = pWnd;
161 while (pParent) { 161 while (pParent) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 CFX_ArrayTemplate<CPWL_Wnd*> m_aKeyboardPath; 200 CFX_ArrayTemplate<CPWL_Wnd*> m_aKeyboardPath;
201 CPWL_Wnd* m_pCreatedWnd; 201 CPWL_Wnd* m_pCreatedWnd;
202 CPWL_Wnd* m_pMainMouseWnd; 202 CPWL_Wnd* m_pMainMouseWnd;
203 CPWL_Wnd* m_pMainKeyboardWnd; 203 CPWL_Wnd* m_pMainKeyboardWnd;
204 }; 204 };
205 205
206 CPWL_Wnd::CPWL_Wnd() 206 CPWL_Wnd::CPWL_Wnd()
207 : m_pVScrollBar(nullptr), 207 : m_pVScrollBar(nullptr),
208 m_rcWindow(), 208 m_rcWindow(),
209 m_rcClip(), 209 m_rcClip(),
210 m_bCreated(FALSE), 210 m_bCreated(false),
211 m_bVisible(FALSE), 211 m_bVisible(false),
212 m_bNotifying(FALSE), 212 m_bNotifying(false),
213 m_bEnabled(TRUE) {} 213 m_bEnabled(true) {}
214 214
215 CPWL_Wnd::~CPWL_Wnd() { 215 CPWL_Wnd::~CPWL_Wnd() {
216 ASSERT(m_bCreated == FALSE); 216 ASSERT(m_bCreated == false);
217 } 217 }
218 218
219 CFX_ByteString CPWL_Wnd::GetClassName() const { 219 CFX_ByteString CPWL_Wnd::GetClassName() const {
220 return "CPWL_Wnd"; 220 return "CPWL_Wnd";
221 } 221 }
222 222
223 void CPWL_Wnd::Create(const PWL_CREATEPARAM& cp) { 223 void CPWL_Wnd::Create(const PWL_CREATEPARAM& cp) {
224 if (!IsValid()) { 224 if (!IsValid()) {
225 m_sPrivateParam = cp; 225 m_sPrivateParam = cp;
226 226
(...skipping 14 matching lines...) Expand all
241 ccp.mtChild = CFX_Matrix(1, 0, 0, 1, 0, 0); 241 ccp.mtChild = CFX_Matrix(1, 0, 0, 1, 0, 0);
242 242
243 CreateScrollBar(ccp); 243 CreateScrollBar(ccp);
244 CreateChildWnd(ccp); 244 CreateChildWnd(ccp);
245 245
246 m_bVisible = HasFlag(PWS_VISIBLE); 246 m_bVisible = HasFlag(PWS_VISIBLE);
247 247
248 OnCreated(); 248 OnCreated();
249 249
250 RePosChildWnd(); 250 RePosChildWnd();
251 m_bCreated = TRUE; 251 m_bCreated = true;
252 } 252 }
253 } 253 }
254 254
255 void CPWL_Wnd::OnCreate(PWL_CREATEPARAM& cp) {} 255 void CPWL_Wnd::OnCreate(PWL_CREATEPARAM& cp) {}
256 256
257 void CPWL_Wnd::OnCreated() {} 257 void CPWL_Wnd::OnCreated() {}
258 258
259 void CPWL_Wnd::OnDestroy() {} 259 void CPWL_Wnd::OnDestroy() {}
260 260
261 void CPWL_Wnd::InvalidateFocusHandler(IPWL_FocusHandler* handler) { 261 void CPWL_Wnd::InvalidateFocusHandler(IPWL_FocusHandler* handler) {
(...skipping 15 matching lines...) Expand all
277 for (int32_t i = m_aChildren.GetSize() - 1; i >= 0; i--) { 277 for (int32_t i = m_aChildren.GetSize() - 1; i >= 0; i--) {
278 if (CPWL_Wnd* pChild = m_aChildren[i]) { 278 if (CPWL_Wnd* pChild = m_aChildren[i]) {
279 pChild->Destroy(); 279 pChild->Destroy();
280 delete pChild; 280 delete pChild;
281 pChild = nullptr; 281 pChild = nullptr;
282 } 282 }
283 } 283 }
284 284
285 if (m_sPrivateParam.pParentWnd) 285 if (m_sPrivateParam.pParentWnd)
286 m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHILD); 286 m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHILD);
287 m_bCreated = FALSE; 287 m_bCreated = false;
288 } 288 }
289 289
290 DestroyMsgControl(); 290 DestroyMsgControl();
291 291
292 FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM)); 292 FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM));
293 m_aChildren.RemoveAll(); 293 m_aChildren.RemoveAll();
294 m_pVScrollBar = nullptr; 294 m_pVScrollBar = nullptr;
295 } 295 }
296 296
297 void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, 297 void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh) {
298 FX_BOOL bReset,
299 FX_BOOL bRefresh) {
300 if (IsValid()) { 298 if (IsValid()) {
301 CFX_FloatRect rcOld = GetWindowRect(); 299 CFX_FloatRect rcOld = GetWindowRect();
302 300
303 m_rcWindow = rcNew; 301 m_rcWindow = rcNew;
304 m_rcWindow.Normalize(); 302 m_rcWindow.Normalize();
305 303
306 if (rcOld.left != rcNew.left || rcOld.right != rcNew.right || 304 if (rcOld.left != rcNew.left || rcOld.right != rcNew.right ||
307 rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom) { 305 rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom) {
308 if (bReset) { 306 if (bReset) {
309 RePosChildWnd(); 307 RePosChildWnd();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 rcWin.bottom += PWL_INVALIDATE_INFLATE; 420 rcWin.bottom += PWL_INVALIDATE_INFLATE;
423 421
424 if (CFX_SystemHandler* pSH = GetSystemHandler()) { 422 if (CFX_SystemHandler* pSH = GetSystemHandler()) {
425 if (CPDFSDK_Widget* widget = m_sPrivateParam.pAttachedWidget) 423 if (CPDFSDK_Widget* widget = m_sPrivateParam.pAttachedWidget)
426 pSH->InvalidateRect(widget, rcWin); 424 pSH->InvalidateRect(widget, rcWin);
427 } 425 }
428 } 426 }
429 } 427 }
430 428
431 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ 429 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \
432 FX_BOOL CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ 430 bool CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \
433 if (IsValid() && IsVisible() && IsEnabled()) { \ 431 if (IsValid() && IsVisible() && IsEnabled()) { \
434 if (IsWndCaptureKeyboard(this)) { \ 432 if (IsWndCaptureKeyboard(this)) { \
435 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ 433 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \
436 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ 434 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \
437 if (IsWndCaptureKeyboard(pChild)) { \ 435 if (IsWndCaptureKeyboard(pChild)) { \
438 return pChild->key_method_name(nChar, nFlag); \ 436 return pChild->key_method_name(nChar, nFlag); \
439 } \ 437 } \
440 } \ 438 } \
441 } \ 439 } \
442 } \ 440 } \
443 } \ 441 } \
444 return FALSE; \ 442 return false; \
445 } 443 }
446 444
447 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ 445 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \
448 FX_BOOL CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ 446 bool CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \
449 uint32_t nFlag) { \ 447 uint32_t nFlag) { \
450 if (IsValid() && IsVisible() && IsEnabled()) { \ 448 if (IsValid() && IsVisible() && IsEnabled()) { \
451 if (IsWndCaptureMouse(this)) { \ 449 if (IsWndCaptureMouse(this)) { \
452 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ 450 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \
453 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ 451 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \
454 if (IsWndCaptureMouse(pChild)) { \ 452 if (IsWndCaptureMouse(pChild)) { \
455 return pChild->mouse_method_name(pChild->ParentToChild(point), \ 453 return pChild->mouse_method_name(pChild->ParentToChild(point), \
456 nFlag); \ 454 nFlag); \
457 } \ 455 } \
458 } \ 456 } \
459 } \ 457 } \
460 SetCursor(); \ 458 SetCursor(); \
461 } else { \ 459 } else { \
462 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ 460 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \
463 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ 461 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \
464 if (pChild->WndHitTest(pChild->ParentToChild(point))) { \ 462 if (pChild->WndHitTest(pChild->ParentToChild(point))) { \
465 return pChild->mouse_method_name(pChild->ParentToChild(point), \ 463 return pChild->mouse_method_name(pChild->ParentToChild(point), \
466 nFlag); \ 464 nFlag); \
467 } \ 465 } \
468 } \ 466 } \
469 } \ 467 } \
470 if (WndHitTest(point)) \ 468 if (WndHitTest(point)) \
471 SetCursor(); \ 469 SetCursor(); \
472 } \ 470 } \
473 } \ 471 } \
474 return FALSE; \ 472 return false; \
475 } 473 }
476 474
477 PWL_IMPLEMENT_KEY_METHOD(OnKeyDown) 475 PWL_IMPLEMENT_KEY_METHOD(OnKeyDown)
478 PWL_IMPLEMENT_KEY_METHOD(OnKeyUp) 476 PWL_IMPLEMENT_KEY_METHOD(OnKeyUp)
479 PWL_IMPLEMENT_KEY_METHOD(OnChar) 477 PWL_IMPLEMENT_KEY_METHOD(OnChar)
480 478
481 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk) 479 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk)
482 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown) 480 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown)
483 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp) 481 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp)
484 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk) 482 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk)
485 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown) 483 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown)
486 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp) 484 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp)
487 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) 485 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown)
488 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) 486 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp)
489 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) 487 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove)
490 488
491 FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, 489 bool CPWL_Wnd::OnMouseWheel(short zDelta,
492 const CFX_FloatPoint& point, 490 const CFX_FloatPoint& point,
493 uint32_t nFlag) { 491 uint32_t nFlag) {
494 if (IsValid() && IsVisible() && IsEnabled()) { 492 if (IsValid() && IsVisible() && IsEnabled()) {
495 SetCursor(); 493 SetCursor();
496 if (IsWndCaptureKeyboard(this)) { 494 if (IsWndCaptureKeyboard(this)) {
497 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 495 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) {
498 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 496 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
499 if (IsWndCaptureKeyboard(pChild)) { 497 if (IsWndCaptureKeyboard(pChild)) {
500 return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point), 498 return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point),
501 nFlag); 499 nFlag);
502 } 500 }
503 } 501 }
504 } 502 }
505 } 503 }
506 } 504 }
507 return FALSE; 505 return false;
508 } 506 }
509 507
510 void CPWL_Wnd::AddChild(CPWL_Wnd* pWnd) { 508 void CPWL_Wnd::AddChild(CPWL_Wnd* pWnd) {
511 m_aChildren.Add(pWnd); 509 m_aChildren.Add(pWnd);
512 } 510 }
513 511
514 void CPWL_Wnd::RemoveChild(CPWL_Wnd* pWnd) { 512 void CPWL_Wnd::RemoveChild(CPWL_Wnd* pWnd) {
515 for (int32_t i = m_aChildren.GetSize() - 1; i >= 0; i--) { 513 for (int32_t i = m_aChildren.GetSize() - 1; i >= 0; i--) {
516 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 514 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
517 if (pChild == pWnd) { 515 if (pChild == pWnd) {
(...skipping 13 matching lines...) Expand all
531 AddChild(pWnd); 529 AddChild(pWnd);
532 break; 530 break;
533 case PNM_REMOVECHILD: 531 case PNM_REMOVECHILD:
534 RemoveChild(pWnd); 532 RemoveChild(pWnd);
535 break; 533 break;
536 default: 534 default:
537 break; 535 break;
538 } 536 }
539 } 537 }
540 538
541 FX_BOOL CPWL_Wnd::IsValid() const { 539 bool CPWL_Wnd::IsValid() const {
542 return m_bCreated; 540 return m_bCreated;
543 } 541 }
544 542
545 const PWL_CREATEPARAM& CPWL_Wnd::GetCreationParam() const { 543 const PWL_CREATEPARAM& CPWL_Wnd::GetCreationParam() const {
546 return m_sPrivateParam; 544 return m_sPrivateParam;
547 } 545 }
548 546
549 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const { 547 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const {
550 return m_sPrivateParam.pParentWnd; 548 return m_sPrivateParam.pParentWnd;
551 } 549 }
(...skipping 12 matching lines...) Expand all
564 rcClient.Normalize(); 562 rcClient.Normalize();
565 return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect(); 563 return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect();
566 } 564 }
567 565
568 CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { 566 CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const {
569 CFX_FloatRect rcClient = GetClientRect(); 567 CFX_FloatRect rcClient = GetClientRect();
570 return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f, 568 return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f,
571 (rcClient.top + rcClient.bottom) * 0.5f); 569 (rcClient.top + rcClient.bottom) * 0.5f);
572 } 570 }
573 571
574 FX_BOOL CPWL_Wnd::HasFlag(uint32_t dwFlags) const { 572 bool CPWL_Wnd::HasFlag(uint32_t dwFlags) const {
575 return (m_sPrivateParam.dwFlags & dwFlags) != 0; 573 return (m_sPrivateParam.dwFlags & dwFlags) != 0;
576 } 574 }
577 575
578 void CPWL_Wnd::RemoveFlag(uint32_t dwFlags) { 576 void CPWL_Wnd::RemoveFlag(uint32_t dwFlags) {
579 m_sPrivateParam.dwFlags &= ~dwFlags; 577 m_sPrivateParam.dwFlags &= ~dwFlags;
580 } 578 }
581 579
582 void CPWL_Wnd::AddFlag(uint32_t dwFlags) { 580 void CPWL_Wnd::AddFlag(uint32_t dwFlags) {
583 m_sPrivateParam.dwFlags |= dwFlags; 581 m_sPrivateParam.dwFlags |= dwFlags;
584 } 582 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) { 695 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) {
698 if (pMsgCtrl->IsWndCaptureKeyboard(this)) 696 if (pMsgCtrl->IsWndCaptureKeyboard(this))
699 pMsgCtrl->KillFocus(); 697 pMsgCtrl->KillFocus();
700 } 698 }
701 } 699 }
702 700
703 void CPWL_Wnd::OnSetFocus() {} 701 void CPWL_Wnd::OnSetFocus() {}
704 702
705 void CPWL_Wnd::OnKillFocus() {} 703 void CPWL_Wnd::OnKillFocus() {}
706 704
707 FX_BOOL CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { 705 bool CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const {
708 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y); 706 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y);
709 } 707 }
710 708
711 FX_BOOL CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { 709 bool CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const {
712 return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y); 710 return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y);
713 } 711 }
714 712
715 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const { 713 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const {
716 if (m_sPrivateParam.pParentWnd) 714 if (m_sPrivateParam.pParentWnd)
717 return m_sPrivateParam.pParentWnd->GetRootWnd(); 715 return m_sPrivateParam.pParentWnd->GetRootWnd();
718 716
719 return this; 717 return this;
720 } 718 }
721 719
722 void CPWL_Wnd::SetVisible(FX_BOOL bVisible) { 720 void CPWL_Wnd::SetVisible(bool bVisible) {
723 if (IsValid()) { 721 if (IsValid()) {
724 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 722 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) {
725 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 723 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
726 pChild->SetVisible(bVisible); 724 pChild->SetVisible(bVisible);
727 } 725 }
728 } 726 }
729 727
730 if (bVisible != m_bVisible) { 728 if (bVisible != m_bVisible) {
731 m_bVisible = bVisible; 729 m_bVisible = bVisible;
732 RePosChildWnd(); 730 RePosChildWnd();
733 InvalidateRect(); 731 InvalidateRect();
734 } 732 }
735 } 733 }
736 } 734 }
737 735
738 void CPWL_Wnd::SetClipRect(const CFX_FloatRect& rect) { 736 void CPWL_Wnd::SetClipRect(const CFX_FloatRect& rect) {
739 m_rcClip = rect; 737 m_rcClip = rect;
740 m_rcClip.Normalize(); 738 m_rcClip.Normalize();
741 } 739 }
742 740
743 const CFX_FloatRect& CPWL_Wnd::GetClipRect() const { 741 const CFX_FloatRect& CPWL_Wnd::GetClipRect() const {
744 return m_rcClip; 742 return m_rcClip;
745 } 743 }
746 744
747 FX_BOOL CPWL_Wnd::IsReadOnly() const { 745 bool CPWL_Wnd::IsReadOnly() const {
748 return HasFlag(PWS_READONLY); 746 return HasFlag(PWS_READONLY);
749 } 747 }
750 748
751 void CPWL_Wnd::RePosChildWnd() { 749 void CPWL_Wnd::RePosChildWnd() {
752 CFX_FloatRect rcContent = CPWL_Utils::DeflateRect( 750 CFX_FloatRect rcContent = CPWL_Utils::DeflateRect(
753 GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); 751 GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
754 752
755 CPWL_ScrollBar* pVSB = GetVScrollBar(); 753 CPWL_ScrollBar* pVSB = GetVScrollBar();
756 754
757 CFX_FloatRect rcVScroll = 755 CFX_FloatRect rcVScroll =
758 CFX_FloatRect(rcContent.right - PWL_SCROLLBAR_WIDTH, rcContent.bottom, 756 CFX_FloatRect(rcContent.right - PWL_SCROLLBAR_WIDTH, rcContent.bottom,
759 rcContent.right - 1.0f, rcContent.top); 757 rcContent.right - 1.0f, rcContent.top);
760 758
761 if (pVSB) 759 if (pVSB)
762 pVSB->Move(rcVScroll, TRUE, FALSE); 760 pVSB->Move(rcVScroll, true, false);
763 } 761 }
764 762
765 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {} 763 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {}
766 764
767 void CPWL_Wnd::SetCursor() { 765 void CPWL_Wnd::SetCursor() {
768 if (IsValid()) { 766 if (IsValid()) {
769 if (CFX_SystemHandler* pSH = GetSystemHandler()) { 767 if (CFX_SystemHandler* pSH = GetSystemHandler()) {
770 int32_t nCursorType = GetCreationParam().eCursorType; 768 int32_t nCursorType = GetCreationParam().eCursorType;
771 pSH->SetCursor(nCursorType); 769 pSH->SetCursor(nCursorType);
772 } 770 }
773 } 771 }
774 } 772 }
775 773
776 void CPWL_Wnd::CreateMsgControl() { 774 void CPWL_Wnd::CreateMsgControl() {
777 if (!m_sPrivateParam.pMsgControl) 775 if (!m_sPrivateParam.pMsgControl)
778 m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this); 776 m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this);
779 } 777 }
780 778
781 void CPWL_Wnd::DestroyMsgControl() { 779 void CPWL_Wnd::DestroyMsgControl() {
782 if (CPWL_MsgControl* pMsgControl = GetMsgControl()) 780 if (CPWL_MsgControl* pMsgControl = GetMsgControl())
783 if (pMsgControl->IsWndCreated(this)) 781 if (pMsgControl->IsWndCreated(this))
784 delete pMsgControl; 782 delete pMsgControl;
785 } 783 }
786 784
787 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const { 785 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const {
788 return m_sPrivateParam.pMsgControl; 786 return m_sPrivateParam.pMsgControl;
789 } 787 }
790 788
791 FX_BOOL CPWL_Wnd::IsCaptureMouse() const { 789 bool CPWL_Wnd::IsCaptureMouse() const {
792 return IsWndCaptureMouse(this); 790 return IsWndCaptureMouse(this);
793 } 791 }
794 792
795 FX_BOOL CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { 793 bool CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd* pWnd) const {
796 if (CPWL_MsgControl* pCtrl = GetMsgControl()) 794 if (CPWL_MsgControl* pCtrl = GetMsgControl())
797 return pCtrl->IsWndCaptureMouse(pWnd); 795 return pCtrl->IsWndCaptureMouse(pWnd);
798 796
799 return FALSE; 797 return false;
800 } 798 }
801 799
802 FX_BOOL CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { 800 bool CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const {
803 if (CPWL_MsgControl* pCtrl = GetMsgControl()) 801 if (CPWL_MsgControl* pCtrl = GetMsgControl())
804 return pCtrl->IsWndCaptureKeyboard(pWnd); 802 return pCtrl->IsWndCaptureKeyboard(pWnd);
805 803
806 return FALSE; 804 return false;
807 } 805 }
808 806
809 FX_BOOL CPWL_Wnd::IsFocused() const { 807 bool CPWL_Wnd::IsFocused() const {
810 if (CPWL_MsgControl* pCtrl = GetMsgControl()) 808 if (CPWL_MsgControl* pCtrl = GetMsgControl())
811 return pCtrl->IsMainCaptureKeyboard(this); 809 return pCtrl->IsMainCaptureKeyboard(this);
812 810
813 return FALSE; 811 return false;
814 } 812 }
815 813
816 CFX_FloatRect CPWL_Wnd::GetFocusRect() const { 814 CFX_FloatRect CPWL_Wnd::GetFocusRect() const {
817 return CPWL_Utils::InflateRect(GetWindowRect(), 1); 815 return CPWL_Utils::InflateRect(GetWindowRect(), 1);
818 } 816 }
819 817
820 FX_FLOAT CPWL_Wnd::GetFontSize() const { 818 FX_FLOAT CPWL_Wnd::GetFontSize() const {
821 return m_sPrivateParam.fFontSize; 819 return m_sPrivateParam.fFontSize;
822 } 820 }
823 821
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 } 982 }
985 983
986 const CPWL_Wnd* CPWL_Wnd::GetFocused() const { 984 const CPWL_Wnd* CPWL_Wnd::GetFocused() const {
987 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) { 985 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) {
988 return pMsgCtrl->m_pMainKeyboardWnd; 986 return pMsgCtrl->m_pMainKeyboardWnd;
989 } 987 }
990 988
991 return nullptr; 989 return nullptr;
992 } 990 }
993 991
994 void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) { 992 void CPWL_Wnd::EnableWindow(bool bEnable) {
995 if (m_bEnabled != bEnable) { 993 if (m_bEnabled != bEnable) {
996 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 994 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) {
997 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 995 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
998 pChild->EnableWindow(bEnable); 996 pChild->EnableWindow(bEnable);
999 } 997 }
1000 } 998 }
1001 999
1002 m_bEnabled = bEnable; 1000 m_bEnabled = bEnable;
1003 1001
1004 if (bEnable) 1002 if (bEnable)
1005 OnEnabled(); 1003 OnEnabled();
1006 else 1004 else
1007 OnDisabled(); 1005 OnDisabled();
1008 } 1006 }
1009 } 1007 }
1010 1008
1011 FX_BOOL CPWL_Wnd::IsEnabled() { 1009 bool CPWL_Wnd::IsEnabled() {
1012 return m_bEnabled; 1010 return m_bEnabled;
1013 } 1011 }
1014 1012
1015 void CPWL_Wnd::OnEnabled() {} 1013 void CPWL_Wnd::OnEnabled() {}
1016 1014
1017 void CPWL_Wnd::OnDisabled() {} 1015 void CPWL_Wnd::OnDisabled() {}
1018 1016
1019 FX_BOOL CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const { 1017 bool CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const {
1020 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { 1018 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
1021 return pSystemHandler->IsCTRLKeyDown(nFlag); 1019 return pSystemHandler->IsCTRLKeyDown(nFlag);
1022 } 1020 }
1023 1021
1024 return FALSE; 1022 return false;
1025 } 1023 }
1026 1024
1027 FX_BOOL CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const { 1025 bool CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const {
1028 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { 1026 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
1029 return pSystemHandler->IsSHIFTKeyDown(nFlag); 1027 return pSystemHandler->IsSHIFTKeyDown(nFlag);
1030 } 1028 }
1031 1029
1032 return FALSE; 1030 return false;
1033 } 1031 }
1034 1032
1035 FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { 1033 bool CPWL_Wnd::IsALTpressed(uint32_t nFlag) const {
1036 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { 1034 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
1037 return pSystemHandler->IsALTKeyDown(nFlag); 1035 return pSystemHandler->IsALTKeyDown(nFlag);
1038 } 1036 }
1039 1037
1040 return FALSE; 1038 return false;
1041 } 1039 }
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_Wnd.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698