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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 FWL_Error Initialize(); | 69 virtual void Initialize(); |
70 virtual void Finalize(); | 70 virtual void Finalize(); |
71 virtual FWL_Type GetClassID() const = 0; | 71 virtual FWL_Type GetClassID() const = 0; |
72 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | 72 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; |
73 | 73 |
74 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 74 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
75 virtual FWL_Error GetGlobalRect(CFX_RectF& rect); | 75 virtual FWL_Error GetGlobalRect(CFX_RectF& rect); |
76 virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); | 76 virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); |
77 virtual FWL_Error GetClientRect(CFX_RectF& rect); | 77 virtual FWL_Error GetClientRect(CFX_RectF& rect); |
78 | 78 |
79 virtual IFWL_Widget* GetParent(); | 79 virtual IFWL_Widget* GetParent(); |
(...skipping 27 matching lines...) Expand all Loading... | |
107 | 107 |
108 virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); | 108 virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); |
109 virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); | 109 virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); |
110 | 110 |
111 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 111 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
112 const CFX_Matrix* pMatrix = nullptr); | 112 const CFX_Matrix* pMatrix = nullptr); |
113 | 113 |
114 virtual IFWL_ThemeProvider* GetThemeProvider(); | 114 virtual IFWL_ThemeProvider* GetThemeProvider(); |
115 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 115 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
116 virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); | 116 virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); |
117 virtual IFWL_App* GetOwnerApp() const; | |
118 | 117 |
119 FWL_Error SetOwnerApp(IFWL_App* pOwnerApp); | 118 const IFWL_App* GetOwnerApp() const; |
119 | |
120 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); | 120 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); |
121 | 121 |
122 uint32_t GetEventKey() const; | 122 uint32_t GetEventKey() const; |
123 void SetEventKey(uint32_t key); | 123 void SetEventKey(uint32_t key); |
124 | 124 |
125 void* GetLayoutItem() const; | 125 void* GetLayoutItem() const; |
126 void SetLayoutItem(void* pItem); | 126 void SetLayoutItem(void* pItem); |
127 | 127 |
128 void SetAssociateWidget(CFWL_Widget* pAssociate); | 128 void SetAssociateWidget(CFWL_Widget* pAssociate); |
129 | 129 |
130 protected: | 130 protected: |
131 friend class CFWL_WidgetImpDelegate; | 131 friend class CFWL_WidgetImpDelegate; |
132 | 132 |
133 IFWL_Widget(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); | 133 IFWL_Widget(const IFWL_App* app, |
134 const CFWL_WidgetImpProperties& properties, | |
135 IFWL_Widget* pOuter); | |
134 | 136 |
135 FX_BOOL IsEnabled() const; | 137 FX_BOOL IsEnabled() const; |
136 FX_BOOL IsVisible() const; | 138 FX_BOOL IsVisible() const; |
137 FX_BOOL IsActive() const; | 139 FX_BOOL IsActive() const; |
138 FX_BOOL IsOverLapper() const; | 140 FX_BOOL IsOverLapper() const; |
139 FX_BOOL IsPopup() const; | 141 FX_BOOL IsPopup() const; |
140 FX_BOOL IsChild() const; | 142 FX_BOOL IsChild() const; |
141 FX_BOOL IsLocked() const; | 143 FX_BOOL IsLocked() const; |
142 FX_BOOL IsOffscreen() const; | 144 FX_BOOL IsOffscreen() const; |
143 FX_BOOL HasBorder() const; | 145 FX_BOOL HasBorder() const; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 IFWL_ThemeProvider* pTheme, | 194 IFWL_ThemeProvider* pTheme, |
193 const CFX_Matrix* pMatrix = nullptr); | 195 const CFX_Matrix* pMatrix = nullptr); |
194 void DrawEdge(CFX_Graphics* pGraphics, | 196 void DrawEdge(CFX_Graphics* pGraphics, |
195 CFWL_Part iPartEdge, | 197 CFWL_Part iPartEdge, |
196 IFWL_ThemeProvider* pTheme, | 198 IFWL_ThemeProvider* pTheme, |
197 const CFX_Matrix* pMatrix = nullptr); | 199 const CFX_Matrix* pMatrix = nullptr); |
198 void NotifyDriver(); | 200 void NotifyDriver(); |
199 | 201 |
200 FX_BOOL IsParent(IFWL_Widget* pParent); | 202 FX_BOOL IsParent(IFWL_Widget* pParent); |
201 | 203 |
204 const IFWL_App* m_pOwnerApp; | |
Tom Sepez
2016/10/28 23:11:47
nit: is this const IFWL_App* const m_pOwnerApp; ?
dsinclair
2016/10/31 14:13:18
Done. C++, just add const before every symbol ..
| |
202 CFWL_WidgetMgr* const m_pWidgetMgr; | 205 CFWL_WidgetMgr* const m_pWidgetMgr; |
203 IFWL_App* m_pOwnerApp; | |
204 std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties; | 206 std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties; |
205 IFWL_WidgetDelegate* m_pDelegate; | 207 IFWL_WidgetDelegate* m_pDelegate; |
206 IFWL_WidgetDelegate* m_pCurDelegate; | 208 IFWL_WidgetDelegate* m_pCurDelegate; |
207 IFWL_Widget* m_pOuter; | 209 IFWL_Widget* m_pOuter; |
208 void* m_pLayoutItem; | 210 void* m_pLayoutItem; |
209 CFWL_Widget* m_pAssociate; | 211 CFWL_Widget* m_pAssociate; |
210 int32_t m_iLock; | 212 int32_t m_iLock; |
211 uint32_t m_nEventKey; | 213 uint32_t m_nEventKey; |
212 }; | 214 }; |
213 | 215 |
214 class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate { | 216 class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate { |
215 public: | 217 public: |
216 CFWL_WidgetImpDelegate(); | 218 CFWL_WidgetImpDelegate(); |
217 ~CFWL_WidgetImpDelegate() override {} | 219 ~CFWL_WidgetImpDelegate() override {} |
218 void OnProcessMessage(CFWL_Message* pMessage) override; | 220 void OnProcessMessage(CFWL_Message* pMessage) override; |
219 void OnProcessEvent(CFWL_Event* pEvent) override; | 221 void OnProcessEvent(CFWL_Event* pEvent) override; |
220 void OnDrawWidget(CFX_Graphics* pGraphics, | 222 void OnDrawWidget(CFX_Graphics* pGraphics, |
221 const CFX_Matrix* pMatrix = nullptr) override; | 223 const CFX_Matrix* pMatrix = nullptr) override; |
222 }; | 224 }; |
223 | 225 |
224 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ | 226 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ |
OLD | NEW |