| OLD | NEW |
| 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 "xfa/fwl/core/fwl_widgetmgrimp.h" | 7 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/core/cfwl_message.h" | 9 #include "xfa/fwl/core/cfwl_message.h" |
| 10 #include "xfa/fwl/core/fwl_appimp.h" | 10 #include "xfa/fwl/core/fwl_appimp.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 : m_dwCapability(0) { | 32 : m_dwCapability(0) { |
| 33 m_pDelegate = new CFWL_WidgetMgrDelegate(this); | 33 m_pDelegate = new CFWL_WidgetMgrDelegate(this); |
| 34 m_pAdapter = pAdapterNative->GetWidgetMgr(m_pDelegate); | 34 m_pAdapter = pAdapterNative->GetWidgetMgr(m_pDelegate); |
| 35 ASSERT(m_pAdapter); | 35 ASSERT(m_pAdapter); |
| 36 CFWL_WidgetMgrItem* pRoot = new CFWL_WidgetMgrItem; | 36 CFWL_WidgetMgrItem* pRoot = new CFWL_WidgetMgrItem; |
| 37 m_mapWidgetItem.SetAt(NULL, pRoot); | 37 m_mapWidgetItem.SetAt(NULL, pRoot); |
| 38 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | 38 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) |
| 39 m_rtScreen.Reset(); | 39 m_rtScreen.Reset(); |
| 40 #endif | 40 #endif |
| 41 } | 41 } |
| 42 |
| 42 CFWL_WidgetMgr::~CFWL_WidgetMgr() { | 43 CFWL_WidgetMgr::~CFWL_WidgetMgr() { |
| 43 FX_POSITION ps = m_mapWidgetItem.GetStartPosition(); | 44 FX_POSITION ps = m_mapWidgetItem.GetStartPosition(); |
| 44 while (ps) { | 45 while (ps) { |
| 45 void* pWidget; | 46 void* pWidget; |
| 46 CFWL_WidgetMgrItem* pItem; | 47 CFWL_WidgetMgrItem* pItem; |
| 47 m_mapWidgetItem.GetNextAssoc(ps, pWidget, (void*&)pItem); | 48 m_mapWidgetItem.GetNextAssoc(ps, pWidget, (void*&)pItem); |
| 48 delete pItem; | 49 delete pItem; |
| 49 } | 50 } |
| 50 m_mapWidgetItem.RemoveAll(); | 51 m_mapWidgetItem.RemoveAll(); |
| 51 if (m_pDelegate) { | 52 delete m_pDelegate; |
| 52 delete m_pDelegate; | |
| 53 m_pDelegate = NULL; | |
| 54 } | |
| 55 } | 53 } |
| 54 |
| 56 int32_t CFWL_WidgetMgr::CountWidgets(IFWL_Widget* pParent) { | 55 int32_t CFWL_WidgetMgr::CountWidgets(IFWL_Widget* pParent) { |
| 57 CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent); | 56 CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent); |
| 58 return TravelWidgetMgr(pParentItem, NULL, NULL); | 57 return TravelWidgetMgr(pParentItem, NULL, NULL); |
| 59 } | 58 } |
| 60 IFWL_Widget* CFWL_WidgetMgr::GetWidget(int32_t nIndex, IFWL_Widget* pParent) { | 59 IFWL_Widget* CFWL_WidgetMgr::GetWidget(int32_t nIndex, IFWL_Widget* pParent) { |
| 61 CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent); | 60 CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent); |
| 62 IFWL_Widget* pWidget = NULL; | 61 IFWL_Widget* pWidget = NULL; |
| 63 TravelWidgetMgr(pParentItem, &nIndex, NULL, &pWidget); | 62 TravelWidgetMgr(pParentItem, &nIndex, NULL, &pWidget); |
| 64 return pWidget; | 63 return pWidget; |
| 65 } | 64 } |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 if (bounds.Contains(x1, y1)) { | 472 if (bounds.Contains(x1, y1)) { |
| 474 x1 -= bounds.left; | 473 x1 -= bounds.left; |
| 475 y1 -= bounds.top; | 474 y1 -= bounds.top; |
| 476 return GetWidgetAtPoint(child, x1, y1); | 475 return GetWidgetAtPoint(child, x1, y1); |
| 477 } | 476 } |
| 478 } | 477 } |
| 479 child = GetWidget(child, FWL_WGTRELATION_PriorSibling); | 478 child = GetWidget(child, FWL_WGTRELATION_PriorSibling); |
| 480 } | 479 } |
| 481 return parent; | 480 return parent; |
| 482 } | 481 } |
| 482 |
| 483 void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm, | 483 void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm, |
| 484 FX_FLOAT fx, | 484 FX_FLOAT fx, |
| 485 FX_FLOAT fy) { | 485 FX_FLOAT fy) { |
| 486 if (!FWL_UseOffscreen(pForm)) { | 486 if (!FWL_UseOffscreen(pForm)) |
| 487 return; | 487 return; |
| 488 } | 488 |
| 489 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pForm); | 489 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pForm); |
| 490 if (pItem->pOffscreen) { | 490 delete pItem->pOffscreen; |
| 491 delete pItem->pOffscreen; | 491 pItem->pOffscreen = nullptr; |
| 492 pItem->pOffscreen = NULL; | |
| 493 } | |
| 494 } | 492 } |
| 493 |
| 495 IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent, | 494 IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent, |
| 496 IFWL_Widget* focus, | 495 IFWL_Widget* focus, |
| 497 FX_BOOL& bFind) { | 496 FX_BOOL& bFind) { |
| 498 IFWL_Widget* child = | 497 IFWL_Widget* child = |
| 499 FWL_GetWidgetMgr()->GetWidget(parent, FWL_WGTRELATION_FirstChild); | 498 FWL_GetWidgetMgr()->GetWidget(parent, FWL_WGTRELATION_FirstChild); |
| 500 while (child) { | 499 while (child) { |
| 501 if (focus == child) { | 500 if (focus == child) { |
| 502 bFind = TRUE; | 501 bFind = TRUE; |
| 503 } | 502 } |
| 504 if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) && | 503 if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) && |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 CFX_RectF temp(m_pWidgetMgr->m_rtScreen); | 999 CFX_RectF temp(m_pWidgetMgr->m_rtScreen); |
| 1001 temp.Deflate(50, 50); | 1000 temp.Deflate(50, 50); |
| 1002 if (!temp.Contains(r)) { | 1001 if (!temp.Contains(r)) { |
| 1003 return FALSE; | 1002 return FALSE; |
| 1004 } | 1003 } |
| 1005 pItem->bOutsideChanged = FALSE; | 1004 pItem->bOutsideChanged = FALSE; |
| 1006 } | 1005 } |
| 1007 #endif | 1006 #endif |
| 1008 return pItem->iRedrawCounter == 0; | 1007 return pItem->iRedrawCounter == 0; |
| 1009 } | 1008 } |
| OLD | NEW |