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_CORE_CFWL_WIDGETMGR_H_ | 7 #ifndef XFA_FWL_CORE_CFWL_WIDGETMGR_H_ |
8 #define XFA_FWL_CORE_CFWL_WIDGETMGR_H_ | 8 #define XFA_FWL_CORE_CFWL_WIDGETMGR_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "core/fxcrt/fx_system.h" | 13 #include "core/fxcrt/fx_system.h" |
14 #include "xfa/fwl/core/fwl_error.h" | 14 #include "xfa/fwl/core/fwl_error.h" |
| 15 #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" |
15 #include "xfa/fxgraphics/cfx_graphics.h" | 16 #include "xfa/fxgraphics/cfx_graphics.h" |
16 | 17 |
17 #define FWL_WGTMGR_DisableForm 0x00000002 | 18 #define FWL_WGTMGR_DisableForm 0x00000002 |
18 | 19 |
19 class CFWL_Message; | 20 class CFWL_Message; |
20 class CXFA_FFApp; | 21 class CXFA_FFApp; |
21 class CXFA_FWLAdapterWidgetMgr; | 22 class CXFA_FWLAdapterWidgetMgr; |
22 class CFX_Graphics; | 23 class CFX_Graphics; |
23 class CFX_Matrix; | 24 class CFX_Matrix; |
24 class IFWL_Widget; | 25 class IFWL_Widget; |
25 | 26 |
26 class CFWL_WidgetMgrItem { | |
27 public: | |
28 CFWL_WidgetMgrItem(); | |
29 explicit CFWL_WidgetMgrItem(IFWL_Widget* widget); | |
30 ~CFWL_WidgetMgrItem(); | |
31 | |
32 CFWL_WidgetMgrItem* pParent; | |
33 CFWL_WidgetMgrItem* pOwner; | |
34 CFWL_WidgetMgrItem* pChild; | |
35 CFWL_WidgetMgrItem* pPrevious; | |
36 CFWL_WidgetMgrItem* pNext; | |
37 IFWL_Widget* const pWidget; | |
38 std::unique_ptr<CFX_Graphics> pOffscreen; | |
39 int32_t iRedrawCounter; | |
40 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | |
41 bool bOutsideChanged; | |
42 #endif | |
43 }; | |
44 | |
45 class IFWL_WidgetMgrDelegate { | |
46 public: | |
47 virtual void OnSetCapability(uint32_t dwCapability) = 0; | |
48 virtual void OnProcessMessageToForm(CFWL_Message* pMessage) = 0; | |
49 virtual void OnDrawWidget(IFWL_Widget* pWidget, | |
50 CFX_Graphics* pGraphics, | |
51 const CFX_Matrix* pMatrix) = 0; | |
52 }; | |
53 | |
54 class CFWL_WidgetMgr : public IFWL_WidgetMgrDelegate { | 27 class CFWL_WidgetMgr : public IFWL_WidgetMgrDelegate { |
55 public: | 28 public: |
56 explicit CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative); | 29 explicit CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative); |
57 ~CFWL_WidgetMgr(); | 30 ~CFWL_WidgetMgr(); |
58 | 31 |
59 // IFWL_WidgetMgrDelegate | 32 // IFWL_WidgetMgrDelegate |
60 void OnSetCapability(uint32_t dwCapability) override; | 33 void OnSetCapability(uint32_t dwCapability) override; |
61 void OnProcessMessageToForm(CFWL_Message* pMessage) override; | 34 void OnProcessMessageToForm(CFWL_Message* pMessage) override; |
62 void OnDrawWidget(IFWL_Widget* pWidget, | 35 void OnDrawWidget(IFWL_Widget* pWidget, |
63 CFX_Graphics* pGraphics, | 36 CFX_Graphics* pGraphics, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 return !!(m_dwCapability & FWL_WGTMGR_DisableForm); | 68 return !!(m_dwCapability & FWL_WGTMGR_DisableForm); |
96 } | 69 } |
97 | 70 |
98 void GetAdapterPopupPos(IFWL_Widget* pWidget, | 71 void GetAdapterPopupPos(IFWL_Widget* pWidget, |
99 FX_FLOAT fMinHeight, | 72 FX_FLOAT fMinHeight, |
100 FX_FLOAT fMaxHeight, | 73 FX_FLOAT fMaxHeight, |
101 const CFX_RectF& rtAnchor, | 74 const CFX_RectF& rtAnchor, |
102 CFX_RectF& rtPopup) const; | 75 CFX_RectF& rtPopup) const; |
103 | 76 |
104 private: | 77 private: |
| 78 class Item { |
| 79 public: |
| 80 Item(); |
| 81 explicit Item(IFWL_Widget* widget); |
| 82 ~Item(); |
| 83 |
| 84 Item* pParent; |
| 85 Item* pOwner; |
| 86 Item* pChild; |
| 87 Item* pPrevious; |
| 88 Item* pNext; |
| 89 IFWL_Widget* const pWidget; |
| 90 std::unique_ptr<CFX_Graphics> pOffscreen; |
| 91 int32_t iRedrawCounter; |
| 92 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) |
| 93 bool bOutsideChanged; |
| 94 #endif |
| 95 }; |
| 96 |
105 IFWL_Widget* GetFirstSiblingWidget(IFWL_Widget* pWidget) const; | 97 IFWL_Widget* GetFirstSiblingWidget(IFWL_Widget* pWidget) const; |
106 IFWL_Widget* GetPriorSiblingWidget(IFWL_Widget* pWidget) const; | 98 IFWL_Widget* GetPriorSiblingWidget(IFWL_Widget* pWidget) const; |
107 IFWL_Widget* GetLastChildWidget(IFWL_Widget* pWidget) const; | 99 IFWL_Widget* GetLastChildWidget(IFWL_Widget* pWidget) const; |
108 CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget) const; | 100 Item* GetWidgetMgrItem(IFWL_Widget* pWidget) const; |
109 | 101 |
110 void SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex); | 102 void SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex); |
111 | 103 |
112 int32_t CountRadioButtonGroup(IFWL_Widget* pFirst) const; | 104 int32_t CountRadioButtonGroup(IFWL_Widget* pFirst) const; |
113 IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton) const; | 105 IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton) const; |
114 | 106 |
115 void ResetRedrawCounts(IFWL_Widget* pWidget); | 107 void ResetRedrawCounts(IFWL_Widget* pWidget); |
116 | 108 |
117 void DrawChild(IFWL_Widget* pParent, | 109 void DrawChild(IFWL_Widget* pParent, |
118 const CFX_RectF& rtClip, | 110 const CFX_RectF& rtClip, |
119 CFX_Graphics* pGraphics, | 111 CFX_Graphics* pGraphics, |
120 const CFX_Matrix* pMatrix); | 112 const CFX_Matrix* pMatrix); |
121 CFX_Graphics* DrawWidgetBefore(IFWL_Widget* pWidget, | 113 CFX_Graphics* DrawWidgetBefore(IFWL_Widget* pWidget, |
122 CFX_Graphics* pGraphics, | 114 CFX_Graphics* pGraphics, |
123 const CFX_Matrix* pMatrix); | 115 const CFX_Matrix* pMatrix); |
124 void DrawWidgetAfter(IFWL_Widget* pWidget, | 116 void DrawWidgetAfter(IFWL_Widget* pWidget, |
125 CFX_Graphics* pGraphics, | 117 CFX_Graphics* pGraphics, |
126 CFX_RectF& rtClip, | 118 CFX_RectF& rtClip, |
127 const CFX_Matrix* pMatrix); | 119 const CFX_Matrix* pMatrix); |
128 bool IsNeedRepaint(IFWL_Widget* pWidget, | 120 bool IsNeedRepaint(IFWL_Widget* pWidget, |
129 CFX_Matrix* pMatrix, | 121 CFX_Matrix* pMatrix, |
130 const CFX_RectF& rtDirty); | 122 const CFX_RectF& rtDirty); |
131 bool UseOffscreenDirect(IFWL_Widget* pWidget) const; | 123 bool UseOffscreenDirect(IFWL_Widget* pWidget) const; |
132 | 124 |
133 bool IsAbleNative(IFWL_Widget* pWidget) const; | 125 bool IsAbleNative(IFWL_Widget* pWidget) const; |
134 | 126 |
135 uint32_t m_dwCapability; | 127 uint32_t m_dwCapability; |
136 std::map<IFWL_Widget*, std::unique_ptr<CFWL_WidgetMgrItem>> m_mapWidgetItem; | 128 std::map<IFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem; |
137 CXFA_FWLAdapterWidgetMgr* const m_pAdapter; | 129 CXFA_FWLAdapterWidgetMgr* const m_pAdapter; |
138 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | 130 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) |
139 CFX_RectF m_rtScreen; | 131 CFX_RectF m_rtScreen; |
140 #endif | 132 #endif |
141 }; | 133 }; |
142 | 134 |
143 #endif // XFA_FWL_CORE_CFWL_WIDGETMGR_H_ | 135 #endif // XFA_FWL_CORE_CFWL_WIDGETMGR_H_ |
OLD | NEW |