From b4455b90b1c86ab94986e4f470c963f1e91b27ba Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 21 Nov 2016 08:47:23 -0800 Subject: Remove unused FWL_WGTSTYLE_Icon The FWL_WGTSTYLE_Icon flag is never set. This CL removes it and the supporting Icon code from IFWL_Form. Review-Url: https://codereview.chromium.org/2516433003 --- xfa/fwl/core/fwl_widgetdef.h | 1 - xfa/fwl/core/ifwl_form.cpp | 69 +------------------------------------------- xfa/fwl/core/ifwl_form.h | 16 +--------- 3 files changed, 2 insertions(+), 84 deletions(-) diff --git a/xfa/fwl/core/fwl_widgetdef.h b/xfa/fwl/core/fwl_widgetdef.h index eb4388884f..8644d99474 100644 --- a/xfa/fwl/core/fwl_widgetdef.h +++ b/xfa/fwl/core/fwl_widgetdef.h @@ -11,7 +11,6 @@ #define FWL_WGTSTYLE_Popup (1L << 0) #define FWL_WGTSTYLE_Child (2L << 0) #define FWL_WGTSTYLE_Border (1L << 2) -#define FWL_WGTSTYLE_Icon (1L << 5) #define FWL_WGTSTYLE_MinimizeBox (1L << 6) #define FWL_WGTSTYLE_MaximizeBox (1L << 7) #define FWL_WGTSTYLE_CloseBox (1L << 8) diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp index faf0ee650b..bd8f8bb7e1 100644 --- a/xfa/fwl/core/ifwl_form.cpp +++ b/xfa/fwl/core/ifwl_form.cpp @@ -53,12 +53,9 @@ IFWL_Form::IFWL_Form(const IFWL_App* app, m_bMaximized(false), m_bSetMaximize(false), m_bCustomizeLayout(false), - m_bDoModalFlag(false), - m_pBigIcon(nullptr), - m_pSmallIcon(nullptr) { + m_bDoModalFlag(false) { m_rtRelative.Reset(); m_rtRestore.Reset(); - m_rtIcon.Reset(); RegisterForm(); RegisterEventTarget(); @@ -105,12 +102,6 @@ void IFWL_Form::Update() { if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); -#ifndef FWL_UseMacSystemBorder - SetThemeData(); - if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) - UpdateIcon(); -#endif - Layout(); } @@ -212,11 +203,6 @@ void IFWL_Form::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { param.m_dwStates = iState; pTheme->DrawBackground(¶m); } - if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { - param.m_iPart = CFWL_Part::Icon; - if (HasIcon()) - DrawIconImage(pGraphics, pTheme, pMatrix); - } #if (_FX_OS_ == _FX_MACOSX_) { @@ -393,22 +379,6 @@ int32_t IFWL_Form::GetSysBtnIndex(CFWL_SysBtn* pBtn) { return arrBtn.Find(pBtn); } -void IFWL_Form::DrawIconImage(CFX_Graphics* pGs, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix) { - IFWL_FormDP* pData = - static_cast(m_pProperties->m_pDataProvider); - CFWL_ThemeBackground param; - param.m_pWidget = this; - param.m_iPart = CFWL_Part::Icon; - param.m_pGraphics = pGs; - param.m_pImage = pData->GetIcon(this, false); - param.m_rtPart = m_rtIcon; - if (pMatrix) - param.m_matrix.Concat(*pMatrix); - pTheme->DrawBackground(¶m); -} - void IFWL_Form::GetEdgeRect(CFX_RectF& rtEdge) { rtEdge = m_rtRelative; if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { @@ -490,15 +460,6 @@ void IFWL_Form::ResetSysBtn() { } m_iSysBox++; } - - IFWL_FormDP* pData = - static_cast(m_pProperties->m_pDataProvider); - if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon && - pData->GetIcon(this, false)) { - if (!m_bCustomizeLayout) { - m_rtIcon.Set(5, (0 - m_fSmallIconSz) / 2, m_fSmallIconSz, m_fSmallIconSz); - } - } } void IFWL_Form::RegisterForm() { @@ -527,34 +488,6 @@ void IFWL_Form::UnRegisterForm() { pDriver->UnRegisterForm(this); } -void IFWL_Form::SetThemeData() { - m_fSmallIconSz = - *static_cast(GetThemeCapacity(CFWL_WidgetCapacity::SmallIcon)); - m_fBigIconSz = - *static_cast(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon)); -} - -bool IFWL_Form::HasIcon() { - IFWL_FormDP* pData = - static_cast(m_pProperties->m_pDataProvider); - return !!pData->GetIcon(this, false); -} - -void IFWL_Form::UpdateIcon() { - CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); - if (!pWidgetMgr) - return; - - IFWL_FormDP* pData = - static_cast(m_pProperties->m_pDataProvider); - CFX_DIBitmap* pBigIcon = pData->GetIcon(this, true); - CFX_DIBitmap* pSmallIcon = pData->GetIcon(this, false); - if (pBigIcon) - m_pBigIcon = pBigIcon; - if (pSmallIcon) - m_pSmallIcon = pSmallIcon; -} - void IFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { #ifndef FWL_UseMacSystemBorder if (!pMessage) diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 994cb15f34..672f1d2530 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -61,10 +61,7 @@ class IFWL_Widget; class IFWL_ThemeProvider; class CFWL_SysBtn; -class IFWL_FormDP : public IFWL_DataProvider { - public: - virtual CFX_DIBitmap* GetIcon(IFWL_Widget* pWidget, bool bBig) = 0; -}; +class IFWL_FormDP : public IFWL_DataProvider {}; class IFWL_Form : public IFWL_Widget { public: @@ -99,18 +96,12 @@ class IFWL_Form : public IFWL_Widget { CFWL_SysBtn* GetSysBtnByState(uint32_t dwState); CFWL_SysBtn* GetSysBtnByIndex(int32_t nIndex); int32_t GetSysBtnIndex(CFWL_SysBtn* pBtn); - void DrawIconImage(CFX_Graphics* pGs, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = nullptr); void GetEdgeRect(CFX_RectF& rtEdge); void SetWorkAreaRect(); void Layout(); void ResetSysBtn(); void RegisterForm(); void UnRegisterForm(); - void SetThemeData(); - bool HasIcon(); - void UpdateIcon(); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); @@ -122,7 +113,6 @@ class IFWL_Form : public IFWL_Widget { #endif CFX_RectF m_rtRestore; CFX_RectF m_rtRelative; - CFX_RectF m_rtIcon; CFWL_SysBtn* m_pCloseBox; CFWL_SysBtn* m_pMinBox; CFWL_SysBtn* m_pMaxBox; @@ -137,10 +127,6 @@ class IFWL_Form : public IFWL_Widget { bool m_bSetMaximize; bool m_bCustomizeLayout; bool m_bDoModalFlag; - FX_FLOAT m_fSmallIconSz; - FX_FLOAT m_fBigIconSz; - CFX_DIBitmap* m_pBigIcon; - CFX_DIBitmap* m_pSmallIcon; }; #endif // XFA_FWL_CORE_IFWL_FORM_H_ -- cgit v1.2.3