OLD | NEW |
| (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_SRC_FWL_CORE_FWL_WIDGETIMP_H_ | |
8 #define XFA_SRC_FWL_CORE_FWL_WIDGETIMP_H_ | |
9 | |
10 #include "xfa/include/fwl/core/fwl_widget.h" | |
11 #include "xfa/src/fwl/core/fwl_targetimp.h" | |
12 | |
13 class CFWL_NoteThreadImp; | |
14 class CFWL_WidgetImpProperties; | |
15 class CFWL_WidgetMgr; | |
16 class IFWL_DataProvider; | |
17 class IFWL_ThemeProvider; | |
18 class IFWL_Widget; | |
19 class IFWL_WidgetDelegate; | |
20 | |
21 class CFWL_WidgetImp : public CFWL_TargetImp { | |
22 public: | |
23 virtual FWL_ERR Initialize(); | |
24 virtual FWL_ERR Finalize(); | |
25 | |
26 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | |
27 virtual FWL_ERR GetGlobalRect(CFX_RectF& rect); | |
28 virtual FWL_ERR SetWidgetRect(const CFX_RectF& rect); | |
29 virtual FWL_ERR GetClientRect(CFX_RectF& rect); | |
30 virtual IFWL_Widget* GetParent(); | |
31 virtual FWL_ERR SetParent(IFWL_Widget* pParent); | |
32 virtual IFWL_Widget* GetOwner(); | |
33 virtual FWL_ERR SetOwner(IFWL_Widget* pOwner); | |
34 virtual IFWL_Widget* GetOuter(); | |
35 virtual FX_DWORD GetStyles(); | |
36 virtual FWL_ERR ModifyStyles(FX_DWORD dwStylesAdded, | |
37 FX_DWORD dwStylesRemoved); | |
38 virtual FX_DWORD GetStylesEx(); | |
39 virtual FWL_ERR ModifyStylesEx(FX_DWORD dwStylesExAdded, | |
40 FX_DWORD dwStylesExRemoved); | |
41 virtual FX_DWORD GetStates(); | |
42 virtual FWL_ERR SetStates(FX_DWORD dwStates, FX_BOOL bSet = TRUE); | |
43 virtual FWL_ERR SetPrivateData(void* module_id, | |
44 void* pData, | |
45 PD_CALLBACK_FREEDATA callback); | |
46 virtual void* GetPrivateData(void* module_id); | |
47 virtual FWL_ERR Update(); | |
48 virtual FWL_ERR LockUpdate(); | |
49 virtual FWL_ERR UnlockUpdate(); | |
50 virtual FX_DWORD HitTest(FX_FLOAT fx, FX_FLOAT fy); | |
51 virtual FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); | |
52 virtual FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); | |
53 virtual FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); | |
54 virtual FWL_ERR SetMatrix(const CFX_Matrix& matrix); | |
55 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, | |
56 const CFX_Matrix* pMatrix = NULL); | |
57 virtual IFWL_ThemeProvider* GetThemeProvider(); | |
58 virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | |
59 virtual FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); | |
60 virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); | |
61 virtual IFWL_NoteThread* GetOwnerThread() const; | |
62 FWL_ERR SetOwnerThread(CFWL_NoteThreadImp* pOwnerThread); | |
63 IFWL_Widget* GetInterface() const; | |
64 void SetInterface(IFWL_Widget* pInterface); | |
65 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); | |
66 | |
67 protected: | |
68 CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, | |
69 IFWL_Widget* pOuter); | |
70 virtual ~CFWL_WidgetImp(); | |
71 FX_BOOL IsEnabled() const; | |
72 FX_BOOL IsVisible() const; | |
73 FX_BOOL IsActive() const; | |
74 FX_BOOL IsOverLapper() const; | |
75 FX_BOOL IsPopup() const; | |
76 FX_BOOL IsChild() const; | |
77 FX_BOOL IsLocked() const; | |
78 FX_BOOL IsOffscreen() const; | |
79 FX_BOOL HasBorder() const; | |
80 FX_BOOL HasEdge() const; | |
81 void GetEdgeRect(CFX_RectF& rtEdge); | |
82 FX_FLOAT GetBorderSize(FX_BOOL bCX = TRUE); | |
83 FX_FLOAT GetEdgeWidth(); | |
84 void GetRelativeRect(CFX_RectF& rect); | |
85 void* GetThemeCapacity(FX_DWORD dwCapacity); | |
86 IFWL_ThemeProvider* GetAvailableTheme(); | |
87 CFWL_WidgetImp* GetRootOuter(); | |
88 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, | |
89 IFWL_ThemeProvider* pTheme, | |
90 FX_BOOL bMultiLine = FALSE, | |
91 int32_t iLineWidth = -1); | |
92 void CalcTextRect(const CFX_WideString& wsText, | |
93 IFWL_ThemeProvider* pTheme, | |
94 FX_DWORD dwTTOStyles, | |
95 int32_t iTTOAlign, | |
96 CFX_RectF& rect); | |
97 void SetFocus(FX_BOOL bFocus); | |
98 void SetGrab(FX_BOOL bSet); | |
99 FX_BOOL GetPopupPos(FX_FLOAT fMinHeight, | |
100 FX_FLOAT fMaxHeight, | |
101 const CFX_RectF& rtAnchor, | |
102 CFX_RectF& rtPopup); | |
103 FX_BOOL GetPopupPosMenu(FX_FLOAT fMinHeight, | |
104 FX_FLOAT fMaxHeight, | |
105 const CFX_RectF& rtAnchor, | |
106 CFX_RectF& rtPopup); | |
107 FX_BOOL GetPopupPosComboBox(FX_FLOAT fMinHeight, | |
108 FX_FLOAT fMaxHeight, | |
109 const CFX_RectF& rtAnchor, | |
110 CFX_RectF& rtPopup); | |
111 FX_BOOL GetPopupPosGeneral(FX_FLOAT fMinHeight, | |
112 FX_FLOAT fMaxHeight, | |
113 const CFX_RectF& rtAnchor, | |
114 CFX_RectF& rtPopup); | |
115 FX_BOOL GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy); | |
116 void RegisterEventTarget(IFWL_Widget* pEventSource = NULL, | |
117 FX_DWORD dwFilter = FWL_EVENT_ALL_MASK); | |
118 void UnregisterEventTarget(); | |
119 void DispatchKeyEvent(CFWL_MsgKey* pNote); | |
120 void DispatchEvent(CFWL_Event* pEvent); | |
121 void Repaint(const CFX_RectF* pRect = NULL); | |
122 void DrawBackground(CFX_Graphics* pGraphics, | |
123 int32_t iPartBk, | |
124 IFWL_ThemeProvider* pTheme, | |
125 const CFX_Matrix* pMatrix = NULL); | |
126 void DrawBorder(CFX_Graphics* pGraphics, | |
127 int32_t iPartBorder, | |
128 IFWL_ThemeProvider* pTheme, | |
129 const CFX_Matrix* pMatrix = NULL); | |
130 void DrawEdge(CFX_Graphics* pGraphics, | |
131 int32_t iPartEdge, | |
132 IFWL_ThemeProvider* pTheme, | |
133 const CFX_Matrix* pMatrix = NULL); | |
134 void NotifyDriver(); | |
135 | |
136 FX_BOOL IsParent(IFWL_Widget* pParent); | |
137 CFWL_WidgetMgr* m_pWidgetMgr; | |
138 CFWL_NoteThreadImp* m_pOwnerThread; | |
139 CFWL_WidgetImpProperties* m_pProperties; | |
140 CFX_PrivateData* m_pPrivateData; | |
141 IFWL_WidgetDelegate* m_pDelegate; | |
142 IFWL_WidgetDelegate* m_pCurDelegate; | |
143 IFWL_Widget* m_pOuter; | |
144 IFWL_Widget* m_pInterface; | |
145 int32_t m_iLock; | |
146 friend class CFWL_WidgetImpDelegate; | |
147 friend void FWL_SetWidgetRect(IFWL_Widget* widget, const CFX_RectF& rect); | |
148 friend void FWL_SetWidgetStates(IFWL_Widget* widget, FX_DWORD dwStates); | |
149 friend void FWL_SetWidgetStyles(IFWL_Widget* widget, FX_DWORD dwStyles); | |
150 }; | |
151 | |
152 class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate { | |
153 public: | |
154 CFWL_WidgetImpDelegate(); | |
155 ~CFWL_WidgetImpDelegate() override {} | |
156 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | |
157 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; | |
158 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | |
159 const CFX_Matrix* pMatrix = NULL) override; | |
160 }; | |
161 | |
162 #endif // XFA_SRC_FWL_CORE_FWL_WIDGETIMP_H_ | |
OLD | NEW |