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

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

Issue 2464703006: Fold IFWL*::{Initialize|Finalize} into constructor/destructor (Closed)
Patch Set: Rebase to master 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
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>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 class IFWL_App; 59 class IFWL_App;
60 class IFWL_DataProvider; 60 class IFWL_DataProvider;
61 class IFWL_ThemeProvider; 61 class IFWL_ThemeProvider;
62 class IFWL_Widget; 62 class IFWL_Widget;
63 enum class FWL_Type; 63 enum class FWL_Type;
64 64
65 class IFWL_Widget { 65 class IFWL_Widget {
66 public: 66 public:
67 virtual ~IFWL_Widget(); 67 virtual ~IFWL_Widget();
68 68
69 virtual void Initialize();
70 virtual void Finalize();
71 virtual FWL_Type GetClassID() const = 0; 69 virtual FWL_Type GetClassID() const = 0;
72 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; 70 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
73 71
74 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); 72 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
75 virtual FWL_Error GetGlobalRect(CFX_RectF& rect); 73 virtual FWL_Error GetGlobalRect(CFX_RectF& rect);
76 virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); 74 virtual FWL_Error SetWidgetRect(const CFX_RectF& rect);
77 virtual FWL_Error GetClientRect(CFX_RectF& rect); 75 virtual FWL_Error GetClientRect(CFX_RectF& rect);
78 76
79 virtual IFWL_Widget* GetParent(); 77 virtual IFWL_Widget* GetParent();
80 virtual FWL_Error SetParent(IFWL_Widget* pParent); 78 virtual FWL_Error SetParent(IFWL_Widget* pParent);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 IFWL_ThemeProvider* pTheme, 194 IFWL_ThemeProvider* pTheme,
197 const CFX_Matrix* pMatrix = nullptr); 195 const CFX_Matrix* pMatrix = nullptr);
198 void DrawEdge(CFX_Graphics* pGraphics, 196 void DrawEdge(CFX_Graphics* pGraphics,
199 CFWL_Part iPartEdge, 197 CFWL_Part iPartEdge,
200 IFWL_ThemeProvider* pTheme, 198 IFWL_ThemeProvider* pTheme,
201 const CFX_Matrix* pMatrix = nullptr); 199 const CFX_Matrix* pMatrix = nullptr);
202 void NotifyDriver(); 200 void NotifyDriver();
203 201
204 FX_BOOL IsParent(IFWL_Widget* pParent); 202 FX_BOOL IsParent(IFWL_Widget* pParent);
205 203
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
206 const IFWL_App* const m_pOwnerApp; 209 const IFWL_App* const m_pOwnerApp;
207 CFWL_WidgetMgr* const m_pWidgetMgr; 210 CFWL_WidgetMgr* const m_pWidgetMgr;
208 std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties; 211 std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties;
209 IFWL_WidgetDelegate* m_pDelegate; 212 IFWL_WidgetDelegate* m_pCurDelegate; // Not owned.
210 IFWL_WidgetDelegate* m_pCurDelegate;
211 IFWL_Widget* m_pOuter; 213 IFWL_Widget* m_pOuter;
212 void* m_pLayoutItem; 214 void* m_pLayoutItem;
213 CFWL_Widget* m_pAssociate; 215 CFWL_Widget* m_pAssociate;
214 int32_t m_iLock; 216 int32_t m_iLock;
215 uint32_t m_nEventKey; 217 uint32_t m_nEventKey;
218
219 private:
220 std::unique_ptr<IFWL_WidgetDelegate> m_pDelegate;
216 }; 221 };
217 222
218 class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate { 223 class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate {
219 public: 224 public:
220 CFWL_WidgetImpDelegate(); 225 CFWL_WidgetImpDelegate();
221 ~CFWL_WidgetImpDelegate() override {} 226 ~CFWL_WidgetImpDelegate() override {}
222 void OnProcessMessage(CFWL_Message* pMessage) override; 227 void OnProcessMessage(CFWL_Message* pMessage) override;
223 void OnProcessEvent(CFWL_Event* pEvent) override; 228 void OnProcessEvent(CFWL_Event* pEvent) override;
224 void OnDrawWidget(CFX_Graphics* pGraphics, 229 void OnDrawWidget(CFX_Graphics* pGraphics,
225 const CFX_Matrix* pMatrix = nullptr) override; 230 const CFX_Matrix* pMatrix = nullptr) override;
226 }; 231 };
227 232
228 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ 233 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698