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

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

Issue 1998303002: Use std::map, std::unique_ptr in fwl_widgetmgrimp.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: explicit ctor Created 4 years, 7 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 | « no previous file | xfa/fwl/core/fwl_widgetmgrimp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_FWL_WIDGETMGRIMP_H_ 7 #ifndef XFA_FWL_CORE_FWL_WIDGETMGRIMP_H_
8 #define XFA_FWL_CORE_FWL_WIDGETMGRIMP_H_ 8 #define XFA_FWL_CORE_FWL_WIDGETMGRIMP_H_
9 9
10 #include <map>
11 #include <memory>
12
10 #include "core/fxcrt/include/fx_system.h" 13 #include "core/fxcrt/include/fx_system.h"
11 #include "xfa/fwl/core/fwl_error.h" 14 #include "xfa/fwl/core/fwl_error.h"
12 #include "xfa/fwl/core/ifwl_widgetmgr.h" 15 #include "xfa/fwl/core/ifwl_widgetmgr.h"
13 #include "xfa/fxgraphics/include/cfx_graphics.h" 16 #include "xfa/fxgraphics/include/cfx_graphics.h"
14 17
15 #define FWL_WGTMGR_DisableThread 0x00000001 18 #define FWL_WGTMGR_DisableThread 0x00000001
16 #define FWL_WGTMGR_DisableForm 0x00000002 19 #define FWL_WGTMGR_DisableForm 0x00000002
17 20
18 class CFWL_Message; 21 class CFWL_Message;
19 class CFWL_WidgetMgrDelegate; 22 class CFWL_WidgetMgrDelegate;
20 class CXFA_FFApp; 23 class CXFA_FFApp;
21 class CXFA_FWLAdapterWidgetMgr; 24 class CXFA_FWLAdapterWidgetMgr;
22 class CFX_Graphics; 25 class CFX_Graphics;
23 class CFX_Matrix; 26 class CFX_Matrix;
24 class IFWL_Widget; 27 class IFWL_Widget;
25 28
26 class CFWL_WidgetMgrItem { 29 class CFWL_WidgetMgrItem {
27 public: 30 public:
28 CFWL_WidgetMgrItem() 31 CFWL_WidgetMgrItem() : CFWL_WidgetMgrItem(nullptr) {}
29 : pParent(NULL), 32 explicit CFWL_WidgetMgrItem(IFWL_Widget* widget)
30 pOwner(NULL), 33 : pParent(nullptr),
31 pChild(NULL), 34 pOwner(nullptr),
32 pPrevious(NULL), 35 pChild(nullptr),
33 pNext(NULL), 36 pPrevious(nullptr),
34 pWidget(NULL), 37 pNext(nullptr),
35 pOffscreen(NULL), 38 pWidget(widget),
36 iRedrawCounter(0) 39 iRedrawCounter(0)
37 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) 40 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
38 , 41 ,
39 bOutsideChanged(FALSE) 42 bOutsideChanged(FALSE)
40 #endif 43 #endif
41 { 44 {
42 } 45 }
43 ~CFWL_WidgetMgrItem() { 46 ~CFWL_WidgetMgrItem() {}
44 if (pOffscreen) { 47
45 delete pOffscreen;
46 pOffscreen = NULL;
47 }
48 }
49 CFWL_WidgetMgrItem* pParent; 48 CFWL_WidgetMgrItem* pParent;
50 CFWL_WidgetMgrItem* pOwner; 49 CFWL_WidgetMgrItem* pOwner;
51 CFWL_WidgetMgrItem* pChild; 50 CFWL_WidgetMgrItem* pChild;
52 CFWL_WidgetMgrItem* pPrevious; 51 CFWL_WidgetMgrItem* pPrevious;
53 CFWL_WidgetMgrItem* pNext; 52 CFWL_WidgetMgrItem* pNext;
54 IFWL_Widget* pWidget; 53 IFWL_Widget* const pWidget;
55 CFX_Graphics* pOffscreen; 54 std::unique_ptr<CFX_Graphics> pOffscreen;
56 int32_t iRedrawCounter; 55 int32_t iRedrawCounter;
57 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) 56 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
58 FX_BOOL bOutsideChanged; 57 FX_BOOL bOutsideChanged;
59 #endif 58 #endif
60 }; 59 };
61 60
62 class CFWL_WidgetMgr : public IFWL_WidgetMgr { 61 class CFWL_WidgetMgr : public IFWL_WidgetMgr {
63 public: 62 public:
64 CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative); 63 CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative);
65 ~CFWL_WidgetMgr() override; 64 ~CFWL_WidgetMgr() override;
(...skipping 23 matching lines...) Expand all
89 IFWL_Widget* nextTab(IFWL_Widget* parent, IFWL_Widget* focus, FX_BOOL& bFind); 88 IFWL_Widget* nextTab(IFWL_Widget* parent, IFWL_Widget* focus, FX_BOOL& bFind);
90 int32_t CountRadioButtonGroup(IFWL_Widget* pFirst); 89 int32_t CountRadioButtonGroup(IFWL_Widget* pFirst);
91 IFWL_Widget* GetSiblingRadioButton(IFWL_Widget* pWidget, FX_BOOL bNext); 90 IFWL_Widget* GetSiblingRadioButton(IFWL_Widget* pWidget, FX_BOOL bNext);
92 IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton); 91 IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton);
93 void GetSameGroupRadioButton(IFWL_Widget* pRadioButton, 92 void GetSameGroupRadioButton(IFWL_Widget* pRadioButton,
94 CFX_ArrayTemplate<IFWL_Widget*>& group); 93 CFX_ArrayTemplate<IFWL_Widget*>& group);
95 IFWL_Widget* GetDefaultButton(IFWL_Widget* pParent); 94 IFWL_Widget* GetDefaultButton(IFWL_Widget* pParent);
96 void AddRedrawCounts(IFWL_Widget* pWidget); 95 void AddRedrawCounts(IFWL_Widget* pWidget);
97 void ResetRedrawCounts(IFWL_Widget* pWidget); 96 void ResetRedrawCounts(IFWL_Widget* pWidget);
98 CXFA_FWLAdapterWidgetMgr* GetAdapterWidgetMgr() const { return m_pAdapter; } 97 CXFA_FWLAdapterWidgetMgr* GetAdapterWidgetMgr() const { return m_pAdapter; }
99 CFWL_WidgetMgrDelegate* GetDelegate() const { return m_pDelegate; } 98 CFWL_WidgetMgrDelegate* GetDelegate() const { return m_pDelegate.get(); }
100 CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget); 99 CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget) const;
101 bool IsThreadEnabled(); 100 bool IsThreadEnabled();
102 bool IsFormDisabled(); 101 bool IsFormDisabled();
103 FX_BOOL GetAdapterPopupPos(IFWL_Widget* pWidget, 102 FX_BOOL GetAdapterPopupPos(IFWL_Widget* pWidget,
104 FX_FLOAT fMinHeight, 103 FX_FLOAT fMinHeight,
105 FX_FLOAT fMaxHeight, 104 FX_FLOAT fMaxHeight,
106 const CFX_RectF& rtAnchor, 105 const CFX_RectF& rtAnchor,
107 CFX_RectF& rtPopup); 106 CFX_RectF& rtPopup);
108 107
109 protected: 108 protected:
110 int32_t TravelWidgetMgr(CFWL_WidgetMgrItem* pParent, 109 int32_t TravelWidgetMgr(CFWL_WidgetMgrItem* pParent,
111 int32_t* pIndex, 110 int32_t* pIndex,
112 CFWL_WidgetMgrItem* pItem, 111 CFWL_WidgetMgrItem* pItem,
113 IFWL_Widget** pWidget = NULL); 112 IFWL_Widget** pWidget = NULL);
114 FX_BOOL IsAbleNative(IFWL_Widget* pWidget); 113 FX_BOOL IsAbleNative(IFWL_Widget* pWidget);
115 CFX_MapPtrToPtr m_mapWidgetItem; 114
116 CXFA_FWLAdapterWidgetMgr* m_pAdapter;
117 CFWL_WidgetMgrDelegate* m_pDelegate;
118 friend class CFWL_WidgetMgrDelegate;
119 uint32_t m_dwCapability; 115 uint32_t m_dwCapability;
116 std::unique_ptr<CFWL_WidgetMgrDelegate> m_pDelegate;
117 std::map<IFWL_Widget*, std::unique_ptr<CFWL_WidgetMgrItem>> m_mapWidgetItem;
118 CXFA_FWLAdapterWidgetMgr* const m_pAdapter;
120 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) 119 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
121 CFX_RectF m_rtScreen; 120 CFX_RectF m_rtScreen;
122 #endif 121 #endif
122 friend class CFWL_WidgetMgrDelegate;
123 }; 123 };
124 124
125 class CFWL_WidgetMgrDelegate { 125 class CFWL_WidgetMgrDelegate {
126 public: 126 public:
127 CFWL_WidgetMgrDelegate(CFWL_WidgetMgr* pWidgetMgr); 127 CFWL_WidgetMgrDelegate(CFWL_WidgetMgr* pWidgetMgr);
128 ~CFWL_WidgetMgrDelegate() {} 128 ~CFWL_WidgetMgrDelegate() {}
129 129
130 FWL_Error OnSetCapability(uint32_t dwCapability = FWL_WGTMGR_DisableThread); 130 FWL_Error OnSetCapability(uint32_t dwCapability = FWL_WGTMGR_DisableThread);
131 void OnProcessMessageToForm(CFWL_Message* pMessage); 131 void OnProcessMessageToForm(CFWL_Message* pMessage);
132 void OnDrawWidget(IFWL_Widget* pWidget, 132 void OnDrawWidget(IFWL_Widget* pWidget,
(...skipping 14 matching lines...) Expand all
147 const CFX_Matrix* pMatrix); 147 const CFX_Matrix* pMatrix);
148 FX_BOOL IsNeedRepaint(IFWL_Widget* pWidget, 148 FX_BOOL IsNeedRepaint(IFWL_Widget* pWidget,
149 CFX_Matrix* pMatrix, 149 CFX_Matrix* pMatrix,
150 const CFX_RectF& rtDirty); 150 const CFX_RectF& rtDirty);
151 FX_BOOL bUseOffscreenDirect(IFWL_Widget* pWidget); 151 FX_BOOL bUseOffscreenDirect(IFWL_Widget* pWidget);
152 152
153 CFWL_WidgetMgr* m_pWidgetMgr; 153 CFWL_WidgetMgr* m_pWidgetMgr;
154 }; 154 };
155 155
156 #endif // XFA_FWL_CORE_FWL_WIDGETMGRIMP_H_ 156 #endif // XFA_FWL_CORE_FWL_WIDGETMGRIMP_H_
OLDNEW
« no previous file with comments | « no previous file | xfa/fwl/core/fwl_widgetmgrimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698