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_WIDGETMGRIMP_H_ | |
8 #define XFA_SRC_FWL_CORE_FWL_WIDGETMGRIMP_H_ | |
9 | |
10 #include "xfa/include/fwl/core/fwl_widgetmgr.h" | |
11 | |
12 class IFWL_Widget; | |
13 class IFWL_AdapterWidgetMgr; | |
14 class CFWL_WidgetMgrDelegate; | |
15 class IFWL_AdapterNative; | |
16 | |
17 class CFWL_WidgetMgrItem { | |
18 public: | |
19 CFWL_WidgetMgrItem() | |
20 : pParent(NULL), | |
21 pOwner(NULL), | |
22 pChild(NULL), | |
23 pPrevious(NULL), | |
24 pNext(NULL), | |
25 pWidget(NULL), | |
26 pOffscreen(NULL), | |
27 iRedrawCounter(0) | |
28 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | |
29 , | |
30 bOutsideChanged(FALSE) | |
31 #endif | |
32 { | |
33 } | |
34 ~CFWL_WidgetMgrItem() { | |
35 if (pOffscreen) { | |
36 delete pOffscreen; | |
37 pOffscreen = NULL; | |
38 } | |
39 } | |
40 CFWL_WidgetMgrItem* pParent; | |
41 CFWL_WidgetMgrItem* pOwner; | |
42 CFWL_WidgetMgrItem* pChild; | |
43 CFWL_WidgetMgrItem* pPrevious; | |
44 CFWL_WidgetMgrItem* pNext; | |
45 IFWL_Widget* pWidget; | |
46 CFX_Graphics* pOffscreen; | |
47 int32_t iRedrawCounter; | |
48 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | |
49 FX_BOOL bOutsideChanged; | |
50 #endif | |
51 }; | |
52 | |
53 class CFWL_WidgetMgr : public IFWL_WidgetMgr { | |
54 public: | |
55 CFWL_WidgetMgr(IFWL_AdapterNative* pAdapterNative); | |
56 ~CFWL_WidgetMgr() override; | |
57 | |
58 // IFWL_WidgetMgr: | |
59 int32_t CountWidgets(IFWL_Widget* pParent = NULL) override; | |
60 IFWL_Widget* GetWidget(int32_t nIndex, IFWL_Widget* pParent = NULL) override; | |
61 IFWL_Widget* GetWidget(IFWL_Widget* pWidget, | |
62 FWL_WGTRELATION eRelation) override; | |
63 int32_t GetWidgetIndex(IFWL_Widget* pWidget) override; | |
64 FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) override; | |
65 FWL_ERR RepaintWidget(IFWL_Widget* pWidget, | |
66 const CFX_RectF* pRect = NULL) override; | |
67 FX_DWORD GetCapability() override { return m_dwCapability; } | |
68 | |
69 void AddWidget(IFWL_Widget* pWidget); | |
70 void InsertWidget(IFWL_Widget* pParent, | |
71 IFWL_Widget* pChild, | |
72 int32_t nIndex = -1); | |
73 void RemoveWidget(IFWL_Widget* pWidget); | |
74 void SetOwner(IFWL_Widget* pOwner, IFWL_Widget* pOwned); | |
75 void SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild); | |
76 FX_BOOL IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent); | |
77 FWL_ERR CreateWidget_Native(IFWL_Widget* pWidget); | |
78 FWL_ERR DestroyWidget_Native(IFWL_Widget* pWidget); | |
79 FWL_ERR GetWidgetRect_Native(IFWL_Widget* pWidget, CFX_RectF& rect); | |
80 FWL_ERR SetWidgetRect_Native(IFWL_Widget* pWidget, const CFX_RectF& rect); | |
81 FWL_ERR SetWidgetPosition_Native(IFWL_Widget* pWidget, | |
82 FX_FLOAT fx, | |
83 FX_FLOAT fy); | |
84 FWL_ERR SetWidgetIcon_Native(IFWL_Widget* pWidget, | |
85 const CFX_DIBitmap* pIcon, | |
86 FX_BOOL bBig); | |
87 FWL_ERR SetWidgetCaption_Native(IFWL_Widget* pWidget, | |
88 const CFX_WideStringC& wsCaption); | |
89 FWL_ERR SetBorderRegion_Native(IFWL_Widget* pWidget, CFX_Path* pPath); | |
90 FWL_ERR ShowWidget_Native(IFWL_Widget* pWidget); | |
91 FWL_ERR HideWidget_Native(IFWL_Widget* pWidget); | |
92 FWL_ERR SetNormal_Native(IFWL_Widget* pWidget); | |
93 FWL_ERR SetMaximize_Native(IFWL_Widget* pWidget); | |
94 FWL_ERR SetMinimize_Native(IFWL_Widget* pWidget); | |
95 FX_BOOL CheckMessage_Native(); | |
96 FWL_ERR DispatchMessage_Native(); | |
97 FX_BOOL IsIdleMessage_Native(); | |
98 FWL_ERR Exit_Native(int32_t iExitCode); | |
99 FWL_ERR CreateWidgetWithNativeId_Native(IFWL_Widget* pWidget, void* vp); | |
100 IFWL_Widget* GetWidgetAtPoint(IFWL_Widget* pParent, FX_FLOAT fx, FX_FLOAT fy); | |
101 void NotifySizeChanged(IFWL_Widget* pForm, FX_FLOAT fx, FX_FLOAT fy); | |
102 IFWL_Widget* nextTab(IFWL_Widget* parent, IFWL_Widget* focus, FX_BOOL& bFind); | |
103 int32_t CountRadioButtonGroup(IFWL_Widget* pFirst); | |
104 IFWL_Widget* GetSiblingRadioButton(IFWL_Widget* pWidget, FX_BOOL bNext); | |
105 IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton); | |
106 void GetSameGroupRadioButton(IFWL_Widget* pRadioButton, CFX_PtrArray& group); | |
107 IFWL_Widget* GetDefaultButton(IFWL_Widget* pParent); | |
108 void AddRedrawCounts(IFWL_Widget* pWidget); | |
109 void ResetRedrawCounts(IFWL_Widget* pWidget); | |
110 IFWL_AdapterWidgetMgr* GetAdapterWidgetMgr() { return m_pAdapter; } | |
111 CFWL_WidgetMgrDelegate* GetDelegate() { return m_pDelegate; } | |
112 CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget); | |
113 FX_BOOL IsThreadEnabled(); | |
114 FX_BOOL IsFormDisabled(); | |
115 FX_BOOL GetAdapterPopupPos(IFWL_Widget* pWidget, | |
116 FX_FLOAT fMinHeight, | |
117 FX_FLOAT fMaxHeight, | |
118 const CFX_RectF& rtAnchor, | |
119 CFX_RectF& rtPopup); | |
120 | |
121 protected: | |
122 int32_t TravelWidgetMgr(CFWL_WidgetMgrItem* pParent, | |
123 int32_t* pIndex, | |
124 CFWL_WidgetMgrItem* pItem, | |
125 IFWL_Widget** pWidget = NULL); | |
126 FX_BOOL IsAbleNative(IFWL_Widget* pWidget); | |
127 CFX_MapPtrToPtr m_mapWidgetItem; | |
128 IFWL_AdapterWidgetMgr* m_pAdapter; | |
129 CFWL_WidgetMgrDelegate* m_pDelegate; | |
130 friend class CFWL_WidgetMgrDelegate; | |
131 FX_DWORD m_dwCapability; | |
132 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | |
133 CFX_RectF m_rtScreen; | |
134 #endif | |
135 }; | |
136 | |
137 class CFWL_WidgetMgrDelegate : public IFWL_WidgetMgrDelegate { | |
138 public: | |
139 CFWL_WidgetMgrDelegate(CFWL_WidgetMgr* pWidgetMgr); | |
140 ~CFWL_WidgetMgrDelegate() override {} | |
141 | |
142 // IFWL_WidgetMgrDelegate: | |
143 FWL_ERR OnSetCapability( | |
144 FX_DWORD dwCapability = FWL_WGTMGR_DisableThread) override; | |
145 int32_t OnProcessMessageToForm(CFWL_Message* pMessage) override; | |
146 FWL_ERR OnDrawWidget(IFWL_Widget* pWidget, | |
147 CFX_Graphics* pGraphics, | |
148 const CFX_Matrix* pMatrix) override; | |
149 | |
150 protected: | |
151 void DrawChild(IFWL_Widget* pParent, | |
152 const CFX_RectF& rtClip, | |
153 CFX_Graphics* pGraphics, | |
154 const CFX_Matrix* pMatrix); | |
155 CFX_Graphics* DrawWidgetBefore(IFWL_Widget* pWidget, | |
156 CFX_Graphics* pGraphics, | |
157 const CFX_Matrix* pMatrix); | |
158 void DrawWidgetAfter(IFWL_Widget* pWidget, | |
159 CFX_Graphics* pGraphics, | |
160 CFX_RectF& rtClip, | |
161 const CFX_Matrix* pMatrix); | |
162 FX_BOOL IsNeedRepaint(IFWL_Widget* pWidget, | |
163 CFX_Matrix* pMatrix, | |
164 const CFX_RectF& rtDirty); | |
165 FX_BOOL bUseOffscreenDirect(IFWL_Widget* pWidget); | |
166 | |
167 CFWL_WidgetMgr* m_pWidgetMgr; | |
168 }; | |
169 | |
170 #endif // XFA_SRC_FWL_CORE_FWL_WIDGETMGRIMP_H_ | |
OLD | NEW |