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

Side by Side Diff: xfa/fwl/core/ifwl_widget.h

Issue 2466273003: Change IFWL_Widget to store a single delegate. (Closed)
Patch Set: Fix Mac Created 4 years, 1 month 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/ifwl_listbox.cpp ('k') | xfa/fwl/core/ifwl_widget.cpp » ('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 #ifndef XFA_FWL_CORE_IFWL_WIDGET_H_ 7 #ifndef XFA_FWL_CORE_IFWL_WIDGET_H_
8 #define XFA_FWL_CORE_IFWL_WIDGET_H_ 8 #define XFA_FWL_CORE_IFWL_WIDGET_H_
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "core/fxcrt/fx_coordinates.h" 12 #include "core/fxcrt/fx_coordinates.h"
13 #include "core/fxcrt/fx_system.h" 13 #include "core/fxcrt/fx_system.h"
14 #include "third_party/base/ptr_util.h"
14 #include "xfa/fwl/core/cfwl_event.h" 15 #include "xfa/fwl/core/cfwl_event.h"
15 #include "xfa/fwl/core/cfwl_themepart.h" 16 #include "xfa/fwl/core/cfwl_themepart.h"
16 #include "xfa/fwl/core/fwl_widgethit.h" 17 #include "xfa/fwl/core/fwl_widgethit.h"
17 #include "xfa/fwl/core/ifwl_widgetdelegate.h" 18 #include "xfa/fwl/core/ifwl_widgetdelegate.h"
18 #include "xfa/fwl/theme/cfwl_widgettp.h" 19 #include "xfa/fwl/theme/cfwl_widgettp.h"
19 20
20 // FWL contains two parallel inheritance hierarchies, which reference each 21 // FWL contains two parallel inheritance hierarchies, which reference each
21 // other via pointers as follows: 22 // other via pointers as follows:
22 // 23 //
23 // m_pAssociate 24 // m_pAssociate
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 106
106 virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); 107 virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);
107 virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); 108 virtual FWL_Error SetMatrix(const CFX_Matrix& matrix);
108 109
109 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, 110 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics,
110 const CFX_Matrix* pMatrix = nullptr); 111 const CFX_Matrix* pMatrix = nullptr);
111 112
112 virtual IFWL_ThemeProvider* GetThemeProvider(); 113 virtual IFWL_ThemeProvider* GetThemeProvider();
113 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); 114 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
114 115
115 IFWL_WidgetDelegate* GetCurrentDelegate(); 116 IFWL_WidgetDelegate* GetDelegate() const { return m_pDelegate.get(); }
116 void SetCurrentDelegate(IFWL_WidgetDelegate* pDelegate); 117 void SetDelegate(std::unique_ptr<IFWL_WidgetDelegate> delegate) {
118 m_pDelegate = std::move(delegate);
119 }
120 std::unique_ptr<IFWL_WidgetDelegate> ReleaseDelegate() {
121 return pdfium::WrapUnique<IFWL_WidgetDelegate>(m_pDelegate.release());
122 }
117 123
118 const IFWL_App* GetOwnerApp() const; 124 const IFWL_App* GetOwnerApp() const;
119 125
120 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); 126 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent);
121 127
122 uint32_t GetEventKey() const; 128 uint32_t GetEventKey() const;
123 void SetEventKey(uint32_t key); 129 void SetEventKey(uint32_t key);
124 130
125 void* GetLayoutItem() const; 131 void* GetLayoutItem() const;
126 void SetLayoutItem(void* pItem); 132 void SetLayoutItem(void* pItem);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 IFWL_ThemeProvider* pTheme, 200 IFWL_ThemeProvider* pTheme,
195 const CFX_Matrix* pMatrix = nullptr); 201 const CFX_Matrix* pMatrix = nullptr);
196 void DrawEdge(CFX_Graphics* pGraphics, 202 void DrawEdge(CFX_Graphics* pGraphics,
197 CFWL_Part iPartEdge, 203 CFWL_Part iPartEdge,
198 IFWL_ThemeProvider* pTheme, 204 IFWL_ThemeProvider* pTheme,
199 const CFX_Matrix* pMatrix = nullptr); 205 const CFX_Matrix* pMatrix = nullptr);
200 void NotifyDriver(); 206 void NotifyDriver();
201 207
202 FX_BOOL IsParent(IFWL_Widget* pParent); 208 FX_BOOL IsParent(IFWL_Widget* pParent);
203 209
204 void SetDelegate(std::unique_ptr<IFWL_WidgetDelegate> delegate) {
205 m_pDelegate = std::move(delegate);
206 }
207 IFWL_WidgetDelegate* GetDelegate() const { return m_pDelegate.get(); }
208
209 const IFWL_App* const m_pOwnerApp; 210 const IFWL_App* const m_pOwnerApp;
210 CFWL_WidgetMgr* const m_pWidgetMgr; 211 CFWL_WidgetMgr* const m_pWidgetMgr;
211 std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties; 212 std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties;
212 IFWL_WidgetDelegate* m_pCurDelegate; // Not owned.
213 IFWL_Widget* m_pOuter; 213 IFWL_Widget* m_pOuter;
214 void* m_pLayoutItem; 214 void* m_pLayoutItem;
215 CFWL_Widget* m_pAssociate; 215 CFWL_Widget* m_pAssociate;
216 int32_t m_iLock; 216 int32_t m_iLock;
217 uint32_t m_nEventKey; 217 uint32_t m_nEventKey;
218 218
219 private: 219 private:
220 std::unique_ptr<IFWL_WidgetDelegate> m_pDelegate; 220 std::unique_ptr<IFWL_WidgetDelegate> m_pDelegate;
221 }; 221 };
222 222
223 class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate { 223 class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate {
224 public: 224 public:
225 CFWL_WidgetImpDelegate(); 225 CFWL_WidgetImpDelegate();
226 ~CFWL_WidgetImpDelegate() override {} 226 ~CFWL_WidgetImpDelegate() override {}
227 void OnProcessMessage(CFWL_Message* pMessage) override; 227 void OnProcessMessage(CFWL_Message* pMessage) override;
228 void OnProcessEvent(CFWL_Event* pEvent) override; 228 void OnProcessEvent(CFWL_Event* pEvent) override;
229 void OnDrawWidget(CFX_Graphics* pGraphics, 229 void OnDrawWidget(CFX_Graphics* pGraphics,
230 const CFX_Matrix* pMatrix = nullptr) override; 230 const CFX_Matrix* pMatrix = nullptr) override;
231 }; 231 };
232 232
233 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ 233 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_listbox.cpp ('k') | xfa/fwl/core/ifwl_widget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698