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 #include "xfa/fwl/core/fwl_appimp.h" | 7 #include "xfa/fwl/core/fwl_appimp.h" |
8 | 8 |
9 #include "xfa/fwl/core/fwl_noteimp.h" | 9 #include "xfa/fwl/core/fwl_noteimp.h" |
10 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 10 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
11 #include "xfa/fwl/core/ifwl_app.h" | 11 #include "xfa/fwl/core/ifwl_app.h" |
12 #include "xfa/fwl/core/ifwl_widget.h" | 12 #include "xfa/fwl/core/ifwl_widget.h" |
13 #include "xfa/fxfa/app/xfa_fwladapter.h" | 13 #include "xfa/fxfa/app/xfa_fwladapter.h" |
14 | 14 |
15 IFWL_App* IFWL_App::Create(CXFA_FFApp* pAdapter) { | 15 IFWL_App* IFWL_App::Create(CXFA_FFApp* pAdapter) { |
16 IFWL_App* pApp = new IFWL_App; | 16 IFWL_App* pApp = new IFWL_App; |
17 pApp->SetImpl(new CFWL_AppImp(pApp, pAdapter)); | 17 pApp->SetImpl(new CFWL_AppImp(pApp, pAdapter)); |
18 return pApp; | 18 return pApp; |
19 } | 19 } |
20 | 20 |
21 void IFWL_App::Release() {} | 21 void IFWL_App::Release() {} |
22 | 22 |
23 FWL_ERR IFWL_App::Initialize() { | 23 FWL_Error IFWL_App::Initialize() { |
24 return static_cast<CFWL_AppImp*>(GetImpl())->Initialize(); | 24 return static_cast<CFWL_AppImp*>(GetImpl())->Initialize(); |
25 } | 25 } |
26 | 26 |
27 FWL_ERR IFWL_App::Finalize() { | 27 FWL_Error IFWL_App::Finalize() { |
28 return static_cast<CFWL_AppImp*>(GetImpl())->Finalize(); | 28 return static_cast<CFWL_AppImp*>(GetImpl())->Finalize(); |
29 } | 29 } |
30 | 30 |
31 CXFA_FFApp* IFWL_App::GetAdapterNative() { | 31 CXFA_FFApp* IFWL_App::GetAdapterNative() { |
32 return static_cast<CFWL_AppImp*>(GetImpl())->GetAdapterNative(); | 32 return static_cast<CFWL_AppImp*>(GetImpl())->GetAdapterNative(); |
33 } | 33 } |
34 | 34 |
35 IFWL_WidgetMgr* IFWL_App::GetWidgetMgr() { | 35 IFWL_WidgetMgr* IFWL_App::GetWidgetMgr() { |
36 return static_cast<CFWL_AppImp*>(GetImpl())->GetWidgetMgr(); | 36 return static_cast<CFWL_AppImp*>(GetImpl())->GetWidgetMgr(); |
37 } | 37 } |
(...skipping 17 matching lines...) Expand all Loading... |
55 CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, CXFA_FFApp* pAdapter) | 55 CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, CXFA_FFApp* pAdapter) |
56 : m_pAdapterNative(pAdapter), | 56 : m_pAdapterNative(pAdapter), |
57 m_pThemeProvider(nullptr), | 57 m_pThemeProvider(nullptr), |
58 m_pNoteDriver(new CFWL_NoteDriver), | 58 m_pNoteDriver(new CFWL_NoteDriver), |
59 m_pIface(pIface) {} | 59 m_pIface(pIface) {} |
60 | 60 |
61 CFWL_AppImp::~CFWL_AppImp() { | 61 CFWL_AppImp::~CFWL_AppImp() { |
62 CFWL_ToolTipContainer::DeleteInstance(); | 62 CFWL_ToolTipContainer::DeleteInstance(); |
63 } | 63 } |
64 | 64 |
65 FWL_ERR CFWL_AppImp::Initialize() { | 65 FWL_Error CFWL_AppImp::Initialize() { |
66 if (!m_pWidgetMgr) { | 66 if (!m_pWidgetMgr) { |
67 m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative)); | 67 m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative)); |
68 } | 68 } |
69 return FWL_ERR_Succeeded; | 69 return FWL_Error::Succeeded; |
70 } | 70 } |
71 FWL_ERR CFWL_AppImp::Finalize() { | 71 FWL_Error CFWL_AppImp::Finalize() { |
72 m_pWidgetMgr.reset(); | 72 m_pWidgetMgr.reset(); |
73 return FWL_ERR_Succeeded; | 73 return FWL_Error::Succeeded; |
74 } | 74 } |
75 CXFA_FFApp* CFWL_AppImp::GetAdapterNative() const { | 75 CXFA_FFApp* CFWL_AppImp::GetAdapterNative() const { |
76 return m_pAdapterNative; | 76 return m_pAdapterNative; |
77 } | 77 } |
78 CXFA_FWLAdapterWidgetMgr* FWL_GetAdapterWidgetMgr() { | 78 CXFA_FWLAdapterWidgetMgr* FWL_GetAdapterWidgetMgr() { |
79 return static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()) | 79 return static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()) |
80 ->GetAdapterWidgetMgr(); | 80 ->GetAdapterWidgetMgr(); |
81 } | 81 } |
82 IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() const { | 82 IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() const { |
83 return m_pWidgetMgr.get(); | 83 return m_pWidgetMgr.get(); |
84 } | 84 } |
| 85 |
85 void CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 86 void CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { |
86 m_pThemeProvider = pThemeProvider; | 87 m_pThemeProvider = pThemeProvider; |
87 } | 88 } |
88 | 89 |
89 void CFWL_AppImp::Exit(int32_t iExitCode) { | 90 void CFWL_AppImp::Exit(int32_t iExitCode) { |
90 while (m_pNoteDriver->PopNoteLoop()) { | 91 while (m_pNoteDriver->PopNoteLoop()) { |
91 continue; | 92 continue; |
92 } | 93 } |
93 } | 94 } |
94 | 95 |
95 IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const { | 96 IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const { |
96 return m_pThemeProvider; | 97 return m_pThemeProvider; |
97 } | 98 } |
98 | 99 |
99 CXFA_FFApp* FWL_GetAdapterNative() { | 100 CXFA_FFApp* FWL_GetAdapterNative() { |
100 IFWL_App* pApp = FWL_GetApp(); | 101 IFWL_App* pApp = FWL_GetApp(); |
101 if (!pApp) | 102 if (!pApp) |
102 return NULL; | 103 return NULL; |
103 return pApp->GetAdapterNative(); | 104 return pApp->GetAdapterNative(); |
104 } | 105 } |
105 | 106 |
106 static IFWL_App* g_theApp = nullptr; | 107 static IFWL_App* g_theApp = nullptr; |
107 IFWL_App* FWL_GetApp() { | 108 IFWL_App* FWL_GetApp() { |
108 return g_theApp; | 109 return g_theApp; |
109 } | 110 } |
110 | 111 |
111 void FWL_SetApp(IFWL_App* pApp) { | 112 void FWL_SetApp(IFWL_App* pApp) { |
112 g_theApp = pApp; | 113 g_theApp = pApp; |
113 } | 114 } |
OLD | NEW |