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

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

Issue 2432423002: Merge the CFWL_*Imp classes into the IFWL_* classes. (Closed)
Patch Set: Review feedback Created 4 years, 2 months 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
« no previous file with comments | « xfa/fwl/core/fwl_timerimp.cpp ('k') | xfa/fwl/core/fwl_widgetimp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef XFA_FWL_CORE_FWL_WIDGETIMP_H_
8 #define XFA_FWL_CORE_FWL_WIDGETIMP_H_
9
10 #include <memory>
11
12 #include "core/fxcrt/fx_coordinates.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "xfa/fwl/core/cfwl_event.h"
15 #include "xfa/fwl/core/cfwl_themepart.h"
16 #include "xfa/fwl/core/fwl_widgethit.h"
17 #include "xfa/fwl/core/ifwl_widgetdelegate.h"
18 #include "xfa/fwl/theme/cfwl_widgettp.h"
19
20 class CFWL_AppImp;
21 class CFWL_MsgKey;
22 class CFWL_WidgetImpProperties;
23 class CFWL_WidgetMgr;
24 class IFWL_App;
25 class IFWL_DataProvider;
26 class IFWL_ThemeProvider;
27 class IFWL_Widget;
28 enum class FWL_Type;
29
30 class CFWL_WidgetImp {
31 public:
32 virtual ~CFWL_WidgetImp();
33
34 virtual FWL_Error Initialize();
35 virtual FWL_Error Finalize();
36 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const;
37 virtual FWL_Type GetClassID() const = 0;
38 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
39
40 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
41 virtual FWL_Error GetGlobalRect(CFX_RectF& rect);
42 virtual FWL_Error SetWidgetRect(const CFX_RectF& rect);
43 virtual FWL_Error GetClientRect(CFX_RectF& rect);
44 virtual IFWL_Widget* GetParent();
45 virtual FWL_Error SetParent(IFWL_Widget* pParent);
46 virtual IFWL_Widget* GetOwner();
47 virtual FWL_Error SetOwner(IFWL_Widget* pOwner);
48 virtual IFWL_Widget* GetOuter();
49 virtual uint32_t GetStyles();
50 virtual FWL_Error ModifyStyles(uint32_t dwStylesAdded,
51 uint32_t dwStylesRemoved);
52 virtual uint32_t GetStylesEx();
53 virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded,
54 uint32_t dwStylesExRemoved);
55 virtual uint32_t GetStates();
56 virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
57 virtual FWL_Error Update();
58 virtual FWL_Error LockUpdate();
59 virtual FWL_Error UnlockUpdate();
60 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
61 virtual FWL_Error TransformTo(IFWL_Widget* pWidget,
62 FX_FLOAT& fx,
63 FX_FLOAT& fy);
64 virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt);
65 virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);
66 virtual FWL_Error SetMatrix(const CFX_Matrix& matrix);
67 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics,
68 const CFX_Matrix* pMatrix = nullptr);
69 virtual IFWL_ThemeProvider* GetThemeProvider();
70 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
71 virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
72 virtual IFWL_App* GetOwnerApp() const;
73
74 FWL_Error SetOwnerApp(IFWL_App* pOwnerApp);
75 IFWL_Widget* GetInterface() const;
76 void SetInterface(IFWL_Widget* pInterface);
77 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent);
78 uint32_t GetEventKey() const;
79 void SetEventKey(uint32_t key);
80 void* GetLayoutItem() const;
81 void SetLayoutItem(void* pItem);
82 void* GetAssociateWidget() const;
83 void SetAssociateWidget(void* pAssociate);
84
85 protected:
86 friend class CFWL_WidgetImpDelegate;
87
88 CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
89 IFWL_Widget* pOuter);
90
91 FX_BOOL IsEnabled() const;
92 FX_BOOL IsVisible() const;
93 FX_BOOL IsActive() const;
94 FX_BOOL IsOverLapper() const;
95 FX_BOOL IsPopup() const;
96 FX_BOOL IsChild() const;
97 FX_BOOL IsLocked() const;
98 FX_BOOL IsOffscreen() const;
99 FX_BOOL HasBorder() const;
100 FX_BOOL HasEdge() const;
101 void GetEdgeRect(CFX_RectF& rtEdge);
102 FX_FLOAT GetBorderSize(FX_BOOL bCX = TRUE);
103 FX_FLOAT GetEdgeWidth();
104 void GetRelativeRect(CFX_RectF& rect);
105 void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity);
106 IFWL_ThemeProvider* GetAvailableTheme();
107 CFWL_WidgetImp* GetRootOuter();
108 CFX_SizeF CalcTextSize(const CFX_WideString& wsText,
109 IFWL_ThemeProvider* pTheme,
110 FX_BOOL bMultiLine = FALSE,
111 int32_t iLineWidth = -1);
112 void CalcTextRect(const CFX_WideString& wsText,
113 IFWL_ThemeProvider* pTheme,
114 uint32_t dwTTOStyles,
115 int32_t iTTOAlign,
116 CFX_RectF& rect);
117 void SetFocus(FX_BOOL bFocus);
118 void SetGrab(FX_BOOL bSet);
119 FX_BOOL GetPopupPos(FX_FLOAT fMinHeight,
120 FX_FLOAT fMaxHeight,
121 const CFX_RectF& rtAnchor,
122 CFX_RectF& rtPopup);
123 FX_BOOL GetPopupPosMenu(FX_FLOAT fMinHeight,
124 FX_FLOAT fMaxHeight,
125 const CFX_RectF& rtAnchor,
126 CFX_RectF& rtPopup);
127 FX_BOOL GetPopupPosComboBox(FX_FLOAT fMinHeight,
128 FX_FLOAT fMaxHeight,
129 const CFX_RectF& rtAnchor,
130 CFX_RectF& rtPopup);
131 FX_BOOL GetPopupPosGeneral(FX_FLOAT fMinHeight,
132 FX_FLOAT fMaxHeight,
133 const CFX_RectF& rtAnchor,
134 CFX_RectF& rtPopup);
135 FX_BOOL GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy);
136 void RegisterEventTarget(IFWL_Widget* pEventSource = nullptr,
137 uint32_t dwFilter = FWL_EVENT_ALL_MASK);
138 void UnregisterEventTarget();
139 void DispatchKeyEvent(CFWL_MsgKey* pNote);
140 void DispatchEvent(CFWL_Event* pEvent);
141 void Repaint(const CFX_RectF* pRect = nullptr);
142 void DrawBackground(CFX_Graphics* pGraphics,
143 CFWL_Part iPartBk,
144 IFWL_ThemeProvider* pTheme,
145 const CFX_Matrix* pMatrix = nullptr);
146 void DrawBorder(CFX_Graphics* pGraphics,
147 CFWL_Part iPartBorder,
148 IFWL_ThemeProvider* pTheme,
149 const CFX_Matrix* pMatrix = nullptr);
150 void DrawEdge(CFX_Graphics* pGraphics,
151 CFWL_Part iPartEdge,
152 IFWL_ThemeProvider* pTheme,
153 const CFX_Matrix* pMatrix = nullptr);
154 void NotifyDriver();
155
156 FX_BOOL IsParent(IFWL_Widget* pParent);
157
158 CFWL_WidgetMgr* const m_pWidgetMgr;
159 IFWL_App* m_pOwnerApp;
160 std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties;
161 IFWL_WidgetDelegate* m_pDelegate;
162 IFWL_WidgetDelegate* m_pCurDelegate;
163 IFWL_Widget* m_pOuter;
164 IFWL_Widget* m_pInterface;
165 void* m_pLayoutItem;
166 void* m_pAssociate;
167 int32_t m_iLock;
168 uint32_t m_nEventKey;
169 };
170
171 class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate {
172 public:
173 CFWL_WidgetImpDelegate();
174 ~CFWL_WidgetImpDelegate() override {}
175 void OnProcessMessage(CFWL_Message* pMessage) override;
176 void OnProcessEvent(CFWL_Event* pEvent) override;
177 void OnDrawWidget(CFX_Graphics* pGraphics,
178 const CFX_Matrix* pMatrix = nullptr) override;
179 };
180
181 #endif // XFA_FWL_CORE_FWL_WIDGETIMP_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_timerimp.cpp ('k') | xfa/fwl/core/fwl_widgetimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698