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

Side by Side Diff: xfa/fwl/core/fwl_widgetimp.cpp

Issue 2016743002: Add back-pointer to "Associated widget" to CFWL_WidgetImp. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@opaque_layout_item
Patch Set: Initialize m_pAssociate. Created 4 years, 6 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 | « xfa/fwl/core/fwl_widgetimp.h ('k') | xfa/fwl/core/ifwl_widget.h » ('j') | 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 "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
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
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
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),
538 m_pAssociate(nullptr),
545 m_iLock(0), 539 m_iLock(0),
546 m_nEventKey(0) { 540 m_nEventKey(0) {
547 *m_pProperties = properties; 541 *m_pProperties = properties;
548 m_pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 542 m_pWidgetMgr = CFWL_WidgetMgr::GetInstance();
549 ASSERT(m_pWidgetMgr); 543 ASSERT(m_pWidgetMgr);
550 } 544 }
551 545
552 CFWL_WidgetImp::~CFWL_WidgetImp() { 546 CFWL_WidgetImp::~CFWL_WidgetImp() {
553 delete m_pPrivateData;
554 delete m_pProperties; 547 delete m_pProperties;
555 } 548 }
556 549
557 FX_BOOL CFWL_WidgetImp::IsEnabled() const { 550 FX_BOOL CFWL_WidgetImp::IsEnabled() const {
558 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; 551 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0;
559 } 552 }
560 FX_BOOL CFWL_WidgetImp::IsVisible() const { 553 FX_BOOL CFWL_WidgetImp::IsVisible() const {
561 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0; 554 return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0;
562 } 555 }
563 FX_BOOL CFWL_WidgetImp::IsActive() const { 556 FX_BOOL CFWL_WidgetImp::IsActive() const {
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 } 1041 }
1049 } 1042 }
1050 1043
1051 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} 1044 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {}
1052 1045
1053 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 1046 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
1054 const CFX_Matrix* pMatrix) { 1047 const CFX_Matrix* pMatrix) {
1055 CFWL_EvtDraw evt; 1048 CFWL_EvtDraw evt;
1056 evt.m_pGraphics = pGraphics; 1049 evt.m_pGraphics = pGraphics;
1057 } 1050 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_widgetimp.h ('k') | xfa/fwl/core/ifwl_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698