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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 : public IFWL_WidgetDelegate { | 65 class IFWL_Widget : public IFWL_WidgetDelegate { |
66 public: | 66 public: |
67 ~IFWL_Widget() override; | 67 ~IFWL_Widget() override; |
68 | 68 |
69 virtual FWL_Type GetClassID() const = 0; | 69 virtual FWL_Type GetClassID() const = 0; |
70 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | 70 virtual bool IsInstance(const CFX_WideStringC& wsClass) const; |
71 | 71 |
72 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 72 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); |
73 virtual FWL_Error GetGlobalRect(CFX_RectF& rect); | 73 virtual FWL_Error GetGlobalRect(CFX_RectF& rect); |
74 virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); | 74 virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); |
75 virtual FWL_Error GetClientRect(CFX_RectF& rect); | 75 virtual FWL_Error GetClientRect(CFX_RectF& rect); |
76 | 76 |
77 virtual IFWL_Widget* GetParent(); | 77 virtual IFWL_Widget* GetParent(); |
78 virtual FWL_Error SetParent(IFWL_Widget* pParent); | 78 virtual FWL_Error SetParent(IFWL_Widget* pParent); |
79 | 79 |
80 virtual IFWL_Widget* GetOwner(); | 80 virtual IFWL_Widget* GetOwner(); |
81 virtual FWL_Error SetOwner(IFWL_Widget* pOwner); | 81 virtual FWL_Error SetOwner(IFWL_Widget* pOwner); |
82 | 82 |
83 virtual IFWL_Widget* GetOuter(); | 83 virtual IFWL_Widget* GetOuter(); |
84 | 84 |
85 virtual uint32_t GetStyles(); | 85 virtual uint32_t GetStyles(); |
86 virtual FWL_Error ModifyStyles(uint32_t dwStylesAdded, | 86 virtual FWL_Error ModifyStyles(uint32_t dwStylesAdded, |
87 uint32_t dwStylesRemoved); | 87 uint32_t dwStylesRemoved); |
88 virtual uint32_t GetStylesEx(); | 88 virtual uint32_t GetStylesEx(); |
89 virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, | 89 virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, |
90 uint32_t dwStylesExRemoved); | 90 uint32_t dwStylesExRemoved); |
91 | 91 |
92 virtual uint32_t GetStates(); | 92 virtual uint32_t GetStates(); |
93 virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); | 93 virtual void SetStates(uint32_t dwStates, bool bSet = true); |
94 | 94 |
95 virtual FWL_Error Update(); | 95 virtual FWL_Error Update(); |
96 virtual FWL_Error LockUpdate(); | 96 virtual FWL_Error LockUpdate(); |
97 virtual FWL_Error UnlockUpdate(); | 97 virtual FWL_Error UnlockUpdate(); |
98 | 98 |
99 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); | 99 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); |
100 | 100 |
101 virtual FWL_Error TransformTo(IFWL_Widget* pWidget, | 101 virtual FWL_Error TransformTo(IFWL_Widget* pWidget, |
102 FX_FLOAT& fx, | 102 FX_FLOAT& fx, |
103 FX_FLOAT& fy); | 103 FX_FLOAT& fy); |
104 virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); | 104 virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); |
105 | 105 |
106 virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); | 106 virtual FWL_Error GetMatrix(CFX_Matrix& matrix, bool bGlobal = false); |
107 virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); | 107 virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); |
108 | 108 |
109 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 109 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
110 const CFX_Matrix* pMatrix = nullptr); | 110 const CFX_Matrix* pMatrix = nullptr); |
111 | 111 |
112 virtual IFWL_ThemeProvider* GetThemeProvider(); | 112 virtual IFWL_ThemeProvider* GetThemeProvider(); |
113 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 113 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
114 | 114 |
115 void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; } | 115 void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; } |
116 IFWL_WidgetDelegate* GetDelegate() { | 116 IFWL_WidgetDelegate* GetDelegate() { |
(...skipping 14 matching lines...) Expand all Loading... |
131 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); | 131 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); |
132 | 132 |
133 uint32_t GetEventKey() const; | 133 uint32_t GetEventKey() const; |
134 void SetEventKey(uint32_t key); | 134 void SetEventKey(uint32_t key); |
135 | 135 |
136 void* GetLayoutItem() const; | 136 void* GetLayoutItem() const; |
137 void SetLayoutItem(void* pItem); | 137 void SetLayoutItem(void* pItem); |
138 | 138 |
139 void SetAssociateWidget(CFWL_Widget* pAssociate); | 139 void SetAssociateWidget(CFWL_Widget* pAssociate); |
140 | 140 |
141 void SetFocus(FX_BOOL bFocus); | 141 void SetFocus(bool bFocus); |
142 void Repaint(const CFX_RectF* pRect = nullptr); | 142 void Repaint(const CFX_RectF* pRect = nullptr); |
143 | 143 |
144 protected: | 144 protected: |
145 friend class CFWL_WidgetImpDelegate; | 145 friend class CFWL_WidgetImpDelegate; |
146 | 146 |
147 IFWL_Widget(const IFWL_App* app, | 147 IFWL_Widget(const IFWL_App* app, |
148 const CFWL_WidgetImpProperties& properties, | 148 const CFWL_WidgetImpProperties& properties, |
149 IFWL_Widget* pOuter); | 149 IFWL_Widget* pOuter); |
150 | 150 |
151 FX_BOOL IsEnabled() const; | 151 bool IsEnabled() const; |
152 FX_BOOL IsVisible() const; | 152 bool IsVisible() const; |
153 FX_BOOL IsActive() const; | 153 bool IsActive() const; |
154 FX_BOOL IsOverLapper() const; | 154 bool IsOverLapper() const; |
155 FX_BOOL IsPopup() const; | 155 bool IsPopup() const; |
156 FX_BOOL IsChild() const; | 156 bool IsChild() const; |
157 FX_BOOL IsLocked() const; | 157 bool IsLocked() const; |
158 FX_BOOL IsOffscreen() const; | 158 bool IsOffscreen() const; |
159 FX_BOOL HasBorder() const; | 159 bool HasBorder() const; |
160 FX_BOOL HasEdge() const; | 160 bool HasEdge() const; |
161 void GetEdgeRect(CFX_RectF& rtEdge); | 161 void GetEdgeRect(CFX_RectF& rtEdge); |
162 FX_FLOAT GetBorderSize(FX_BOOL bCX = TRUE); | 162 FX_FLOAT GetBorderSize(bool bCX = true); |
163 FX_FLOAT GetEdgeWidth(); | 163 FX_FLOAT GetEdgeWidth(); |
164 void GetRelativeRect(CFX_RectF& rect); | 164 void GetRelativeRect(CFX_RectF& rect); |
165 void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity); | 165 void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity); |
166 IFWL_ThemeProvider* GetAvailableTheme(); | 166 IFWL_ThemeProvider* GetAvailableTheme(); |
167 IFWL_Widget* GetRootOuter(); | 167 IFWL_Widget* GetRootOuter(); |
168 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, | 168 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, |
169 IFWL_ThemeProvider* pTheme, | 169 IFWL_ThemeProvider* pTheme, |
170 FX_BOOL bMultiLine = FALSE, | 170 bool bMultiLine = false, |
171 int32_t iLineWidth = -1); | 171 int32_t iLineWidth = -1); |
172 void CalcTextRect(const CFX_WideString& wsText, | 172 void CalcTextRect(const CFX_WideString& wsText, |
173 IFWL_ThemeProvider* pTheme, | 173 IFWL_ThemeProvider* pTheme, |
174 uint32_t dwTTOStyles, | 174 uint32_t dwTTOStyles, |
175 int32_t iTTOAlign, | 175 int32_t iTTOAlign, |
176 CFX_RectF& rect); | 176 CFX_RectF& rect); |
177 void SetGrab(FX_BOOL bSet); | 177 void SetGrab(bool bSet); |
178 FX_BOOL GetPopupPos(FX_FLOAT fMinHeight, | 178 bool GetPopupPos(FX_FLOAT fMinHeight, |
179 FX_FLOAT fMaxHeight, | 179 FX_FLOAT fMaxHeight, |
180 const CFX_RectF& rtAnchor, | 180 const CFX_RectF& rtAnchor, |
181 CFX_RectF& rtPopup); | 181 CFX_RectF& rtPopup); |
182 FX_BOOL GetPopupPosMenu(FX_FLOAT fMinHeight, | 182 bool GetPopupPosMenu(FX_FLOAT fMinHeight, |
| 183 FX_FLOAT fMaxHeight, |
| 184 const CFX_RectF& rtAnchor, |
| 185 CFX_RectF& rtPopup); |
| 186 bool GetPopupPosComboBox(FX_FLOAT fMinHeight, |
| 187 FX_FLOAT fMaxHeight, |
| 188 const CFX_RectF& rtAnchor, |
| 189 CFX_RectF& rtPopup); |
| 190 bool GetPopupPosGeneral(FX_FLOAT fMinHeight, |
183 FX_FLOAT fMaxHeight, | 191 FX_FLOAT fMaxHeight, |
184 const CFX_RectF& rtAnchor, | 192 const CFX_RectF& rtAnchor, |
185 CFX_RectF& rtPopup); | 193 CFX_RectF& rtPopup); |
186 FX_BOOL GetPopupPosComboBox(FX_FLOAT fMinHeight, | 194 bool GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy); |
187 FX_FLOAT fMaxHeight, | |
188 const CFX_RectF& rtAnchor, | |
189 CFX_RectF& rtPopup); | |
190 FX_BOOL GetPopupPosGeneral(FX_FLOAT fMinHeight, | |
191 FX_FLOAT fMaxHeight, | |
192 const CFX_RectF& rtAnchor, | |
193 CFX_RectF& rtPopup); | |
194 FX_BOOL GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy); | |
195 void RegisterEventTarget(IFWL_Widget* pEventSource = nullptr, | 195 void RegisterEventTarget(IFWL_Widget* pEventSource = nullptr, |
196 uint32_t dwFilter = FWL_EVENT_ALL_MASK); | 196 uint32_t dwFilter = FWL_EVENT_ALL_MASK); |
197 void UnregisterEventTarget(); | 197 void UnregisterEventTarget(); |
198 void DispatchKeyEvent(CFWL_MsgKey* pNote); | 198 void DispatchKeyEvent(CFWL_MsgKey* pNote); |
199 void DispatchEvent(CFWL_Event* pEvent); | 199 void DispatchEvent(CFWL_Event* pEvent); |
200 void DrawBackground(CFX_Graphics* pGraphics, | 200 void DrawBackground(CFX_Graphics* pGraphics, |
201 CFWL_Part iPartBk, | 201 CFWL_Part iPartBk, |
202 IFWL_ThemeProvider* pTheme, | 202 IFWL_ThemeProvider* pTheme, |
203 const CFX_Matrix* pMatrix = nullptr); | 203 const CFX_Matrix* pMatrix = nullptr); |
204 void DrawBorder(CFX_Graphics* pGraphics, | 204 void DrawBorder(CFX_Graphics* pGraphics, |
205 CFWL_Part iPartBorder, | 205 CFWL_Part iPartBorder, |
206 IFWL_ThemeProvider* pTheme, | 206 IFWL_ThemeProvider* pTheme, |
207 const CFX_Matrix* pMatrix = nullptr); | 207 const CFX_Matrix* pMatrix = nullptr); |
208 void DrawEdge(CFX_Graphics* pGraphics, | 208 void DrawEdge(CFX_Graphics* pGraphics, |
209 CFWL_Part iPartEdge, | 209 CFWL_Part iPartEdge, |
210 IFWL_ThemeProvider* pTheme, | 210 IFWL_ThemeProvider* pTheme, |
211 const CFX_Matrix* pMatrix = nullptr); | 211 const CFX_Matrix* pMatrix = nullptr); |
212 void NotifyDriver(); | 212 void NotifyDriver(); |
213 | 213 |
214 FX_BOOL IsParent(IFWL_Widget* pParent); | 214 bool IsParent(IFWL_Widget* pParent); |
215 | 215 |
216 const IFWL_App* const m_pOwnerApp; | 216 const IFWL_App* const m_pOwnerApp; |
217 CFWL_WidgetMgr* const m_pWidgetMgr; | 217 CFWL_WidgetMgr* const m_pWidgetMgr; |
218 std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties; | 218 std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties; |
219 IFWL_Widget* m_pOuter; | 219 IFWL_Widget* m_pOuter; |
220 void* m_pLayoutItem; | 220 void* m_pLayoutItem; |
221 CFWL_Widget* m_pAssociate; | 221 CFWL_Widget* m_pAssociate; |
222 int32_t m_iLock; | 222 int32_t m_iLock; |
223 uint32_t m_nEventKey; | 223 uint32_t m_nEventKey; |
224 | 224 |
225 private: | 225 private: |
226 IFWL_WidgetDelegate* m_pDelegate; // Not owned. | 226 IFWL_WidgetDelegate* m_pDelegate; // Not owned. |
227 }; | 227 }; |
228 | 228 |
229 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ | 229 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ |
OLD | NEW |