Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: xfa/fwl/core/cfwl_widget.h

Issue 2557103002: Cleanup FWL default values part II. (Closed)
Patch Set: Unused Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_CFWL_WIDGET_H_ 7 #ifndef XFA_FWL_CORE_CFWL_WIDGET_H_
8 #define XFA_FWL_CORE_CFWL_WIDGET_H_ 8 #define XFA_FWL_CORE_CFWL_WIDGET_H_
9 #include <memory> 9 #include <memory>
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 virtual void Update() = 0; 60 virtual void Update() = 0;
61 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); 61 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
62 virtual void DrawWidget(CFX_Graphics* pGraphics, 62 virtual void DrawWidget(CFX_Graphics* pGraphics,
63 const CFX_Matrix* pMatrix) = 0; 63 const CFX_Matrix* pMatrix) = 0;
64 virtual void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); 64 virtual void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
65 65
66 // IFWL_WidgetDelegate. 66 // IFWL_WidgetDelegate.
67 void OnProcessMessage(CFWL_Message* pMessage) override; 67 void OnProcessMessage(CFWL_Message* pMessage) override;
68 void OnProcessEvent(CFWL_Event* pEvent) override; 68 void OnProcessEvent(CFWL_Event* pEvent) override;
69 void OnDrawWidget(CFX_Graphics* pGraphics, 69 void OnDrawWidget(CFX_Graphics* pGraphics,
70 const CFX_Matrix* pMatrix = nullptr) override; 70 const CFX_Matrix* pMatrix) override;
71 71
72 void SetWidgetRect(const CFX_RectF& rect); 72 void SetWidgetRect(const CFX_RectF& rect);
73 73
74 void SetParent(CFWL_Widget* pParent); 74 void SetParent(CFWL_Widget* pParent);
75 75
76 CFWL_Widget* GetOwner() { return m_pWidgetMgr->GetOwnerWidget(this); } 76 CFWL_Widget* GetOwner() { return m_pWidgetMgr->GetOwnerWidget(this); }
77 CFWL_Widget* GetOuter() const { return m_pOuter; } 77 CFWL_Widget* GetOuter() const { return m_pOuter; }
78 78
79 uint32_t GetStyles() const; 79 uint32_t GetStyles() const;
80 void ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); 80 void ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved);
81 uint32_t GetStylesEx() const; 81 uint32_t GetStylesEx() const;
82 uint32_t GetStates() const; 82 uint32_t GetStates() const;
83 83
84 void LockUpdate() { m_iLock++; } 84 void LockUpdate() { m_iLock++; }
85 void UnlockUpdate() { 85 void UnlockUpdate() {
86 if (IsLocked()) 86 if (IsLocked())
87 m_iLock--; 87 m_iLock--;
88 } 88 }
89 89
90 void TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); 90 void TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy);
91 void GetMatrix(CFX_Matrix& matrix, bool bGlobal = false); 91 void GetMatrix(CFX_Matrix& matrix, bool bGlobal);
92 IFWL_ThemeProvider* GetThemeProvider() const; 92 IFWL_ThemeProvider* GetThemeProvider() const;
93 93
94 void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; } 94 void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; }
95 IFWL_WidgetDelegate* GetDelegate() { 95 IFWL_WidgetDelegate* GetDelegate() {
96 return m_pDelegate ? m_pDelegate : this; 96 return m_pDelegate ? m_pDelegate : this;
97 } 97 }
98 const IFWL_WidgetDelegate* GetDelegate() const { 98 const IFWL_WidgetDelegate* GetDelegate() const {
99 return m_pDelegate ? m_pDelegate : this; 99 return m_pDelegate ? m_pDelegate : this;
100 } 100 }
101 101
102 const CFWL_App* GetOwnerApp() const { return m_pOwnerApp; } 102 const CFWL_App* GetOwnerApp() const { return m_pOwnerApp; }
103 uint32_t GetEventKey() const { return m_nEventKey; } 103 uint32_t GetEventKey() const { return m_nEventKey; }
104 void SetEventKey(uint32_t key) { m_nEventKey = key; } 104 void SetEventKey(uint32_t key) { m_nEventKey = key; }
105 105
106 void* GetLayoutItem() const { return m_pLayoutItem; } 106 void* GetLayoutItem() const { return m_pLayoutItem; }
107 void SetLayoutItem(void* pItem) { m_pLayoutItem = pItem; } 107 void SetLayoutItem(void* pItem) { m_pLayoutItem = pItem; }
108 108
109 void SetFocus(bool bFocus); 109 void SetFocus(bool bFocus);
110 void Repaint(const CFX_RectF* pRect = nullptr); 110 void Repaint(const CFX_RectF* pRect);
111 111
112 protected: 112 protected:
113 CFWL_Widget(const CFWL_App* app, 113 CFWL_Widget(const CFWL_App* app,
114 std::unique_ptr<CFWL_WidgetProperties> properties, 114 std::unique_ptr<CFWL_WidgetProperties> properties,
115 CFWL_Widget* pOuter); 115 CFWL_Widget* pOuter);
116 116
117 bool IsEnabled() const; 117 bool IsEnabled() const;
118 bool IsActive() const; 118 bool IsActive() const;
119 bool IsLocked() const { return m_iLock > 0; } 119 bool IsLocked() const { return m_iLock > 0; }
120 bool HasBorder() const; 120 bool HasBorder() const;
121 bool HasEdge() const; 121 bool HasEdge() const;
122 void GetEdgeRect(CFX_RectF& rtEdge); 122 void GetEdgeRect(CFX_RectF& rtEdge);
123 FX_FLOAT GetBorderSize(bool bCX = true); 123 FX_FLOAT GetBorderSize(bool bCX);
124 FX_FLOAT GetEdgeWidth(); 124 FX_FLOAT GetEdgeWidth();
125 void GetRelativeRect(CFX_RectF& rect); 125 void GetRelativeRect(CFX_RectF& rect);
126 void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity); 126 void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity);
127 IFWL_ThemeProvider* GetAvailableTheme(); 127 IFWL_ThemeProvider* GetAvailableTheme();
128 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, 128 CFX_SizeF CalcTextSize(const CFX_WideString& wsText,
129 IFWL_ThemeProvider* pTheme, 129 IFWL_ThemeProvider* pTheme,
130 bool bMultiLine = false, 130 bool bMultiLine);
131 int32_t iLineWidth = -1);
132 void CalcTextRect(const CFX_WideString& wsText, 131 void CalcTextRect(const CFX_WideString& wsText,
133 IFWL_ThemeProvider* pTheme, 132 IFWL_ThemeProvider* pTheme,
134 uint32_t dwTTOStyles, 133 uint32_t dwTTOStyles,
135 int32_t iTTOAlign, 134 int32_t iTTOAlign,
136 CFX_RectF& rect); 135 CFX_RectF& rect);
137 void SetGrab(bool bSet); 136 void SetGrab(bool bSet);
138 void GetPopupPos(FX_FLOAT fMinHeight, 137 void GetPopupPos(FX_FLOAT fMinHeight,
139 FX_FLOAT fMaxHeight, 138 FX_FLOAT fMaxHeight,
140 const CFX_RectF& rtAnchor, 139 const CFX_RectF& rtAnchor,
141 CFX_RectF& rtPopup); 140 CFX_RectF& rtPopup);
142 void RegisterEventTarget(CFWL_Widget* pEventSource); 141 void RegisterEventTarget(CFWL_Widget* pEventSource);
143 void UnregisterEventTarget(); 142 void UnregisterEventTarget();
144 void DispatchEvent(CFWL_Event* pEvent); 143 void DispatchEvent(CFWL_Event* pEvent);
145 void DrawBorder(CFX_Graphics* pGraphics, 144 void DrawBorder(CFX_Graphics* pGraphics,
146 CFWL_Part iPartBorder, 145 CFWL_Part iPartBorder,
147 IFWL_ThemeProvider* pTheme, 146 IFWL_ThemeProvider* pTheme,
148 const CFX_Matrix* pMatrix = nullptr); 147 const CFX_Matrix* pMatrix);
149 void DrawEdge(CFX_Graphics* pGraphics, 148 void DrawEdge(CFX_Graphics* pGraphics,
150 CFWL_Part iPartEdge, 149 CFWL_Part iPartEdge,
151 IFWL_ThemeProvider* pTheme, 150 IFWL_ThemeProvider* pTheme,
152 const CFX_Matrix* pMatrix = nullptr); 151 const CFX_Matrix* pMatrix);
153 152
154 const CFWL_App* const m_pOwnerApp; 153 const CFWL_App* const m_pOwnerApp;
155 CFWL_WidgetMgr* const m_pWidgetMgr; 154 CFWL_WidgetMgr* const m_pWidgetMgr;
156 std::unique_ptr<CFWL_WidgetProperties> m_pProperties; 155 std::unique_ptr<CFWL_WidgetProperties> m_pProperties;
157 CFWL_Widget* m_pOuter; 156 CFWL_Widget* m_pOuter;
158 int32_t m_iLock; 157 int32_t m_iLock;
159 158
160 private: 159 private:
161 CFWL_Widget* GetParent() { return m_pWidgetMgr->GetParentWidget(this); } 160 CFWL_Widget* GetParent() { return m_pWidgetMgr->GetParentWidget(this); }
162 CFX_SizeF GetOffsetFromParent(CFWL_Widget* pParent); 161 CFX_SizeF GetOffsetFromParent(CFWL_Widget* pParent);
(...skipping 13 matching lines...) Expand all
176 const CFX_RectF& rtAnchor, 175 const CFX_RectF& rtAnchor,
177 CFX_RectF& rtPopup); 176 CFX_RectF& rtPopup);
178 bool GetPopupPosGeneral(FX_FLOAT fMinHeight, 177 bool GetPopupPosGeneral(FX_FLOAT fMinHeight,
179 FX_FLOAT fMaxHeight, 178 FX_FLOAT fMaxHeight,
180 const CFX_RectF& rtAnchor, 179 const CFX_RectF& rtAnchor,
181 CFX_RectF& rtPopup); 180 CFX_RectF& rtPopup);
182 bool GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy); 181 bool GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy);
183 void DrawBackground(CFX_Graphics* pGraphics, 182 void DrawBackground(CFX_Graphics* pGraphics,
184 CFWL_Part iPartBk, 183 CFWL_Part iPartBk,
185 IFWL_ThemeProvider* pTheme, 184 IFWL_ThemeProvider* pTheme,
186 const CFX_Matrix* pMatrix = nullptr); 185 const CFX_Matrix* pMatrix);
187 void NotifyDriver(); 186 void NotifyDriver();
188 bool IsParent(CFWL_Widget* pParent); 187 bool IsParent(CFWL_Widget* pParent);
189 188
190 void* m_pLayoutItem; 189 void* m_pLayoutItem;
191 uint32_t m_nEventKey; 190 uint32_t m_nEventKey;
192 IFWL_WidgetDelegate* m_pDelegate; // Not owned. 191 IFWL_WidgetDelegate* m_pDelegate; // Not owned.
193 }; 192 };
194 193
195 #endif // XFA_FWL_CORE_CFWL_WIDGET_H_ 194 #endif // XFA_FWL_CORE_CFWL_WIDGET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698