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

Side by Side Diff: xfa/fwl/core/fwl_widgetimp.cpp

Issue 2430563003: Merge IFWL_App and FWL_AppImp together (Closed)
Patch Set: Cleanup Created 4 years, 2 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
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 #include "xfa/fwl/core/fwl_widgetimp.h" 7 #include "xfa/fwl/core/fwl_widgetimp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "xfa/fde/tto/fde_textout.h" 11 #include "xfa/fde/tto/fde_textout.h"
12 #include "xfa/fwl/basewidget/ifwl_combobox.h" 12 #include "xfa/fwl/basewidget/ifwl_combobox.h"
13 #include "xfa/fwl/core/cfwl_message.h" 13 #include "xfa/fwl/core/cfwl_message.h"
14 #include "xfa/fwl/core/cfwl_themebackground.h" 14 #include "xfa/fwl/core/cfwl_themebackground.h"
15 #include "xfa/fwl/core/cfwl_themepart.h" 15 #include "xfa/fwl/core/cfwl_themepart.h"
16 #include "xfa/fwl/core/cfwl_themetext.h" 16 #include "xfa/fwl/core/cfwl_themetext.h"
17 #include "xfa/fwl/core/cfwl_widgetmgr.h" 17 #include "xfa/fwl/core/cfwl_widgetmgr.h"
18 #include "xfa/fwl/core/fwl_appimp.h"
19 #include "xfa/fwl/core/fwl_noteimp.h" 18 #include "xfa/fwl/core/fwl_noteimp.h"
20 #include "xfa/fwl/core/ifwl_app.h" 19 #include "xfa/fwl/core/ifwl_app.h"
21 #include "xfa/fwl/core/ifwl_form.h" 20 #include "xfa/fwl/core/ifwl_form.h"
22 #include "xfa/fwl/core/ifwl_themeprovider.h" 21 #include "xfa/fwl/core/ifwl_themeprovider.h"
23 #include "xfa/fwl/core/ifwl_widget.h" 22 #include "xfa/fwl/core/ifwl_widget.h"
24 #include "xfa/fxfa/xfa_ffapp.h" 23 #include "xfa/fxfa/xfa_ffapp.h"
25 24
26 #define FWL_STYLEEXT_MNU_Vert (1L << 0) 25 #define FWL_STYLEEXT_MNU_Vert (1L << 0)
27 26
28 IFWL_Widget::IFWL_Widget() {} 27 IFWL_Widget::IFWL_Widget() {}
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 171
173 FWL_Error CFWL_WidgetImp::Initialize() { 172 FWL_Error CFWL_WidgetImp::Initialize() {
174 IFWL_App* pApp = FWL_GetApp(); 173 IFWL_App* pApp = FWL_GetApp();
175 if (!pApp) 174 if (!pApp)
176 return FWL_Error::Indefinite; 175 return FWL_Error::Indefinite;
177 176
178 CXFA_FFApp* pAdapter = pApp->GetAdapterNative(); 177 CXFA_FFApp* pAdapter = pApp->GetAdapterNative();
179 if (!pAdapter) 178 if (!pAdapter)
180 return FWL_Error::Indefinite; 179 return FWL_Error::Indefinite;
181 180
182 SetOwnerApp(static_cast<CFWL_AppImp*>(FWL_GetApp()->GetImpl())); 181 SetOwnerApp(FWL_GetApp());
183 182
184 IFWL_Widget* pParent = m_pProperties->m_pParent; 183 IFWL_Widget* pParent = m_pProperties->m_pParent;
185 m_pWidgetMgr->InsertWidget(pParent, m_pInterface); 184 m_pWidgetMgr->InsertWidget(pParent, m_pInterface);
186 if (!IsChild()) { 185 if (!IsChild()) {
187 IFWL_Widget* pOwner = m_pProperties->m_pOwner; 186 IFWL_Widget* pOwner = m_pProperties->m_pOwner;
188 if (pOwner) 187 if (pOwner)
189 m_pWidgetMgr->SetOwner(pOwner, m_pInterface); 188 m_pWidgetMgr->SetOwner(pOwner, m_pInterface);
190 } 189 }
191 return FWL_Error::Succeeded; 190 return FWL_Error::Succeeded;
192 } 191 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 m_pCurDelegate = m_pDelegate; 484 m_pCurDelegate = m_pDelegate;
486 } 485 }
487 if (!pDelegate) { 486 if (!pDelegate) {
488 return m_pCurDelegate; 487 return m_pCurDelegate;
489 } 488 }
490 IFWL_WidgetDelegate* pOldDelegate = m_pCurDelegate; 489 IFWL_WidgetDelegate* pOldDelegate = m_pCurDelegate;
491 m_pCurDelegate = pDelegate; 490 m_pCurDelegate = pDelegate;
492 return pOldDelegate; 491 return pOldDelegate;
493 } 492 }
494 IFWL_App* CFWL_WidgetImp::GetOwnerApp() const { 493 IFWL_App* CFWL_WidgetImp::GetOwnerApp() const {
495 return static_cast<IFWL_App*>(m_pOwnerApp->GetInterface()); 494 return m_pOwnerApp;
496 } 495 }
497 FWL_Error CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { 496 FWL_Error CFWL_WidgetImp::SetOwnerApp(IFWL_App* pOwnerApp) {
498 m_pOwnerApp = pOwnerApp; 497 m_pOwnerApp = pOwnerApp;
499 return FWL_Error::Succeeded; 498 return FWL_Error::Succeeded;
500 } 499 }
501 IFWL_Widget* CFWL_WidgetImp::GetInterface() const { 500 IFWL_Widget* CFWL_WidgetImp::GetInterface() const {
502 return m_pInterface; 501 return m_pInterface;
503 } 502 }
504 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) { 503 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) {
505 m_pInterface = pInterface; 504 m_pInterface = pInterface;
506 } 505 }
507 506
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 do { 634 do {
636 pUp = (pUp->GetStyles() & FWL_WGTSTYLE_Popup) 635 pUp = (pUp->GetStyles() & FWL_WGTSTYLE_Popup)
637 ? m_pWidgetMgr->GetOwnerWidget(pUp) 636 ? m_pWidgetMgr->GetOwnerWidget(pUp)
638 : m_pWidgetMgr->GetParentWidget(pUp); 637 : m_pWidgetMgr->GetParentWidget(pUp);
639 if (pUp) { 638 if (pUp) {
640 IFWL_ThemeProvider* pRet = pUp->GetThemeProvider(); 639 IFWL_ThemeProvider* pRet = pUp->GetThemeProvider();
641 if (pRet) 640 if (pRet)
642 return pRet; 641 return pRet;
643 } 642 }
644 } while (pUp); 643 } while (pUp);
645 return FWL_GetApp()->GetThemeProvider(); 644 return nullptr;
Lei Zhang 2016/10/18 16:48:15 Always nullptr?
dsinclair 2016/10/18 17:00:22 Yes, there were no calls to SetThemeProvider that
646 } 645 }
647 CFWL_WidgetImp* CFWL_WidgetImp::GetRootOuter() { 646 CFWL_WidgetImp* CFWL_WidgetImp::GetRootOuter() {
648 IFWL_Widget* pRet = m_pOuter; 647 IFWL_Widget* pRet = m_pOuter;
649 if (!pRet) 648 if (!pRet)
650 return nullptr; 649 return nullptr;
651 while (IFWL_Widget* pOuter = pRet->GetOuter()) { 650 while (IFWL_Widget* pOuter = pRet->GetOuter()) {
652 pRet = pOuter; 651 pRet = pOuter;
653 } 652 }
654 return static_cast<CFWL_WidgetImp*>(pRet->GetImpl()); 653 return static_cast<CFWL_WidgetImp*>(pRet->GetImpl());
655 } 654 }
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 } 1039 }
1041 } 1040 }
1042 1041
1043 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} 1042 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {}
1044 1043
1045 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 1044 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
1046 const CFX_Matrix* pMatrix) { 1045 const CFX_Matrix* pMatrix) {
1047 CFWL_EvtDraw evt; 1046 CFWL_EvtDraw evt;
1048 evt.m_pGraphics = pGraphics; 1047 evt.m_pGraphics = pGraphics;
1049 } 1048 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_widgetimp.h ('k') | xfa/fwl/core/ifwl_app.h » ('j') | xfa/fwl/core/ifwl_app.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698