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/fxgraphics/cfx_graphics.h" | 15 #include "xfa/fxgraphics/cfx_graphics.h" |
16 | 16 |
17 #define FWL_WGTMGR_DisableThread 0x00000001 | |
18 #define FWL_WGTMGR_DisableForm 0x00000002 | 17 #define FWL_WGTMGR_DisableForm 0x00000002 |
19 | 18 |
20 class CFWL_Message; | 19 class CFWL_Message; |
21 class CXFA_FFApp; | 20 class CXFA_FFApp; |
22 class CXFA_FWLAdapterWidgetMgr; | 21 class CXFA_FWLAdapterWidgetMgr; |
23 class CFX_Graphics; | 22 class CFX_Graphics; |
24 class CFX_Matrix; | 23 class CFX_Matrix; |
25 class IFWL_Widget; | 24 class IFWL_Widget; |
26 | 25 |
27 class CFWL_WidgetMgrItem { | 26 class CFWL_WidgetMgrItem { |
(...skipping 10 matching lines...) Expand all Loading... |
38 IFWL_Widget* const pWidget; | 37 IFWL_Widget* const pWidget; |
39 std::unique_ptr<CFX_Graphics> pOffscreen; | 38 std::unique_ptr<CFX_Graphics> pOffscreen; |
40 int32_t iRedrawCounter; | 39 int32_t iRedrawCounter; |
41 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | 40 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) |
42 bool bOutsideChanged; | 41 bool bOutsideChanged; |
43 #endif | 42 #endif |
44 }; | 43 }; |
45 | 44 |
46 class IFWL_WidgetMgrDelegate { | 45 class IFWL_WidgetMgrDelegate { |
47 public: | 46 public: |
48 virtual void OnSetCapability( | 47 virtual void OnSetCapability(uint32_t dwCapability) = 0; |
49 uint32_t dwCapability = FWL_WGTMGR_DisableThread) = 0; | |
50 virtual void OnProcessMessageToForm(CFWL_Message* pMessage) = 0; | 48 virtual void OnProcessMessageToForm(CFWL_Message* pMessage) = 0; |
51 virtual void OnDrawWidget(IFWL_Widget* pWidget, | 49 virtual void OnDrawWidget(IFWL_Widget* pWidget, |
52 CFX_Graphics* pGraphics, | 50 CFX_Graphics* pGraphics, |
53 const CFX_Matrix* pMatrix) = 0; | 51 const CFX_Matrix* pMatrix) = 0; |
54 }; | 52 }; |
55 | 53 |
56 class CFWL_WidgetMgr : public IFWL_WidgetMgrDelegate { | 54 class CFWL_WidgetMgr : public IFWL_WidgetMgrDelegate { |
57 public: | 55 public: |
58 explicit CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative); | 56 explicit CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative); |
59 ~CFWL_WidgetMgr(); | 57 ~CFWL_WidgetMgr(); |
60 | 58 |
61 // IFWL_WidgetMgrDelegate | 59 // IFWL_WidgetMgrDelegate |
62 void OnSetCapability( | 60 void OnSetCapability(uint32_t dwCapability) override; |
63 uint32_t dwCapability = FWL_WGTMGR_DisableThread) override; | |
64 void OnProcessMessageToForm(CFWL_Message* pMessage) override; | 61 void OnProcessMessageToForm(CFWL_Message* pMessage) override; |
65 void OnDrawWidget(IFWL_Widget* pWidget, | 62 void OnDrawWidget(IFWL_Widget* pWidget, |
66 CFX_Graphics* pGraphics, | 63 CFX_Graphics* pGraphics, |
67 const CFX_Matrix* pMatrix) override; | 64 const CFX_Matrix* pMatrix) override; |
68 | 65 |
69 IFWL_Widget* GetParentWidget(IFWL_Widget* pWidget) const; | 66 IFWL_Widget* GetParentWidget(IFWL_Widget* pWidget) const; |
70 IFWL_Widget* GetOwnerWidget(IFWL_Widget* pWidget) const; | 67 IFWL_Widget* GetOwnerWidget(IFWL_Widget* pWidget) const; |
71 IFWL_Widget* GetNextSiblingWidget(IFWL_Widget* pWidget) const; | 68 IFWL_Widget* GetNextSiblingWidget(IFWL_Widget* pWidget) const; |
72 IFWL_Widget* GetFirstChildWidget(IFWL_Widget* pWidget) const; | 69 IFWL_Widget* GetFirstChildWidget(IFWL_Widget* pWidget) const; |
73 IFWL_Widget* GetSystemFormWidget(IFWL_Widget* pWidget) const; | 70 IFWL_Widget* GetSystemFormWidget(IFWL_Widget* pWidget) const; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 IFWL_Widget* GetLastChildWidget(IFWL_Widget* pWidget) const; | 107 IFWL_Widget* GetLastChildWidget(IFWL_Widget* pWidget) const; |
111 CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget) const; | 108 CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget) const; |
112 | 109 |
113 void SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex); | 110 void SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex); |
114 | 111 |
115 int32_t CountRadioButtonGroup(IFWL_Widget* pFirst) const; | 112 int32_t CountRadioButtonGroup(IFWL_Widget* pFirst) const; |
116 IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton) const; | 113 IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton) const; |
117 | 114 |
118 void ResetRedrawCounts(IFWL_Widget* pWidget); | 115 void ResetRedrawCounts(IFWL_Widget* pWidget); |
119 | 116 |
120 bool IsThreadEnabled() const { | |
121 return !(m_dwCapability & FWL_WGTMGR_DisableThread); | |
122 } | |
123 | |
124 void DrawChild(IFWL_Widget* pParent, | 117 void DrawChild(IFWL_Widget* pParent, |
125 const CFX_RectF& rtClip, | 118 const CFX_RectF& rtClip, |
126 CFX_Graphics* pGraphics, | 119 CFX_Graphics* pGraphics, |
127 const CFX_Matrix* pMatrix); | 120 const CFX_Matrix* pMatrix); |
128 CFX_Graphics* DrawWidgetBefore(IFWL_Widget* pWidget, | 121 CFX_Graphics* DrawWidgetBefore(IFWL_Widget* pWidget, |
129 CFX_Graphics* pGraphics, | 122 CFX_Graphics* pGraphics, |
130 const CFX_Matrix* pMatrix); | 123 const CFX_Matrix* pMatrix); |
131 void DrawWidgetAfter(IFWL_Widget* pWidget, | 124 void DrawWidgetAfter(IFWL_Widget* pWidget, |
132 CFX_Graphics* pGraphics, | 125 CFX_Graphics* pGraphics, |
133 CFX_RectF& rtClip, | 126 CFX_RectF& rtClip, |
134 const CFX_Matrix* pMatrix); | 127 const CFX_Matrix* pMatrix); |
135 bool IsNeedRepaint(IFWL_Widget* pWidget, | 128 bool IsNeedRepaint(IFWL_Widget* pWidget, |
136 CFX_Matrix* pMatrix, | 129 CFX_Matrix* pMatrix, |
137 const CFX_RectF& rtDirty); | 130 const CFX_RectF& rtDirty); |
138 bool UseOffscreenDirect(IFWL_Widget* pWidget) const; | 131 bool UseOffscreenDirect(IFWL_Widget* pWidget) const; |
139 | 132 |
140 bool IsAbleNative(IFWL_Widget* pWidget) const; | 133 bool IsAbleNative(IFWL_Widget* pWidget) const; |
141 | 134 |
142 uint32_t m_dwCapability; | 135 uint32_t m_dwCapability; |
143 std::map<IFWL_Widget*, std::unique_ptr<CFWL_WidgetMgrItem>> m_mapWidgetItem; | 136 std::map<IFWL_Widget*, std::unique_ptr<CFWL_WidgetMgrItem>> m_mapWidgetItem; |
144 CXFA_FWLAdapterWidgetMgr* const m_pAdapter; | 137 CXFA_FWLAdapterWidgetMgr* const m_pAdapter; |
145 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | 138 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) |
146 CFX_RectF m_rtScreen; | 139 CFX_RectF m_rtScreen; |
147 #endif | 140 #endif |
148 }; | 141 }; |
149 | 142 |
150 #endif // XFA_FWL_CORE_CFWL_WIDGETMGR_H_ | 143 #endif // XFA_FWL_CORE_CFWL_WIDGETMGR_H_ |
OLD | NEW |