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_adapterwidgetmgr.h" | 11 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" |
12 #include "xfa/fwl/core/ifwl_app.h" | 12 #include "xfa/fwl/core/ifwl_app.h" |
13 #include "xfa/fwl/core/ifwl_widget.h" | 13 #include "xfa/fwl/core/ifwl_widget.h" |
14 | 14 |
15 IFWL_App* IFWL_App::Create(IFWL_AdapterNative* pAdapter) { | 15 IFWL_App* IFWL_App::Create(IFWL_AdapterNative* 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 IFWL_AdapterNative* IFWL_App::GetAdapterNative() { | 31 IFWL_AdapterNative* 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 } |
38 | 38 |
39 IFWL_ThemeProvider* IFWL_App::GetThemeProvider() { | 39 IFWL_ThemeProvider* IFWL_App::GetThemeProvider() { |
40 return static_cast<CFWL_AppImp*>(GetImpl())->GetThemeProvider(); | 40 return static_cast<CFWL_AppImp*>(GetImpl())->GetThemeProvider(); |
41 } | 41 } |
42 | 42 |
43 FWL_ERR IFWL_App::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 43 FWL_Error IFWL_App::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { |
44 return static_cast<CFWL_AppImp*>(GetImpl())->SetThemeProvider(pThemeProvider); | 44 return static_cast<CFWL_AppImp*>(GetImpl())->SetThemeProvider(pThemeProvider); |
45 } | 45 } |
46 | 46 |
47 FWL_ERR IFWL_App::Exit(int32_t iExitCode) { | 47 FWL_Error IFWL_App::Exit(int32_t iExitCode) { |
48 return static_cast<CFWL_AppImp*>(GetImpl())->Exit(iExitCode); | 48 return static_cast<CFWL_AppImp*>(GetImpl())->Exit(iExitCode); |
49 } | 49 } |
50 | 50 |
51 CFWL_NoteDriver* IFWL_App::GetNoteDriver() const { | 51 CFWL_NoteDriver* IFWL_App::GetNoteDriver() const { |
52 return static_cast<CFWL_AppImp*>(GetImpl())->GetNoteDriver(); | 52 return static_cast<CFWL_AppImp*>(GetImpl())->GetNoteDriver(); |
53 } | 53 } |
54 | 54 |
55 CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* pAdapter) | 55 CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* 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 IFWL_AdapterNative* CFWL_AppImp::GetAdapterNative() const { | 75 IFWL_AdapterNative* CFWL_AppImp::GetAdapterNative() const { |
76 return m_pAdapterNative; | 76 return m_pAdapterNative; |
77 } | 77 } |
78 IFWL_AdapterWidgetMgr* FWL_GetAdapterWidgetMgr() { | 78 IFWL_AdapterWidgetMgr* 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 FWL_ERR CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 85 FWL_Error CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { |
86 m_pThemeProvider = pThemeProvider; | 86 m_pThemeProvider = pThemeProvider; |
87 return FWL_ERR_Succeeded; | 87 return FWL_Error::Succeeded; |
88 } | 88 } |
89 FWL_ERR CFWL_AppImp::Exit(int32_t iExitCode) { | 89 FWL_Error CFWL_AppImp::Exit(int32_t iExitCode) { |
90 while (m_pNoteDriver->PopNoteLoop()) { | 90 while (m_pNoteDriver->PopNoteLoop()) { |
91 continue; | 91 continue; |
92 } | 92 } |
93 return m_pWidgetMgr->GetAdapterWidgetMgr()->Exit(0); | 93 return m_pWidgetMgr->GetAdapterWidgetMgr()->Exit(0); |
94 } | 94 } |
95 IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const { | 95 IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const { |
96 return m_pThemeProvider; | 96 return m_pThemeProvider; |
97 } | 97 } |
98 IFWL_AdapterNative* FWL_GetAdapterNative() { | 98 IFWL_AdapterNative* FWL_GetAdapterNative() { |
99 IFWL_App* pApp = FWL_GetApp(); | 99 IFWL_App* pApp = FWL_GetApp(); |
100 if (!pApp) | 100 if (!pApp) |
101 return NULL; | 101 return NULL; |
102 return pApp->GetAdapterNative(); | 102 return pApp->GetAdapterNative(); |
103 } | 103 } |
104 static IFWL_App* _theApp = NULL; | 104 static IFWL_App* _theApp = NULL; |
105 IFWL_App* FWL_GetApp() { | 105 IFWL_App* FWL_GetApp() { |
106 return _theApp; | 106 return _theApp; |
107 } | 107 } |
108 void FWL_SetApp(IFWL_App* pApp) { | 108 void FWL_SetApp(IFWL_App* pApp) { |
109 _theApp = pApp; | 109 _theApp = pApp; |
110 } | 110 } |
OLD | NEW |