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

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

Issue 2594153003: Remove CFX_ArrayTemplate, use unique_ptr in fpdfsdk/pdfwindow (Closed)
Patch Set: Fix compilation Created 3 years, 11 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/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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 m_sPrivateParam.pFocusHandler = nullptr; 263 m_sPrivateParam.pFocusHandler = nullptr;
264 } 264 }
265 265
266 void CPWL_Wnd::InvalidateProvider(IPWL_Provider* provider) { 266 void CPWL_Wnd::InvalidateProvider(IPWL_Provider* provider) {
267 if (m_sPrivateParam.pProvider == provider) 267 if (m_sPrivateParam.pProvider == provider)
268 m_sPrivateParam.pProvider = nullptr; 268 m_sPrivateParam.pProvider = nullptr;
269 } 269 }
270 270
271 void CPWL_Wnd::Destroy() { 271 void CPWL_Wnd::Destroy() {
272 KillFocus(); 272 KillFocus();
273
274 OnDestroy(); 273 OnDestroy();
275
276 if (m_bCreated) { 274 if (m_bCreated) {
277 for (int32_t i = m_aChildren.GetSize() - 1; i >= 0; i--) { 275 for (auto it = m_Children.rbegin(); it != m_Children.rend(); ++it) {
278 if (CPWL_Wnd* pChild = m_aChildren[i]) { 276 if (CPWL_Wnd* pChild = *it) {
277 *it = nullptr;
279 pChild->Destroy(); 278 pChild->Destroy();
280 delete pChild; 279 delete pChild;
281 pChild = nullptr;
282 } 280 }
283 } 281 }
284
285 if (m_sPrivateParam.pParentWnd) 282 if (m_sPrivateParam.pParentWnd)
286 m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHILD); 283 m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHILD);
284
287 m_bCreated = false; 285 m_bCreated = false;
288 } 286 }
289
290 DestroyMsgControl(); 287 DestroyMsgControl();
291
292 FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM)); 288 FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM));
293 m_aChildren.RemoveAll(); 289 m_Children.clear();
294 m_pVScrollBar = nullptr; 290 m_pVScrollBar = nullptr;
295 } 291 }
296 292
297 void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh) { 293 void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh) {
298 if (IsValid()) { 294 if (IsValid()) {
299 CFX_FloatRect rcOld = GetWindowRect(); 295 CFX_FloatRect rcOld = GetWindowRect();
300 296
301 m_rcWindow = rcNew; 297 m_rcWindow = rcNew;
302 m_rcWindow.Normalize(); 298 m_rcWindow.Normalize();
303 299
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 GetBorderLeftTopColor(GetBorderStyle()), 341 GetBorderLeftTopColor(GetBorderStyle()),
346 GetBorderRightBottomColor(GetBorderStyle()), GetBorderStyle(), 342 GetBorderRightBottomColor(GetBorderStyle()), GetBorderStyle(),
347 GetBorderDash()); 343 GetBorderDash());
348 } 344 }
349 345
350 sAppStream << sThis; 346 sAppStream << sThis;
351 } 347 }
352 } 348 }
353 349
354 void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf& sAppStream) { 350 void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf& sAppStream) {
355 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 351 for (CPWL_Wnd* pChild : m_Children) {
356 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 352 if (pChild)
357 pChild->GetAppearanceStream(sAppStream); 353 pChild->GetAppearanceStream(sAppStream);
358 }
359 } 354 }
360 } 355 }
361 356
362 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice, 357 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice,
363 CFX_Matrix* pUser2Device) { 358 CFX_Matrix* pUser2Device) {
364 if (IsValid() && IsVisible()) { 359 if (IsValid() && IsVisible()) {
365 DrawThisAppearance(pDevice, pUser2Device); 360 DrawThisAppearance(pDevice, pUser2Device);
366 DrawChildAppearance(pDevice, pUser2Device); 361 DrawChildAppearance(pDevice, pUser2Device);
367 } 362 }
368 } 363 }
(...skipping 13 matching lines...) Expand all
382 CPWL_Utils::DrawBorder(pDevice, pUser2Device, rectWnd, 377 CPWL_Utils::DrawBorder(pDevice, pUser2Device, rectWnd,
383 (FX_FLOAT)GetBorderWidth(), GetBorderColor(), 378 (FX_FLOAT)GetBorderWidth(), GetBorderColor(),
384 GetBorderLeftTopColor(GetBorderStyle()), 379 GetBorderLeftTopColor(GetBorderStyle()),
385 GetBorderRightBottomColor(GetBorderStyle()), 380 GetBorderRightBottomColor(GetBorderStyle()),
386 GetBorderStyle(), GetTransparency()); 381 GetBorderStyle(), GetTransparency());
387 } 382 }
388 } 383 }
389 384
390 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice, 385 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice,
391 CFX_Matrix* pUser2Device) { 386 CFX_Matrix* pUser2Device) {
392 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 387 for (CPWL_Wnd* pChild : m_Children) {
393 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 388 if (!pChild)
394 CFX_Matrix mt = pChild->GetChildMatrix(); 389 continue;
395 if (mt.IsIdentity()) { 390
396 pChild->DrawAppearance(pDevice, pUser2Device); 391 CFX_Matrix mt = pChild->GetChildMatrix();
397 } else { 392 if (mt.IsIdentity()) {
398 mt.Concat(*pUser2Device); 393 pChild->DrawAppearance(pDevice, pUser2Device);
399 pChild->DrawAppearance(pDevice, &mt); 394 } else {
400 } 395 mt.Concat(*pUser2Device);
396 pChild->DrawAppearance(pDevice, &mt);
401 } 397 }
402 } 398 }
403 } 399 }
404 400
405 void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { 401 void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) {
406 if (IsValid()) { 402 if (IsValid()) {
407 CFX_FloatRect rcRefresh = pRect ? *pRect : GetWindowRect(); 403 CFX_FloatRect rcRefresh = pRect ? *pRect : GetWindowRect();
408 404
409 if (!HasFlag(PWS_NOREFRESHCLIP)) { 405 if (!HasFlag(PWS_NOREFRESHCLIP)) {
410 CFX_FloatRect rcClip = GetClipRect(); 406 CFX_FloatRect rcClip = GetClipRect();
411 if (!rcClip.IsEmpty()) { 407 if (!rcClip.IsEmpty()) {
412 rcRefresh.Intersect(rcClip); 408 rcRefresh.Intersect(rcClip);
413 } 409 }
414 } 410 }
415 411
416 FX_RECT rcWin = PWLtoWnd(rcRefresh); 412 FX_RECT rcWin = PWLtoWnd(rcRefresh);
417 rcWin.left -= PWL_INVALIDATE_INFLATE; 413 rcWin.left -= PWL_INVALIDATE_INFLATE;
418 rcWin.top -= PWL_INVALIDATE_INFLATE; 414 rcWin.top -= PWL_INVALIDATE_INFLATE;
419 rcWin.right += PWL_INVALIDATE_INFLATE; 415 rcWin.right += PWL_INVALIDATE_INFLATE;
420 rcWin.bottom += PWL_INVALIDATE_INFLATE; 416 rcWin.bottom += PWL_INVALIDATE_INFLATE;
421 417
422 if (CFX_SystemHandler* pSH = GetSystemHandler()) { 418 if (CFX_SystemHandler* pSH = GetSystemHandler()) {
423 if (CPDFSDK_Widget* widget = m_sPrivateParam.pAttachedWidget) 419 if (CPDFSDK_Widget* widget = m_sPrivateParam.pAttachedWidget)
424 pSH->InvalidateRect(widget, rcWin); 420 pSH->InvalidateRect(widget, rcWin);
425 } 421 }
426 } 422 }
427 } 423 }
428 424
429 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ 425 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \
430 bool CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ 426 bool CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \
431 if (IsValid() && IsVisible() && IsEnabled()) { \ 427 if (!IsValid() || !IsVisible() || !IsEnabled()) \
432 if (IsWndCaptureKeyboard(this)) { \ 428 return false; \
433 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ 429 if (!IsWndCaptureKeyboard(this)) \
434 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ 430 return false; \
435 if (IsWndCaptureKeyboard(pChild)) { \ 431 for (const auto& pChild : m_Children) { \
436 return pChild->key_method_name(nChar, nFlag); \ 432 if (pChild && IsWndCaptureKeyboard(pChild)) \
437 } \ 433 return pChild->key_method_name(nChar, nFlag); \
438 } \ 434 } \
439 } \ 435 return false; \
440 } \
441 } \
442 return false; \
443 }
444
445 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \
446 bool CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \
447 uint32_t nFlag) { \
448 if (IsValid() && IsVisible() && IsEnabled()) { \
449 if (IsWndCaptureMouse(this)) { \
450 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \
451 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \
452 if (IsWndCaptureMouse(pChild)) { \
453 return pChild->mouse_method_name(pChild->ParentToChild(point), \
454 nFlag); \
455 } \
456 } \
457 } \
458 SetCursor(); \
459 } else { \
460 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \
461 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \
462 if (pChild->WndHitTest(pChild->ParentToChild(point))) { \
463 return pChild->mouse_method_name(pChild->ParentToChild(point), \
464 nFlag); \
465 } \
466 } \
467 } \
468 if (WndHitTest(point)) \
469 SetCursor(); \
470 } \
471 } \
472 return false; \
473 } 436 }
474 437
475 PWL_IMPLEMENT_KEY_METHOD(OnKeyDown) 438 PWL_IMPLEMENT_KEY_METHOD(OnKeyDown)
476 PWL_IMPLEMENT_KEY_METHOD(OnKeyUp) 439 PWL_IMPLEMENT_KEY_METHOD(OnKeyUp)
477 PWL_IMPLEMENT_KEY_METHOD(OnChar) 440 PWL_IMPLEMENT_KEY_METHOD(OnChar)
441 #undef PWL_IMPLEMENT_KEY_METHOD
442
443 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \
444 bool CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \
445 uint32_t nFlag) { \
446 if (!IsValid() || !IsVisible() || !IsEnabled()) \
447 return false; \
448 if (IsWndCaptureMouse(this)) { \
449 for (const auto& pChild : m_Children) { \
450 if (pChild && IsWndCaptureMouse(pChild)) { \
451 return pChild->mouse_method_name(pChild->ParentToChild(point), \
452 nFlag); \
453 } \
454 } \
455 SetCursor(); \
456 return false; \
457 } \
458 for (const auto& pChild : m_Children) { \
459 if (pChild && pChild->WndHitTest(pChild->ParentToChild(point))) { \
460 return pChild->mouse_method_name(pChild->ParentToChild(point), nFlag); \
461 } \
462 } \
463 if (WndHitTest(point)) \
464 SetCursor(); \
465 return false; \
466 }
478 467
479 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk) 468 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk)
480 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown) 469 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown)
481 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp) 470 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp)
482 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk) 471 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk)
483 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown) 472 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown)
484 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp) 473 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp)
485 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) 474 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown)
486 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) 475 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp)
487 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) 476 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove)
477 #undef PWL_IMPLEMENT_MOUSE_METHOD
488 478
489 bool CPWL_Wnd::OnMouseWheel(short zDelta, 479 bool CPWL_Wnd::OnMouseWheel(short zDelta,
490 const CFX_FloatPoint& point, 480 const CFX_FloatPoint& point,
491 uint32_t nFlag) { 481 uint32_t nFlag) {
492 if (IsValid() && IsVisible() && IsEnabled()) { 482 if (!IsValid() || !IsVisible() || !IsEnabled())
493 SetCursor(); 483 return false;
494 if (IsWndCaptureKeyboard(this)) { 484
495 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 485 SetCursor();
496 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 486 if (!IsWndCaptureKeyboard(this))
497 if (IsWndCaptureKeyboard(pChild)) { 487 return false;
498 return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point), 488
499 nFlag); 489 for (const auto& pChild : m_Children) {
500 } 490 if (pChild && IsWndCaptureKeyboard(pChild))
501 } 491 return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point), nFlag);
502 }
503 }
504 } 492 }
505 return false; 493 return false;
506 } 494 }
507 495
508 void CPWL_Wnd::AddChild(CPWL_Wnd* pWnd) { 496 void CPWL_Wnd::AddChild(CPWL_Wnd* pWnd) {
509 m_aChildren.Add(pWnd); 497 m_Children.push_back(pWnd);
510 } 498 }
511 499
512 void CPWL_Wnd::RemoveChild(CPWL_Wnd* pWnd) { 500 void CPWL_Wnd::RemoveChild(CPWL_Wnd* pWnd) {
513 for (int32_t i = m_aChildren.GetSize() - 1; i >= 0; i--) { 501 for (auto it = m_Children.rbegin(); it != m_Children.rend(); ++it) {
514 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 502 if (*it && *it == pWnd) {
515 if (pChild == pWnd) { 503 m_Children.erase(std::next(it).base());
516 m_aChildren.RemoveAt(i); 504 break;
517 break;
518 }
519 } 505 }
520 } 506 }
521 } 507 }
522 508
523 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, 509 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd,
524 uint32_t msg, 510 uint32_t msg,
525 intptr_t wParam, 511 intptr_t wParam,
526 intptr_t lParam) { 512 intptr_t lParam) {
527 switch (msg) { 513 switch (msg) {
528 case PNM_ADDCHILD: 514 case PNM_ADDCHILD:
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 m_pVScrollBar->Create(scp); 654 m_pVScrollBar->Create(scp);
669 } 655 }
670 } 656 }
671 657
672 void CPWL_Wnd::SetCapture() { 658 void CPWL_Wnd::SetCapture() {
673 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) 659 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl())
674 pMsgCtrl->SetCapture(this); 660 pMsgCtrl->SetCapture(this);
675 } 661 }
676 662
677 void CPWL_Wnd::ReleaseCapture() { 663 void CPWL_Wnd::ReleaseCapture() {
678 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) 664 for (const auto& pChild : m_Children) {
679 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 665 if (pChild)
680 pChild->ReleaseCapture(); 666 pChild->ReleaseCapture();
681 667 }
682 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) 668 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl())
683 pMsgCtrl->ReleaseCapture(); 669 pMsgCtrl->ReleaseCapture();
684 } 670 }
685 671
686 void CPWL_Wnd::SetFocus() { 672 void CPWL_Wnd::SetFocus() {
687 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) { 673 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) {
688 if (!pMsgCtrl->IsMainCaptureKeyboard(this)) 674 if (!pMsgCtrl->IsMainCaptureKeyboard(this))
689 pMsgCtrl->KillFocus(); 675 pMsgCtrl->KillFocus();
690 pMsgCtrl->SetFocus(this); 676 pMsgCtrl->SetFocus(this);
691 } 677 }
(...skipping 19 matching lines...) Expand all
711 } 697 }
712 698
713 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const { 699 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const {
714 if (m_sPrivateParam.pParentWnd) 700 if (m_sPrivateParam.pParentWnd)
715 return m_sPrivateParam.pParentWnd->GetRootWnd(); 701 return m_sPrivateParam.pParentWnd->GetRootWnd();
716 702
717 return this; 703 return this;
718 } 704 }
719 705
720 void CPWL_Wnd::SetVisible(bool bVisible) { 706 void CPWL_Wnd::SetVisible(bool bVisible) {
721 if (IsValid()) { 707 if (!IsValid())
722 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 708 return;
723 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
724 pChild->SetVisible(bVisible);
725 }
726 }
727 709
728 if (bVisible != m_bVisible) { 710 for (const auto& pChild : m_Children) {
729 m_bVisible = bVisible; 711 if (pChild)
730 RePosChildWnd(); 712 pChild->SetVisible(bVisible);
731 InvalidateRect(); 713 }
732 } 714 if (bVisible != m_bVisible) {
715 m_bVisible = bVisible;
716 RePosChildWnd();
717 InvalidateRect();
733 } 718 }
734 } 719 }
735 720
736 void CPWL_Wnd::SetClipRect(const CFX_FloatRect& rect) { 721 void CPWL_Wnd::SetClipRect(const CFX_FloatRect& rect) {
737 m_rcClip = rect; 722 m_rcClip = rect;
738 m_rcClip.Normalize(); 723 m_rcClip.Normalize();
739 } 724 }
740 725
741 const CFX_FloatRect& CPWL_Wnd::GetClipRect() const { 726 const CFX_FloatRect& CPWL_Wnd::GetClipRect() const {
742 return m_rcClip; 727 return m_rcClip;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 default: 844 default:
860 return CPWL_Color(); 845 return CPWL_Color();
861 } 846 }
862 } 847 }
863 848
864 int32_t CPWL_Wnd::GetTransparency() { 849 int32_t CPWL_Wnd::GetTransparency() {
865 return m_sPrivateParam.nTransparency; 850 return m_sPrivateParam.nTransparency;
866 } 851 }
867 852
868 void CPWL_Wnd::SetTransparency(int32_t nTransparency) { 853 void CPWL_Wnd::SetTransparency(int32_t nTransparency) {
869 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 854 for (const auto& pChild : m_Children) {
870 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 855 if (pChild)
871 pChild->SetTransparency(nTransparency); 856 pChild->SetTransparency(nTransparency);
872 }
873 } 857 }
874
875 m_sPrivateParam.nTransparency = nTransparency; 858 m_sPrivateParam.nTransparency = nTransparency;
876 } 859 }
877 860
878 CFX_Matrix CPWL_Wnd::GetWindowMatrix() const { 861 CFX_Matrix CPWL_Wnd::GetWindowMatrix() const {
879 CFX_Matrix mt = GetChildToRoot(); 862 CFX_Matrix mt = GetChildToRoot();
880 863 if (IPWL_Provider* pProvider = GetProvider())
881 if (IPWL_Provider* pProvider = GetProvider()) {
882 mt.Concat(pProvider->GetWindowMatrix(GetAttachedData())); 864 mt.Concat(pProvider->GetWindowMatrix(GetAttachedData()));
883 return mt;
884 }
885 865
886 return mt; 866 return mt;
887 } 867 }
888 868
889 void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point, 869 void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point,
890 int32_t& x, 870 int32_t& x,
891 int32_t& y) const { 871 int32_t& y) const {
892 CFX_Matrix mt = GetWindowMatrix(); 872 CFX_Matrix mt = GetWindowMatrix();
893 CFX_FloatPoint pt = point; 873 CFX_FloatPoint pt = point;
894 mt.Transform(pt.x, pt.y); 874 mt.Transform(pt.x, pt.y);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 return m_sPrivateParam.mtChild; 955 return m_sPrivateParam.mtChild;
976 956
977 return CFX_Matrix(1, 0, 0, 1, 0, 0); 957 return CFX_Matrix(1, 0, 0, 1, 0, 0);
978 } 958 }
979 959
980 void CPWL_Wnd::SetChildMatrix(const CFX_Matrix& mt) { 960 void CPWL_Wnd::SetChildMatrix(const CFX_Matrix& mt) {
981 m_sPrivateParam.mtChild = mt; 961 m_sPrivateParam.mtChild = mt;
982 } 962 }
983 963
984 const CPWL_Wnd* CPWL_Wnd::GetFocused() const { 964 const CPWL_Wnd* CPWL_Wnd::GetFocused() const {
985 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) { 965 CPWL_MsgControl* pMsgCtrl = GetMsgControl();
986 return pMsgCtrl->m_pMainKeyboardWnd; 966 return pMsgCtrl ? pMsgCtrl->m_pMainKeyboardWnd : nullptr;
987 }
988
989 return nullptr;
990 } 967 }
991 968
992 void CPWL_Wnd::EnableWindow(bool bEnable) { 969 void CPWL_Wnd::EnableWindow(bool bEnable) {
993 if (m_bEnabled != bEnable) { 970 if (m_bEnabled == bEnable)
994 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 971 return;
995 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
996 pChild->EnableWindow(bEnable);
997 }
998 }
999 972
1000 m_bEnabled = bEnable; 973 for (const auto& pChild : m_Children) {
1001 974 if (pChild)
1002 if (bEnable) 975 pChild->EnableWindow(bEnable);
1003 OnEnabled();
1004 else
1005 OnDisabled();
1006 } 976 }
977 m_bEnabled = bEnable;
978 if (bEnable)
979 OnEnabled();
980 else
981 OnDisabled();
1007 } 982 }
1008 983
1009 bool CPWL_Wnd::IsEnabled() { 984 bool CPWL_Wnd::IsEnabled() {
1010 return m_bEnabled; 985 return m_bEnabled;
1011 } 986 }
1012 987
1013 void CPWL_Wnd::OnEnabled() {} 988 void CPWL_Wnd::OnEnabled() {}
1014 989
1015 void CPWL_Wnd::OnDisabled() {} 990 void CPWL_Wnd::OnDisabled() {}
1016 991
(...skipping 13 matching lines...) Expand all
1030 return false; 1005 return false;
1031 } 1006 }
1032 1007
1033 bool CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { 1008 bool CPWL_Wnd::IsALTpressed(uint32_t nFlag) const {
1034 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { 1009 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
1035 return pSystemHandler->IsALTKeyDown(nFlag); 1010 return pSystemHandler->IsALTKeyDown(nFlag);
1036 } 1011 }
1037 1012
1038 return false; 1013 return false;
1039 } 1014 }
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