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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 ScrollBar, | 50 ScrollBar, |
51 SpinButton, | 51 SpinButton, |
52 ToolTip | 52 ToolTip |
53 }; | 53 }; |
54 | 54 |
55 class CFWL_AppImp; | 55 class CFWL_AppImp; |
56 class CFWL_MsgKey; | 56 class CFWL_MsgKey; |
57 class CFWL_Widget; | 57 class CFWL_Widget; |
58 class CFWL_WidgetProperties; | 58 class CFWL_WidgetProperties; |
59 class CFWL_WidgetMgr; | 59 class CFWL_WidgetMgr; |
60 class IFWL_App; | 60 class CFWL_App; |
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 : public IFWL_WidgetDelegate { | 65 class IFWL_Widget : public IFWL_WidgetDelegate { |
66 public: | 66 public: |
67 class DataProvider {}; | 67 class DataProvider {}; |
68 | 68 |
69 ~IFWL_Widget() override; | 69 ~IFWL_Widget() override; |
70 | 70 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 IFWL_Widget::DataProvider* GetDataProvider() const; | 111 IFWL_Widget::DataProvider* GetDataProvider() const; |
112 | 112 |
113 void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; } | 113 void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; } |
114 IFWL_WidgetDelegate* GetDelegate() { | 114 IFWL_WidgetDelegate* GetDelegate() { |
115 return m_pDelegate ? m_pDelegate : this; | 115 return m_pDelegate ? m_pDelegate : this; |
116 } | 116 } |
117 const IFWL_WidgetDelegate* GetDelegate() const { | 117 const IFWL_WidgetDelegate* GetDelegate() const { |
118 return m_pDelegate ? m_pDelegate : this; | 118 return m_pDelegate ? m_pDelegate : this; |
119 } | 119 } |
120 | 120 |
121 const IFWL_App* GetOwnerApp() const { return m_pOwnerApp; } | 121 const CFWL_App* GetOwnerApp() const { return m_pOwnerApp; } |
122 uint32_t GetEventKey() const { return m_nEventKey; } | 122 uint32_t GetEventKey() const { return m_nEventKey; } |
123 void SetEventKey(uint32_t key) { m_nEventKey = key; } | 123 void SetEventKey(uint32_t key) { m_nEventKey = key; } |
124 | 124 |
125 void* GetLayoutItem() const { return m_pLayoutItem; } | 125 void* GetLayoutItem() const { return m_pLayoutItem; } |
126 void SetLayoutItem(void* pItem) { m_pLayoutItem = pItem; } | 126 void SetLayoutItem(void* pItem) { m_pLayoutItem = pItem; } |
127 | 127 |
128 void SetAssociateWidget(CFWL_Widget* pAssociate) { | 128 void SetAssociateWidget(CFWL_Widget* pAssociate) { |
129 m_pAssociate = pAssociate; | 129 m_pAssociate = pAssociate; |
130 } | 130 } |
131 | 131 |
132 void SetFocus(bool bFocus); | 132 void SetFocus(bool bFocus); |
133 void Repaint(const CFX_RectF* pRect = nullptr); | 133 void Repaint(const CFX_RectF* pRect = nullptr); |
134 | 134 |
135 protected: | 135 protected: |
136 IFWL_Widget(const IFWL_App* app, | 136 IFWL_Widget(const CFWL_App* app, |
137 std::unique_ptr<CFWL_WidgetProperties> properties, | 137 std::unique_ptr<CFWL_WidgetProperties> properties, |
138 IFWL_Widget* pOuter); | 138 IFWL_Widget* pOuter); |
139 | 139 |
140 bool IsEnabled() const; | 140 bool IsEnabled() const; |
141 bool IsActive() const; | 141 bool IsActive() const; |
142 bool IsLocked() const { return m_iLock > 0; } | 142 bool IsLocked() const { return m_iLock > 0; } |
143 bool HasBorder() const; | 143 bool HasBorder() const; |
144 bool HasEdge() const; | 144 bool HasEdge() const; |
145 void GetEdgeRect(CFX_RectF& rtEdge); | 145 void GetEdgeRect(CFX_RectF& rtEdge); |
146 FX_FLOAT GetBorderSize(bool bCX = true); | 146 FX_FLOAT GetBorderSize(bool bCX = true); |
(...skipping 21 matching lines...) Expand all Loading... |
168 void DispatchEvent(CFWL_Event* pEvent); | 168 void DispatchEvent(CFWL_Event* pEvent); |
169 void DrawBorder(CFX_Graphics* pGraphics, | 169 void DrawBorder(CFX_Graphics* pGraphics, |
170 CFWL_Part iPartBorder, | 170 CFWL_Part iPartBorder, |
171 IFWL_ThemeProvider* pTheme, | 171 IFWL_ThemeProvider* pTheme, |
172 const CFX_Matrix* pMatrix = nullptr); | 172 const CFX_Matrix* pMatrix = nullptr); |
173 void DrawEdge(CFX_Graphics* pGraphics, | 173 void DrawEdge(CFX_Graphics* pGraphics, |
174 CFWL_Part iPartEdge, | 174 CFWL_Part iPartEdge, |
175 IFWL_ThemeProvider* pTheme, | 175 IFWL_ThemeProvider* pTheme, |
176 const CFX_Matrix* pMatrix = nullptr); | 176 const CFX_Matrix* pMatrix = nullptr); |
177 | 177 |
178 const IFWL_App* const m_pOwnerApp; | 178 const CFWL_App* const m_pOwnerApp; |
179 CFWL_WidgetMgr* const m_pWidgetMgr; | 179 CFWL_WidgetMgr* const m_pWidgetMgr; |
180 std::unique_ptr<CFWL_WidgetProperties> m_pProperties; | 180 std::unique_ptr<CFWL_WidgetProperties> m_pProperties; |
181 IFWL_Widget* m_pOuter; | 181 IFWL_Widget* m_pOuter; |
182 int32_t m_iLock; | 182 int32_t m_iLock; |
183 | 183 |
184 private: | 184 private: |
185 IFWL_Widget* GetParent() { return m_pWidgetMgr->GetParentWidget(this); } | 185 IFWL_Widget* GetParent() { return m_pWidgetMgr->GetParentWidget(this); } |
186 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); | 186 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); |
187 | 187 |
188 bool IsVisible() const; | 188 bool IsVisible() const; |
(...skipping 22 matching lines...) Expand all Loading... |
211 void NotifyDriver(); | 211 void NotifyDriver(); |
212 bool IsParent(IFWL_Widget* pParent); | 212 bool IsParent(IFWL_Widget* pParent); |
213 | 213 |
214 void* m_pLayoutItem; | 214 void* m_pLayoutItem; |
215 CFWL_Widget* m_pAssociate; | 215 CFWL_Widget* m_pAssociate; |
216 uint32_t m_nEventKey; | 216 uint32_t m_nEventKey; |
217 IFWL_WidgetDelegate* m_pDelegate; // Not owned. | 217 IFWL_WidgetDelegate* m_pDelegate; // Not owned. |
218 }; | 218 }; |
219 | 219 |
220 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ | 220 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ |
OLD | NEW |