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

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

Issue 2012143003: Remove one (of several) usages of SetPrivateData from IFWL_Widget (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove casts 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 30 matching lines...) Expand all
41 41
42 FWL_Error IFWL_Widget::Initialize() { 42 FWL_Error IFWL_Widget::Initialize() {
43 return m_pImpl->Initialize(); 43 return m_pImpl->Initialize();
44 } 44 }
45 45
46 FWL_Error IFWL_Widget::Finalize() { 46 FWL_Error IFWL_Widget::Finalize() {
47 return m_pImpl->Finalize(); 47 return m_pImpl->Finalize();
48 } 48 }
49 49
50 FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 50 FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
51 return static_cast<CFWL_WidgetImp*>(GetImpl()) 51 return GetImpl()->GetWidgetRect(rect, bAutoSize);
52 ->GetWidgetRect(rect, bAutoSize);
53 } 52 }
54 FWL_Error IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { 53 FWL_Error IFWL_Widget::GetGlobalRect(CFX_RectF& rect) {
55 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetGlobalRect(rect); 54 return GetImpl()->GetGlobalRect(rect);
56 } 55 }
57 FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { 56 FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
58 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetWidgetRect(rect); 57 return GetImpl()->SetWidgetRect(rect);
59 } 58 }
60 FWL_Error IFWL_Widget::GetClientRect(CFX_RectF& rect) { 59 FWL_Error IFWL_Widget::GetClientRect(CFX_RectF& rect) {
61 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetClientRect(rect); 60 return GetImpl()->GetClientRect(rect);
62 } 61 }
63 IFWL_Widget* IFWL_Widget::GetParent() { 62 IFWL_Widget* IFWL_Widget::GetParent() {
64 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetParent(); 63 return GetImpl()->GetParent();
65 } 64 }
66 FWL_Error IFWL_Widget::SetParent(IFWL_Widget* pParent) { 65 FWL_Error IFWL_Widget::SetParent(IFWL_Widget* pParent) {
67 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetParent(pParent); 66 return GetImpl()->SetParent(pParent);
68 } 67 }
69 IFWL_Widget* IFWL_Widget::GetOwner() { 68 IFWL_Widget* IFWL_Widget::GetOwner() {
70 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwner(); 69 return GetImpl()->GetOwner();
71 } 70 }
72 FWL_Error IFWL_Widget::SetOwner(IFWL_Widget* pOwner) { 71 FWL_Error IFWL_Widget::SetOwner(IFWL_Widget* pOwner) {
73 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetOwner(pOwner); 72 return GetImpl()->SetOwner(pOwner);
74 } 73 }
75 IFWL_Widget* IFWL_Widget::GetOuter() { 74 IFWL_Widget* IFWL_Widget::GetOuter() {
76 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOuter(); 75 return GetImpl()->GetOuter();
77 } 76 }
78 uint32_t IFWL_Widget::GetStyles() { 77 uint32_t IFWL_Widget::GetStyles() {
79 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStyles(); 78 return GetImpl()->GetStyles();
80 } 79 }
81 FWL_Error IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, 80 FWL_Error IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded,
82 uint32_t dwStylesRemoved) { 81 uint32_t dwStylesRemoved) {
83 return static_cast<CFWL_WidgetImp*>(GetImpl()) 82 return GetImpl()->ModifyStyles(dwStylesAdded, dwStylesRemoved);
84 ->ModifyStyles(dwStylesAdded, dwStylesRemoved);
85 } 83 }
86 uint32_t IFWL_Widget::GetStylesEx() { 84 uint32_t IFWL_Widget::GetStylesEx() {
87 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStylesEx(); 85 return GetImpl()->GetStylesEx();
88 } 86 }
89 FWL_Error IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, 87 FWL_Error IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded,
90 uint32_t dwStylesExRemoved) { 88 uint32_t dwStylesExRemoved) {
91 return static_cast<CFWL_WidgetImp*>(GetImpl()) 89 return GetImpl()->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
92 ->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
93 } 90 }
94 uint32_t IFWL_Widget::GetStates() { 91 uint32_t IFWL_Widget::GetStates() {
95 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStates(); 92 return GetImpl()->GetStates();
96 } 93 }
97 void IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { 94 void IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) {
98 static_cast<CFWL_WidgetImp*>(GetImpl())->SetStates(dwStates, bSet); 95 GetImpl()->SetStates(dwStates, bSet);
99 } 96 }
97
98 uint32_t IFWL_Widget::GetEventKey() const {
99 return GetImpl()->GetEventKey();
100 }
101
102 void IFWL_Widget::SetEventKey(uint32_t key) {
103 GetImpl()->SetEventKey(key);
104 }
105
100 FWL_Error IFWL_Widget::SetPrivateData(void* module_id, 106 FWL_Error IFWL_Widget::SetPrivateData(void* module_id,
101 void* pData, 107 void* pData,
102 PD_CALLBACK_FREEDATA callback) { 108 PD_CALLBACK_FREEDATA callback) {
103 return static_cast<CFWL_WidgetImp*>(GetImpl()) 109 return GetImpl()->SetPrivateData(module_id, pData, callback);
104 ->SetPrivateData(module_id, pData, callback);
105 } 110 }
106 void* IFWL_Widget::GetPrivateData(void* module_id) { 111 void* IFWL_Widget::GetPrivateData(void* module_id) {
107 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetPrivateData(module_id); 112 return GetImpl()->GetPrivateData(module_id);
108 } 113 }
109 FWL_Error IFWL_Widget::Update() { 114 FWL_Error IFWL_Widget::Update() {
110 return static_cast<CFWL_WidgetImp*>(GetImpl())->Update(); 115 return GetImpl()->Update();
111 } 116 }
112 FWL_Error IFWL_Widget::LockUpdate() { 117 FWL_Error IFWL_Widget::LockUpdate() {
113 return static_cast<CFWL_WidgetImp*>(GetImpl())->LockUpdate(); 118 return GetImpl()->LockUpdate();
114 } 119 }
115 FWL_Error IFWL_Widget::UnlockUpdate() { 120 FWL_Error IFWL_Widget::UnlockUpdate() {
116 return static_cast<CFWL_WidgetImp*>(GetImpl())->UnlockUpdate(); 121 return GetImpl()->UnlockUpdate();
117 } 122 }
118 FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { 123 FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
119 return static_cast<CFWL_WidgetImp*>(GetImpl())->HitTest(fx, fy); 124 return GetImpl()->HitTest(fx, fy);
120 } 125 }
121 FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, 126 FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget,
122 FX_FLOAT& fx, 127 FX_FLOAT& fx,
123 FX_FLOAT& fy) { 128 FX_FLOAT& fy) {
124 return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, fx, fy); 129 return GetImpl()->TransformTo(pWidget, fx, fy);
125 } 130 }
126 FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { 131 FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) {
127 return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, rt); 132 return GetImpl()->TransformTo(pWidget, rt);
128 } 133 }
129 FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { 134 FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
130 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetMatrix(matrix, bGlobal); 135 return GetImpl()->GetMatrix(matrix, bGlobal);
131 } 136 }
132 FWL_Error IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { 137 FWL_Error IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) {
133 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetMatrix(matrix); 138 return GetImpl()->SetMatrix(matrix);
134 } 139 }
135 FWL_Error IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, 140 FWL_Error IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
136 const CFX_Matrix* pMatrix) { 141 const CFX_Matrix* pMatrix) {
137 return static_cast<CFWL_WidgetImp*>(GetImpl()) 142 return GetImpl()->DrawWidget(pGraphics, pMatrix);
138 ->DrawWidget(pGraphics, pMatrix);
139 } 143 }
140 IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() { 144 IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() {
141 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetThemeProvider(); 145 return GetImpl()->GetThemeProvider();
142 } 146 }
143 FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { 147 FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
144 return static_cast<CFWL_WidgetImp*>(GetImpl()) 148 return GetImpl()->SetThemeProvider(pThemeProvider);
145 ->SetThemeProvider(pThemeProvider);
146 } 149 }
147 FWL_Error IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { 150 FWL_Error IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) {
148 return static_cast<CFWL_WidgetImp*>(GetImpl()) 151 return GetImpl()->SetDataProvider(pDataProvider);
149 ->SetDataProvider(pDataProvider);
150 } 152 }
151 IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) { 153 IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
152 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetDelegate(pDelegate); 154 return GetImpl()->SetDelegate(pDelegate);
153 } 155 }
154 IFWL_App* IFWL_Widget::GetOwnerApp() const { 156 IFWL_App* IFWL_Widget::GetOwnerApp() const {
155 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwnerApp(); 157 return GetImpl()->GetOwnerApp();
156 } 158 }
157 CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { 159 CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) {
158 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOffsetFromParent(pParent); 160 return GetImpl()->GetOffsetFromParent(pParent);
159 } 161 }
160 162
161 FWL_Error CFWL_WidgetImp::Initialize() { 163 FWL_Error CFWL_WidgetImp::Initialize() {
162 IFWL_App* pApp = FWL_GetApp(); 164 IFWL_App* pApp = FWL_GetApp();
163 if (!pApp) 165 if (!pApp)
164 return FWL_Error::Indefinite; 166 return FWL_Error::Indefinite;
165 167
166 CXFA_FFApp* pAdapter = pApp->GetAdapterNative(); 168 CXFA_FFApp* pAdapter = pApp->GetAdapterNative();
167 if (!pAdapter) 169 if (!pAdapter)
168 return FWL_Error::Indefinite; 170 return FWL_Error::Indefinite;
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 FWL_Error CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { 501 FWL_Error CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) {
500 m_pOwnerApp = pOwnerApp; 502 m_pOwnerApp = pOwnerApp;
501 return FWL_Error::Succeeded; 503 return FWL_Error::Succeeded;
502 } 504 }
503 IFWL_Widget* CFWL_WidgetImp::GetInterface() const { 505 IFWL_Widget* CFWL_WidgetImp::GetInterface() const {
504 return m_pInterface; 506 return m_pInterface;
505 } 507 }
506 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) { 508 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) {
507 m_pInterface = pInterface; 509 m_pInterface = pInterface;
508 } 510 }
511
512 uint32_t CFWL_WidgetImp::GetEventKey() const {
513 return m_nEventKey;
514 }
515
516 void CFWL_WidgetImp::SetEventKey(uint32_t key) {
517 m_nEventKey = key;
518 }
519
509 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, 520 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
510 IFWL_Widget* pOuter) 521 IFWL_Widget* pOuter)
511 : m_pProperties(new CFWL_WidgetImpProperties), 522 : m_pProperties(new CFWL_WidgetImpProperties),
512 m_pPrivateData(NULL), 523 m_pPrivateData(NULL),
513 m_pDelegate(NULL), 524 m_pDelegate(NULL),
514 m_pCurDelegate(NULL), 525 m_pCurDelegate(NULL),
515 m_pOuter(pOuter), 526 m_pOuter(pOuter),
516 m_pInterface(NULL), 527 m_pInterface(NULL),
517 m_iLock(0) { 528 m_iLock(0),
529 m_nEventKey(0) {
518 *m_pProperties = properties; 530 *m_pProperties = properties;
519 m_pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 531 m_pWidgetMgr = CFWL_WidgetMgr::GetInstance();
520 ASSERT(m_pWidgetMgr != NULL); 532 ASSERT(m_pWidgetMgr != NULL);
521 } 533 }
522 CFWL_WidgetImp::~CFWL_WidgetImp() { 534 CFWL_WidgetImp::~CFWL_WidgetImp() {
523 if (m_pPrivateData) { 535 if (m_pPrivateData) {
524 delete m_pPrivateData; 536 delete m_pPrivateData;
525 m_pPrivateData = NULL; 537 m_pPrivateData = NULL;
526 } 538 }
527 if (m_pProperties) { 539 if (m_pProperties) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 } 1035 }
1024 } 1036 }
1025 1037
1026 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} 1038 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {}
1027 1039
1028 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 1040 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
1029 const CFX_Matrix* pMatrix) { 1041 const CFX_Matrix* pMatrix) {
1030 CFWL_EvtDraw evt; 1042 CFWL_EvtDraw evt;
1031 evt.m_pGraphics = pGraphics; 1043 evt.m_pGraphics = pGraphics;
1032 } 1044 }
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