OLD | NEW |
---|---|
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> | |
11 | |
10 #include "core/fxcrt/include/fx_basic.h" | 12 #include "core/fxcrt/include/fx_basic.h" |
11 #include "core/fxcrt/include/fx_coordinates.h" | 13 #include "core/fxcrt/include/fx_coordinates.h" |
12 #include "core/fxcrt/include/fx_system.h" | 14 #include "core/fxcrt/include/fx_system.h" |
13 #include "xfa/fwl/core/fwl_error.h" | 15 #include "xfa/fwl/core/fwl_error.h" |
14 #include "xfa/fwl/core/ifwl_target.h" | 16 #include "xfa/fwl/core/fwl_widgetimp.h" |
15 | 17 |
18 // FWL contains three parallel inheritance hierarchies, which reference each | |
19 // other via pointers as follows: | |
20 // | |
21 // m_pIface m_pImpl | |
22 // CFWL_Widget ----------> IFWL_Widget ----------> CFWL_WidgetImp | |
23 // | | | | |
24 // A A A | |
25 // | | | | |
26 // CFWL_... IFWL_... CFWL_...Imp | |
27 // | |
28 | |
29 class CFWL_WidgetImp; | |
16 class CFX_Graphics; | 30 class CFX_Graphics; |
31 class IFWL_App; | |
17 class IFWL_DataProvider; | 32 class IFWL_DataProvider; |
18 class IFWL_Form; | 33 class IFWL_Form; |
19 class IFWL_Thread; | |
20 class IFWL_ThemeProvider; | 34 class IFWL_ThemeProvider; |
21 class IFWL_WidgetDelegate; | 35 class IFWL_WidgetDelegate; |
22 | 36 |
23 class IFWL_Widget : public IFWL_Target { | 37 class IFWL_Widget { |
24 public: | 38 public: |
39 IFWL_Widget() : m_pImpl(nullptr) {} | |
40 virtual ~IFWL_Widget(); | |
41 | |
25 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 42 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
26 FWL_ERR GetGlobalRect(CFX_RectF& rect); | 43 FWL_ERR GetGlobalRect(CFX_RectF& rect); |
27 FWL_ERR SetWidgetRect(const CFX_RectF& rect); | 44 FWL_ERR SetWidgetRect(const CFX_RectF& rect); |
28 FWL_ERR GetClientRect(CFX_RectF& rect); | 45 FWL_ERR GetClientRect(CFX_RectF& rect); |
29 IFWL_Widget* GetParent(); | 46 IFWL_Widget* GetParent(); |
30 FWL_ERR SetParent(IFWL_Widget* pParent); | 47 FWL_ERR SetParent(IFWL_Widget* pParent); |
31 IFWL_Widget* GetOwner(); | 48 IFWL_Widget* GetOwner(); |
32 FWL_ERR SetOwner(IFWL_Widget* pOwner); | 49 FWL_ERR SetOwner(IFWL_Widget* pOwner); |
33 IFWL_Widget* GetOuter(); | 50 IFWL_Widget* GetOuter(); |
34 uint32_t GetStyles(); | 51 uint32_t GetStyles(); |
(...skipping 12 matching lines...) Expand all Loading... | |
47 uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy); | 64 uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy); |
48 FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); | 65 FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); |
49 FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); | 66 FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); |
50 FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); | 67 FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); |
51 FWL_ERR SetMatrix(const CFX_Matrix& matrix); | 68 FWL_ERR SetMatrix(const CFX_Matrix& matrix); |
52 FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); | 69 FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); |
53 IFWL_ThemeProvider* GetThemeProvider(); | 70 IFWL_ThemeProvider* GetThemeProvider(); |
54 FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 71 FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
55 FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); | 72 FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); |
56 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); | 73 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); |
57 IFWL_Thread* GetOwnerThread() const; | 74 IFWL_App* GetOwnerApp() const; |
58 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); | 75 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); |
76 | |
77 // These call into equivalent polymorphic methods of m_pImpl. There | |
78 // should be no need to override these in subclasses. | |
79 FWL_ERR GetClassName(CFX_WideString& wsClass) const; | |
80 uint32_t GetClassID() const; | |
81 FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | |
82 FWL_ERR Initialize(); | |
83 FWL_ERR Finalize(); | |
84 | |
85 CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); } | |
86 | |
87 protected: | |
88 void SetImpl(CFWL_WidgetImp* pImpl) { m_pImpl.reset(pImpl); } | |
Tom Sepez
2016/04/28 16:59:29
nit: comment // Takes ownership of |pImpl|.
dsinclair
2016/04/28 18:00:59
Done.
| |
89 | |
90 private: | |
91 std::unique_ptr<CFWL_WidgetImp> m_pImpl; | |
59 }; | 92 }; |
60 | 93 |
61 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ | 94 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ |
OLD | NEW |