Chromium Code Reviews| 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_widgetimp.h" | 7 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 } | 104 } |
| 105 | 105 |
| 106 void* IFWL_Widget::GetLayoutItem() const { | 106 void* IFWL_Widget::GetLayoutItem() const { |
| 107 return GetImpl()->GetLayoutItem(); | 107 return GetImpl()->GetLayoutItem(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void IFWL_Widget::SetLayoutItem(void* pItem) { | 110 void IFWL_Widget::SetLayoutItem(void* pItem) { |
| 111 GetImpl()->SetLayoutItem(pItem); | 111 GetImpl()->SetLayoutItem(pItem); |
| 112 } | 112 } |
| 113 | 113 |
| 114 FWL_Error IFWL_Widget::SetPrivateData(void* module_id, | 114 void* IFWL_Widget::GetAssociateWidget() const { |
| 115 void* pData, | 115 return GetImpl()->GetAssociateWidget(); |
| 116 PD_CALLBACK_FREEDATA callback) { | |
| 117 return GetImpl()->SetPrivateData(module_id, pData, callback); | |
| 118 } | 116 } |
| 119 void* IFWL_Widget::GetPrivateData(void* module_id) { | 117 |
| 120 return GetImpl()->GetPrivateData(module_id); | 118 void IFWL_Widget::SetAssociateWidget(void* pAssociate) { |
| 119 GetImpl()->SetAssociateWidget(pAssociate); | |
| 121 } | 120 } |
| 121 | |
| 122 FWL_Error IFWL_Widget::Update() { | 122 FWL_Error IFWL_Widget::Update() { |
| 123 return GetImpl()->Update(); | 123 return GetImpl()->Update(); |
| 124 } | 124 } |
| 125 FWL_Error IFWL_Widget::LockUpdate() { | 125 FWL_Error IFWL_Widget::LockUpdate() { |
| 126 return GetImpl()->LockUpdate(); | 126 return GetImpl()->LockUpdate(); |
| 127 } | 127 } |
| 128 FWL_Error IFWL_Widget::UnlockUpdate() { | 128 FWL_Error IFWL_Widget::UnlockUpdate() { |
| 129 return GetImpl()->UnlockUpdate(); | 129 return GetImpl()->UnlockUpdate(); |
| 130 } | 130 } |
| 131 FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 131 FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 CFWL_WidgetMgr* widgetMgr = CFWL_WidgetMgr::GetInstance(); | 323 CFWL_WidgetMgr* widgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 324 noteDriver->NotifyTargetHide(m_pInterface); | 324 noteDriver->NotifyTargetHide(m_pInterface); |
| 325 IFWL_Widget* child = widgetMgr->GetFirstChildWidget(m_pInterface); | 325 IFWL_Widget* child = widgetMgr->GetFirstChildWidget(m_pInterface); |
| 326 while (child) { | 326 while (child) { |
| 327 noteDriver->NotifyTargetHide(child); | 327 noteDriver->NotifyTargetHide(child); |
| 328 NotifyHideChildWidget(widgetMgr, child, noteDriver); | 328 NotifyHideChildWidget(widgetMgr, child, noteDriver); |
| 329 child = widgetMgr->GetNextSiblingWidget(child); | 329 child = widgetMgr->GetNextSiblingWidget(child); |
| 330 } | 330 } |
| 331 return; | 331 return; |
| 332 } | 332 } |
| 333 FWL_Error CFWL_WidgetImp::SetPrivateData(void* module_id, | |
| 334 void* pData, | |
| 335 PD_CALLBACK_FREEDATA callback) { | |
| 336 if (!m_pPrivateData) { | |
| 337 m_pPrivateData = new CFX_PrivateData; | |
| 338 } | |
| 339 m_pPrivateData->SetPrivateData(module_id, pData, callback); | |
| 340 return FWL_Error::Succeeded; | |
| 341 } | |
| 342 void* CFWL_WidgetImp::GetPrivateData(void* module_id) { | |
| 343 if (!m_pPrivateData) | |
| 344 return NULL; | |
| 345 return m_pPrivateData->GetPrivateData(module_id); | |
| 346 } | |
| 347 FWL_Error CFWL_WidgetImp::Update() { | 333 FWL_Error CFWL_WidgetImp::Update() { |
| 348 return FWL_Error::Succeeded; | 334 return FWL_Error::Succeeded; |
| 349 } | 335 } |
| 350 FWL_Error CFWL_WidgetImp::LockUpdate() { | 336 FWL_Error CFWL_WidgetImp::LockUpdate() { |
| 351 m_iLock++; | 337 m_iLock++; |
| 352 return FWL_Error::Succeeded; | 338 return FWL_Error::Succeeded; |
| 353 } | 339 } |
| 354 FWL_Error CFWL_WidgetImp::UnlockUpdate() { | 340 FWL_Error CFWL_WidgetImp::UnlockUpdate() { |
| 355 if (IsLocked()) { | 341 if (IsLocked()) { |
| 356 m_iLock--; | 342 m_iLock--; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 526 } | 512 } |
| 527 | 513 |
| 528 void* CFWL_WidgetImp::GetLayoutItem() const { | 514 void* CFWL_WidgetImp::GetLayoutItem() const { |
| 529 return m_pLayoutItem; | 515 return m_pLayoutItem; |
| 530 } | 516 } |
| 531 | 517 |
| 532 void CFWL_WidgetImp::SetLayoutItem(void* pItem) { | 518 void CFWL_WidgetImp::SetLayoutItem(void* pItem) { |
| 533 m_pLayoutItem = pItem; | 519 m_pLayoutItem = pItem; |
| 534 } | 520 } |
| 535 | 521 |
| 522 void* CFWL_WidgetImp::GetAssociateWidget() const { | |
| 523 return m_pAssociate; | |
| 524 } | |
| 525 | |
| 526 void CFWL_WidgetImp::SetAssociateWidget(void* pAssociate) { | |
| 527 m_pAssociate = pAssociate; | |
| 528 } | |
| 529 | |
| 536 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, | 530 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, |
| 537 IFWL_Widget* pOuter) | 531 IFWL_Widget* pOuter) |
| 538 : m_pProperties(new CFWL_WidgetImpProperties), | 532 : m_pProperties(new CFWL_WidgetImpProperties), |
| 539 m_pPrivateData(nullptr), | |
| 540 m_pDelegate(nullptr), | 533 m_pDelegate(nullptr), |
| 541 m_pCurDelegate(nullptr), | 534 m_pCurDelegate(nullptr), |
| 542 m_pOuter(pOuter), | 535 m_pOuter(pOuter), |
| 543 m_pInterface(nullptr), | 536 m_pInterface(nullptr), |
| 544 m_pLayoutItem(nullptr), | 537 m_pLayoutItem(nullptr), |
|
Lei Zhang
2016/05/26 23:06:07
Initialize |m_pAssociate| ?
Tom Sepez
2016/05/27 17:15:40
Done.
| |
| 545 m_iLock(0), | 538 m_iLock(0), |
| 546 m_nEventKey(0) { | 539 m_nEventKey(0) { |
| 547 *m_pProperties = properties; | 540 *m_pProperties = properties; |
| 548 m_pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 541 m_pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 549 ASSERT(m_pWidgetMgr); | 542 ASSERT(m_pWidgetMgr); |
| 550 } | 543 } |
| 551 | 544 |
| 552 CFWL_WidgetImp::~CFWL_WidgetImp() { | 545 CFWL_WidgetImp::~CFWL_WidgetImp() { |
| 553 delete m_pPrivateData; | |
| 554 delete m_pProperties; | 546 delete m_pProperties; |
| 555 } | 547 } |
| 556 | 548 |
| 557 FX_BOOL CFWL_WidgetImp::IsEnabled() const { | 549 FX_BOOL CFWL_WidgetImp::IsEnabled() const { |
| 558 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; | 550 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; |
| 559 } | 551 } |
| 560 FX_BOOL CFWL_WidgetImp::IsVisible() const { | 552 FX_BOOL CFWL_WidgetImp::IsVisible() const { |
| 561 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0; | 553 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0; |
| 562 } | 554 } |
| 563 FX_BOOL CFWL_WidgetImp::IsActive() const { | 555 FX_BOOL CFWL_WidgetImp::IsActive() const { |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1048 } | 1040 } |
| 1049 } | 1041 } |
| 1050 | 1042 |
| 1051 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} | 1043 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} |
| 1052 | 1044 |
| 1053 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1045 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 1054 const CFX_Matrix* pMatrix) { | 1046 const CFX_Matrix* pMatrix) { |
| 1055 CFWL_EvtDraw evt; | 1047 CFWL_EvtDraw evt; |
| 1056 evt.m_pGraphics = pGraphics; | 1048 evt.m_pGraphics = pGraphics; |
| 1057 } | 1049 } |
| OLD | NEW |