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_CFWL_WIDGET_H_ | 7 #ifndef XFA_FWL_CFWL_WIDGET_H_ |
8 #define XFA_FWL_CFWL_WIDGET_H_ | 8 #define XFA_FWL_CFWL_WIDGET_H_ |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class IFWL_ThemeProvider; | 46 class IFWL_ThemeProvider; |
47 | 47 |
48 class CFWL_Widget : public IFWL_WidgetDelegate { | 48 class CFWL_Widget : public IFWL_WidgetDelegate { |
49 public: | 49 public: |
50 ~CFWL_Widget() override; | 50 ~CFWL_Widget() override; |
51 | 51 |
52 virtual FWL_Type GetClassID() const = 0; | 52 virtual FWL_Type GetClassID() const = 0; |
53 virtual bool IsInstance(const CFX_WideStringC& wsClass) const; | 53 virtual bool IsInstance(const CFX_WideStringC& wsClass) const; |
54 virtual CFX_RectF GetAutosizedWidgetRect(); | 54 virtual CFX_RectF GetAutosizedWidgetRect(); |
55 virtual CFX_RectF GetWidgetRect(); | 55 virtual CFX_RectF GetWidgetRect(); |
56 virtual void GetClientRect(CFX_RectF& rect); | 56 virtual CFX_RectF GetClientRect(); |
57 virtual void ModifyStylesEx(uint32_t dwStylesExAdded, | 57 virtual void ModifyStylesEx(uint32_t dwStylesExAdded, |
58 uint32_t dwStylesExRemoved); | 58 uint32_t dwStylesExRemoved); |
59 virtual void SetStates(uint32_t dwStates); | 59 virtual void SetStates(uint32_t dwStates); |
60 virtual void RemoveStates(uint32_t dwStates); | 60 virtual void RemoveStates(uint32_t dwStates); |
61 virtual void Update() = 0; | 61 virtual void Update() = 0; |
62 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); | 62 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); |
63 virtual void DrawWidget(CFX_Graphics* pGraphics, | 63 virtual void DrawWidget(CFX_Graphics* pGraphics, |
64 const CFX_Matrix* pMatrix) = 0; | 64 const CFX_Matrix* pMatrix) = 0; |
65 virtual void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 65 virtual void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
66 | 66 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
104 const CFWL_App* GetOwnerApp() const { return m_pOwnerApp; } | 104 const CFWL_App* GetOwnerApp() const { return m_pOwnerApp; } |
105 uint32_t GetEventKey() const { return m_nEventKey; } | 105 uint32_t GetEventKey() const { return m_nEventKey; } |
106 void SetEventKey(uint32_t key) { m_nEventKey = key; } | 106 void SetEventKey(uint32_t key) { m_nEventKey = key; } |
107 | 107 |
108 void* GetLayoutItem() const { return m_pLayoutItem; } | 108 void* GetLayoutItem() const { return m_pLayoutItem; } |
109 void SetLayoutItem(void* pItem) { m_pLayoutItem = pItem; } | 109 void SetLayoutItem(void* pItem) { m_pLayoutItem = pItem; } |
110 | 110 |
111 void SetFocus(bool bFocus); | 111 void SetFocus(bool bFocus); |
112 void Repaint(const CFX_RectF* pRect); | 112 void RepaintRect(const CFX_RectF& pRect); |
| 113 void Repaint(); |
113 | 114 |
114 protected: | 115 protected: |
115 CFWL_Widget(const CFWL_App* app, | 116 CFWL_Widget(const CFWL_App* app, |
116 std::unique_ptr<CFWL_WidgetProperties> properties, | 117 std::unique_ptr<CFWL_WidgetProperties> properties, |
117 CFWL_Widget* pOuter); | 118 CFWL_Widget* pOuter); |
118 | 119 |
119 bool IsEnabled() const; | 120 bool IsEnabled() const; |
120 bool IsActive() const; | 121 bool IsActive() const; |
121 bool IsLocked() const { return m_iLock > 0; } | 122 bool IsLocked() const { return m_iLock > 0; } |
122 bool HasBorder() const; | 123 bool HasBorder() const; |
123 bool HasEdge() const; | 124 bool HasEdge() const; |
124 void GetEdgeRect(CFX_RectF& rtEdge); | 125 CFX_RectF GetEdgeRect(); |
125 FX_FLOAT GetBorderSize(bool bCX); | 126 FX_FLOAT GetBorderSize(bool bCX); |
126 FX_FLOAT GetEdgeWidth(); | 127 FX_FLOAT GetEdgeWidth(); |
127 void GetRelativeRect(CFX_RectF& rect); | 128 CFX_RectF GetRelativeRect(); |
128 void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity); | 129 void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity); |
129 IFWL_ThemeProvider* GetAvailableTheme(); | 130 IFWL_ThemeProvider* GetAvailableTheme(); |
130 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, | 131 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, |
131 IFWL_ThemeProvider* pTheme, | 132 IFWL_ThemeProvider* pTheme, |
132 bool bMultiLine); | 133 bool bMultiLine); |
133 void CalcTextRect(const CFX_WideString& wsText, | 134 void CalcTextRect(const CFX_WideString& wsText, |
134 IFWL_ThemeProvider* pTheme, | 135 IFWL_ThemeProvider* pTheme, |
135 uint32_t dwTTOStyles, | 136 uint32_t dwTTOStyles, |
136 int32_t iTTOAlign, | 137 int32_t iTTOAlign, |
137 CFX_RectF& rect); | 138 CFX_RectF& rect); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 const CFX_Matrix* pMatrix); | 188 const CFX_Matrix* pMatrix); |
188 void NotifyDriver(); | 189 void NotifyDriver(); |
189 bool IsParent(CFWL_Widget* pParent); | 190 bool IsParent(CFWL_Widget* pParent); |
190 | 191 |
191 void* m_pLayoutItem; | 192 void* m_pLayoutItem; |
192 uint32_t m_nEventKey; | 193 uint32_t m_nEventKey; |
193 IFWL_WidgetDelegate* m_pDelegate; // Not owned. | 194 IFWL_WidgetDelegate* m_pDelegate; // Not owned. |
194 }; | 195 }; |
195 | 196 |
196 #endif // XFA_FWL_CFWL_WIDGET_H_ | 197 #endif // XFA_FWL_CFWL_WIDGET_H_ |
OLD | NEW |