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> | 10 #include <memory> |
(...skipping 21 matching lines...) Expand all Loading... |
32 class IFWL_DataProvider; | 32 class IFWL_DataProvider; |
33 class IFWL_Form; | 33 class IFWL_Form; |
34 class IFWL_ThemeProvider; | 34 class IFWL_ThemeProvider; |
35 class IFWL_WidgetDelegate; | 35 class IFWL_WidgetDelegate; |
36 | 36 |
37 class IFWL_Widget { | 37 class IFWL_Widget { |
38 public: | 38 public: |
39 IFWL_Widget() : m_pImpl(nullptr) {} | 39 IFWL_Widget() : m_pImpl(nullptr) {} |
40 virtual ~IFWL_Widget(); | 40 virtual ~IFWL_Widget(); |
41 | 41 |
42 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 42 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
43 FWL_ERR GetGlobalRect(CFX_RectF& rect); | 43 FWL_Error GetGlobalRect(CFX_RectF& rect); |
44 FWL_ERR SetWidgetRect(const CFX_RectF& rect); | 44 FWL_Error SetWidgetRect(const CFX_RectF& rect); |
45 FWL_ERR GetClientRect(CFX_RectF& rect); | 45 FWL_Error GetClientRect(CFX_RectF& rect); |
46 IFWL_Widget* GetParent(); | 46 IFWL_Widget* GetParent(); |
47 FWL_ERR SetParent(IFWL_Widget* pParent); | 47 FWL_Error SetParent(IFWL_Widget* pParent); |
48 IFWL_Widget* GetOwner(); | 48 IFWL_Widget* GetOwner(); |
49 FWL_ERR SetOwner(IFWL_Widget* pOwner); | 49 FWL_Error SetOwner(IFWL_Widget* pOwner); |
50 IFWL_Widget* GetOuter(); | 50 IFWL_Widget* GetOuter(); |
51 uint32_t GetStyles(); | 51 uint32_t GetStyles(); |
52 FWL_ERR ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); | 52 FWL_Error ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); |
53 uint32_t GetStylesEx(); | 53 uint32_t GetStylesEx(); |
54 FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); | 54 FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, |
| 55 uint32_t dwStylesExRemoved); |
55 uint32_t GetStates(); | 56 uint32_t GetStates(); |
56 FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); | 57 FWL_Error SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); |
57 FWL_ERR SetPrivateData(void* module_id, | 58 FWL_Error SetPrivateData(void* module_id, |
58 void* pData, | 59 void* pData, |
59 PD_CALLBACK_FREEDATA callback); | 60 PD_CALLBACK_FREEDATA callback); |
60 void* GetPrivateData(void* module_id); | 61 void* GetPrivateData(void* module_id); |
61 FWL_ERR Update(); | 62 FWL_Error Update(); |
62 FWL_ERR LockUpdate(); | 63 FWL_Error LockUpdate(); |
63 FWL_ERR UnlockUpdate(); | 64 FWL_Error UnlockUpdate(); |
64 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); | 65 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); |
65 FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); | 66 FWL_Error TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); |
66 FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); | 67 FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); |
67 FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); | 68 FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); |
68 FWL_ERR SetMatrix(const CFX_Matrix& matrix); | 69 FWL_Error SetMatrix(const CFX_Matrix& matrix); |
69 FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); | 70 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 71 const CFX_Matrix* pMatrix = NULL); |
70 IFWL_ThemeProvider* GetThemeProvider(); | 72 IFWL_ThemeProvider* GetThemeProvider(); |
71 FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 73 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
72 FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); | 74 FWL_Error SetDataProvider(IFWL_DataProvider* pDataProvider); |
73 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); | 75 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); |
74 IFWL_App* GetOwnerApp() const; | 76 IFWL_App* GetOwnerApp() const; |
75 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); | 77 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); |
76 | 78 |
77 // These call into equivalent polymorphic methods of m_pImpl. There | 79 // These call into equivalent polymorphic methods of m_pImpl. There |
78 // should be no need to override these in subclasses. | 80 // should be no need to override these in subclasses. |
79 FWL_ERR GetClassName(CFX_WideString& wsClass) const; | 81 FWL_Error GetClassName(CFX_WideString& wsClass) const; |
80 uint32_t GetClassID() const; | 82 uint32_t GetClassID() const; |
81 FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | 83 FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; |
82 FWL_ERR Initialize(); | 84 FWL_Error Initialize(); |
83 FWL_ERR Finalize(); | 85 FWL_Error Finalize(); |
84 | 86 |
85 CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); } | 87 CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); } |
86 | 88 |
87 protected: | 89 protected: |
88 // Takes ownership of |pImpl|. | 90 // Takes ownership of |pImpl|. |
89 void SetImpl(CFWL_WidgetImp* pImpl) { m_pImpl.reset(pImpl); } | 91 void SetImpl(CFWL_WidgetImp* pImpl) { m_pImpl.reset(pImpl); } |
90 | 92 |
91 private: | 93 private: |
92 std::unique_ptr<CFWL_WidgetImp> m_pImpl; | 94 std::unique_ptr<CFWL_WidgetImp> m_pImpl; |
93 }; | 95 }; |
94 | 96 |
95 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ | 97 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ |
OLD | NEW |