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

Side by Side Diff: xfa/fwl/lightwidget/cfwl_widget.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: 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
« xfa/fwl/core/ifwl_widget.h ('K') | « xfa/fwl/core/ifwl_widget.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 "xfa/fwl/lightwidget/cfwl_widget.h" 7 #include "xfa/fwl/lightwidget/cfwl_widget.h"
8 8
9 #include "xfa/fde/tto/fde_textout.h" 9 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fwl/core/cfwl_themetext.h" 10 #include "xfa/fwl/core/cfwl_themetext.h"
(...skipping 23 matching lines...) Expand all
34 return FWL_Type::Unknown; 34 return FWL_Type::Unknown;
35 return m_pIface->GetClassID(); 35 return m_pIface->GetClassID();
36 } 36 }
37 37
38 FX_BOOL CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { 38 FX_BOOL CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
39 if (!m_pIface) 39 if (!m_pIface)
40 return FALSE; 40 return FALSE;
41 return m_pIface->IsInstance(wsClass); 41 return m_pIface->IsInstance(wsClass);
42 } 42 }
43 43
44 static void* gs_pFWLWidget = (void*)FXBSTR_ID('l', 'i', 'g', 't');
45
46 FWL_Error CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) { 44 FWL_Error CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) {
47 if (!m_pIface) 45 if (!m_pIface)
48 return FWL_Error::Indefinite; 46 return FWL_Error::Indefinite;
49 return m_pIface->SetPrivateData(gs_pFWLWidget, this, nullptr); 47 m_pIface->SetAssociateWidget(this);
48 return FWL_Error::Succeeded;
50 } 49 }
51 50
52 FWL_Error CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 51 FWL_Error CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
53 if (!m_pIface) 52 if (!m_pIface)
54 return FWL_Error::Indefinite; 53 return FWL_Error::Indefinite;
55 return m_pIface->GetWidgetRect(rect, bAutoSize); 54 return m_pIface->GetWidgetRect(rect, bAutoSize);
56 } 55 }
57 56
58 FWL_Error CFWL_Widget::GetGlobalRect(CFX_RectF& rect) { 57 FWL_Error CFWL_Widget::GetGlobalRect(CFX_RectF& rect) {
59 if (!m_pIface) 58 if (!m_pIface)
(...skipping 11 matching lines...) Expand all
71 if (!m_pIface) 70 if (!m_pIface)
72 return FWL_Error::Indefinite; 71 return FWL_Error::Indefinite;
73 return m_pIface->GetClientRect(rect); 72 return m_pIface->GetClientRect(rect);
74 } 73 }
75 74
76 CFWL_Widget* CFWL_Widget::GetParent() { 75 CFWL_Widget* CFWL_Widget::GetParent() {
77 if (!m_pIface) 76 if (!m_pIface)
78 return nullptr; 77 return nullptr;
79 78
80 IFWL_Widget* parent = m_pIface->GetParent(); 79 IFWL_Widget* parent = m_pIface->GetParent();
81 if (parent) 80 if (!parent)
82 return static_cast<CFWL_Widget*>(parent->GetPrivateData(gs_pFWLWidget)); 81 return nullptr;
83 return nullptr; 82
83 return static_cast<CFWL_Widget*>(parent->GetAssociateWidget());
84 } 84 }
85 85
86 FWL_Error CFWL_Widget::SetParent(CFWL_Widget* pParent) { 86 FWL_Error CFWL_Widget::SetParent(CFWL_Widget* pParent) {
87 if (!m_pIface) 87 if (!m_pIface)
88 return FWL_Error::Indefinite; 88 return FWL_Error::Indefinite;
89 return m_pIface->SetParent(pParent ? pParent->GetWidget() : nullptr); 89 return m_pIface->SetParent(pParent ? pParent->GetWidget() : nullptr);
90 } 90 }
91 91
92 CFWL_Widget* CFWL_Widget::GetOwner() { 92 CFWL_Widget* CFWL_Widget::GetOwner() {
93 return nullptr; 93 return nullptr;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 void* CFWL_Widget::GetLayoutItem() const { 135 void* CFWL_Widget::GetLayoutItem() const {
136 return m_pIface ? m_pIface->GetLayoutItem() : nullptr; 136 return m_pIface ? m_pIface->GetLayoutItem() : nullptr;
137 } 137 }
138 138
139 void CFWL_Widget::SetLayoutItem(void* pItem) { 139 void CFWL_Widget::SetLayoutItem(void* pItem) {
140 if (m_pIface) 140 if (m_pIface)
141 m_pIface->SetLayoutItem(pItem); 141 m_pIface->SetLayoutItem(pItem);
142 } 142 }
143 143
144 FWL_Error CFWL_Widget::SetPrivateData(void* module_id,
145 void* pData,
146 PD_CALLBACK_FREEDATA callback) {
147 if (!m_pIface)
148 return FWL_Error::Indefinite;
149 return m_pIface->SetPrivateData(module_id, pData, callback);
150 }
151
152 void* CFWL_Widget::GetPrivateData(void* module_id) {
153 if (!m_pIface)
154 return nullptr;
155 return m_pIface->GetPrivateData(module_id);
156 }
157
158 FWL_Error CFWL_Widget::Update() { 144 FWL_Error CFWL_Widget::Update() {
159 if (!m_pIface) 145 if (!m_pIface)
160 return FWL_Error::Indefinite; 146 return FWL_Error::Indefinite;
161 return m_pIface->Update(); 147 return m_pIface->Update();
162 } 148 }
163 149
164 FWL_Error CFWL_Widget::LockUpdate() { 150 FWL_Error CFWL_Widget::LockUpdate() {
165 if (!m_pIface) 151 if (!m_pIface)
166 return FWL_Error::Indefinite; 152 return FWL_Error::Indefinite;
167 return m_pIface->LockUpdate(); 153 return m_pIface->LockUpdate();
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; 327 calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft;
342 CFX_RectF rect; 328 CFX_RectF rect;
343 FX_FLOAT fWidth = bMultiLine 329 FX_FLOAT fWidth = bMultiLine
344 ? (iLineWidth > 0 ? (FX_FLOAT)iLineWidth 330 ? (iLineWidth > 0 ? (FX_FLOAT)iLineWidth
345 : FWL_WGT_CalcMultiLineDefWidth) 331 : FWL_WGT_CalcMultiLineDefWidth)
346 : FWL_WGT_CalcWidth; 332 : FWL_WGT_CalcWidth;
347 rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight); 333 rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight);
348 pTheme->CalcTextRect(&calPart, rect); 334 pTheme->CalcTextRect(&calPart, rect);
349 return CFX_SizeF(rect.width, rect.height); 335 return CFX_SizeF(rect.width, rect.height);
350 } 336 }
OLDNEW
« xfa/fwl/core/ifwl_widget.h ('K') | « xfa/fwl/core/ifwl_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698