From c4c17fbbcf4cd2b72af7c10db0320d78099df66d Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 13 Apr 2016 13:24:39 -0700 Subject: Remove unused FWL methods This CL removes various methods from FWL that are not called. Review URL: https://codereview.chromium.org/1886703005 --- xfa/fwl/core/fwl_formimp.cpp | 22 +------- xfa/fwl/core/fwl_formimp.h | 4 +- xfa/fwl/core/fwl_noteimp.cpp | 106 +++----------------------------------- xfa/fwl/core/fwl_noteimp.h | 15 +----- xfa/fwl/core/fwl_widgetimp.cpp | 22 -------- xfa/fwl/core/fwl_widgetimp.h | 7 ++- xfa/fwl/core/fwl_widgetmgrimp.cpp | 17 ------ xfa/fwl/core/ifwl_notedriver.h | 9 ---- xfa/fwl/core/ifwl_noteloop.h | 1 - xfa/fwl/core/ifwl_tooltiptarget.h | 5 -- xfa/fwl/core/ifwl_widget.h | 8 --- xfa/fwl/core/ifwl_widgetmgr.h | 1 - 12 files changed, 13 insertions(+), 204 deletions(-) diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 14f3b33c46..27014d9d62 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -451,20 +451,7 @@ CFWL_WidgetImp* CFWL_FormImp::GetSubFocus() { void CFWL_FormImp::SetSubFocus(CFWL_WidgetImp* pWidget) { m_pSubFocus = pWidget; } -CFX_MapAccelerators& CFWL_FormImp::GetAccelerator() { - return m_mapAccelerators; -} -void CFWL_FormImp::SetAccelerator(CFX_MapAccelerators* pAccelerators) { - if (!pAccelerators) - return; - m_mapAccelerators.RemoveAll(); - uint32_t vrKey, rValue; - FX_POSITION pos = pAccelerators->GetStartPosition(); - while (pos) { - pAccelerators->GetNextAssoc(pos, vrKey, rValue); - m_mapAccelerators.SetAt(vrKey, rValue); - } -} + void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) { IFWL_App* pApp = FWL_GetApp(); if (!pApp) @@ -1170,10 +1157,3 @@ void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { eClose.m_pSrcTarget = m_pOwner->m_pInterface; m_pOwner->DispatchEvent(&eClose); } -FWL_ERR FWL_Accelerator_SetForm(IFWL_Form* pFrom, - CFX_MapAccelerators* pMapAccel) { - CFWL_FormImp* pImp = static_cast(pFrom->GetImpl()); - if (!pImp) - return FWL_ERR_Indefinite; - return FWL_ERR_Succeeded; -} diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h index 766cd85cbf..b56a51b2da 100644 --- a/xfa/fwl/core/fwl_formimp.h +++ b/xfa/fwl/core/fwl_formimp.h @@ -92,8 +92,6 @@ class CFWL_FormImp : public CFWL_PanelImp { IFWL_ThemeProvider* pTheme); CFWL_WidgetImp* GetSubFocus(); void SetSubFocus(CFWL_WidgetImp* pWidget); - CFX_MapAccelerators& GetAccelerator(); - void SetAccelerator(CFX_MapAccelerators* pAccelerators); protected: void ShowChildWidget(IFWL_Widget* pParent); @@ -136,7 +134,7 @@ class CFWL_FormImp : public CFWL_PanelImp { FX_FLOAT fLimitMin, FX_FLOAT fLimitMax, FX_BOOL bTop); - CFX_MapAccelerators m_mapAccelerators; + CFX_RectF m_rtRestore; CFX_RectF m_rtCaptionText; CFX_RectF m_rtRelative; diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index 8b632afba8..05963bba81 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -23,12 +23,7 @@ CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm) : m_pForm(pForm), m_bContinueModal(TRUE) {} -FX_BOOL CFWL_NoteLoop::PreProcessMessage(CFWL_Message* pMessage) { - if (!m_pForm) { - return FALSE; - } - return TranslateAccelerator(pMessage); -} + FWL_ERR CFWL_NoteLoop::Idle(int32_t count) { #if (_FX_OS_ == _FX_WIN32_DESKTOP_) if (count <= 0) { @@ -61,32 +56,7 @@ FWL_ERR CFWL_NoteLoop::EndModalLoop() { #endif return FWL_ERR_Succeeded; } -FX_BOOL CFWL_NoteLoop::TranslateAccelerator(CFWL_Message* pMessage) { - if (pMessage->GetClassID() != FWL_MSGHASH_Key) { - return FALSE; - } - CFWL_MsgKey* pMsgKey = static_cast(pMessage); - if (pMsgKey->m_dwCmd != FWL_MSGKEYCMD_KeyDown) { - return FALSE; - } - CFX_MapAccelerators& accel = - static_cast(m_pForm)->GetAccelerator(); - FX_POSITION pos = accel.GetStartPosition(); - if (!pos) { - return FALSE; - } - uint32_t vrKey, rValue; - while (pos) { - accel.GetNextAssoc(pos, vrKey, rValue); - uint32_t dwFlags = (vrKey & 0xFF00) >> 8; - uint32_t m_dwKeyCode = vrKey & 0x00FF; - if (pMsgKey->m_dwFlags == dwFlags && pMsgKey->m_dwKeyCode == m_dwKeyCode) { - GenerateCommondEvent(rValue); - return TRUE; - } - } - return FALSE; -} + FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { m_pForm = pForm; return FWL_ERR_Succeeded; @@ -104,12 +74,10 @@ void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { } CFWL_NoteDriver::CFWL_NoteDriver() : m_sendEventCalled(0), - m_maxSize(500), m_bFullScreen(FALSE), m_pHover(nullptr), m_pFocus(nullptr), - m_pGrab(nullptr), - m_hook(nullptr) { + m_pGrab(nullptr) { m_pNoteLoop = new CFWL_NoteLoop; PushNoteLoop(m_pNoteLoop); } @@ -197,13 +165,6 @@ FWL_ERR CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { ClearInvalidEventTargets(bRemoveAll); } -int32_t CFWL_NoteDriver::GetQueueMaxSize() const { - return m_maxSize; -} -FWL_ERR CFWL_NoteDriver::SetQueueMaxSize(const int32_t size) { - m_maxSize = size; - return FWL_ERR_Succeeded; -} IFWL_NoteThread* CFWL_NoteDriver::GetOwnerThread() const { return FWL_GetApp(); } @@ -411,13 +372,8 @@ FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { pMessage->Release(); return TRUE; } - FX_BOOL bHookMessage = FALSE; - if (m_hook) { - bHookMessage = (*m_hook)(pMessage, m_hookInfo); - } - if (!bHookMessage && !pNoteLoop->PreProcessMessage(pMessage)) { - ProcessMessage(pMessage); - } + ProcessMessage(pMessage); + pMessage->Release(); return TRUE; } @@ -430,10 +386,7 @@ CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() { int32_t CFWL_NoteDriver::CountLoop() { return m_noteLoopQueue.GetSize(); } -void CFWL_NoteDriver::SetHook(FWLMessageHookCallback callback, void* info) { - m_hook = callback; - m_hookInfo = info; -} + FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { CFWL_WidgetMgr* pWidgetMgr = static_cast(FWL_GetWidgetMgr()); IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() @@ -1041,50 +994,3 @@ FX_BOOL CFWL_ToolTipContainer::ProcessLeave(CFWL_EvtMouse* pEvt) { IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { return pCurTarget; } -FX_ERR CFWL_ToolTipContainer::SetToolTipInitialDelay(int32_t nDelayTime) { - m_ToolTipDp->m_nInitDelayTime = nDelayTime; - return FWL_ERR_Succeeded; -} -FX_ERR CFWL_ToolTipContainer::SetToolTipAutoPopDelay(int32_t nDelayTime) { - m_ToolTipDp->m_nAutoPopDelayTime = nDelayTime; - return FWL_ERR_Succeeded; -} -FWL_ERR FWL_AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { - return CFWL_ToolTipContainer::getInstance()->AddToolTipTarget(pTarget); -} -FWL_ERR FWL_RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) { - return CFWL_ToolTipContainer::getInstance()->RemoveToolTipTarget(pTarget); -} -FWL_ERR FWL_SetToolTipInitialDelay(int32_t nDelayTime) { - return CFWL_ToolTipContainer::getInstance()->SetToolTipInitialDelay( - nDelayTime); -} -FWL_ERR FWL_SetToolTipAutoPopDelay(int32_t nDelayTime) { - return CFWL_ToolTipContainer::getInstance()->SetToolTipAutoPopDelay( - nDelayTime); -} -IFWL_Widget* FWL_GetCurrentThreadModalWidget(IFWL_NoteThread* pNoteThread) { - if (!pNoteThread) - return NULL; - CFWL_NoteDriver* noteDriver = - static_cast(pNoteThread->GetNoteDriver()); - if (!noteDriver) - return NULL; - if (noteDriver->CountLoop() == 1) { - return NULL; - } - CFWL_NoteLoop* topLoop = noteDriver->GetTopLoop(); - if (!topLoop) - return NULL; - CFWL_WidgetImp* widget = topLoop->GetForm(); - if (!widget) - return NULL; - return widget->GetInterface(); -} -FWL_ERR FWL_SetHook(IFWL_NoteDriver* driver, - FWLMessageHookCallback callback, - void* info) { - CFWL_NoteDriver* noteDriver = static_cast(driver); - noteDriver->SetHook(callback, info); - return FWL_ERR_Succeeded; -} diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h index 8f3e0c3737..d1d611a5d7 100644 --- a/xfa/fwl/core/fwl_noteimp.h +++ b/xfa/fwl/core/fwl_noteimp.h @@ -28,17 +28,15 @@ class IFWL_ToolTipTarget; class CFWL_NoteLoop : public IFWL_NoteLoop { public: - CFWL_NoteLoop(CFWL_WidgetImp* pForm = NULL); + CFWL_NoteLoop(CFWL_WidgetImp* pForm = nullptr); + ~CFWL_NoteLoop() override {} // IFWL_NoteLoop: - ~CFWL_NoteLoop() override {} - FX_BOOL PreProcessMessage(CFWL_Message* pMessage) override; FWL_ERR Idle(int32_t count) override; CFWL_WidgetImp* GetForm(); FX_BOOL ContinueModal(); FWL_ERR EndModalLoop(); - FX_BOOL TranslateAccelerator(CFWL_Message* pMessage); FWL_ERR SetMainForm(CFWL_WidgetImp* pForm); protected: @@ -60,8 +58,6 @@ class CFWL_NoteDriver : public IFWL_NoteDriver { uint32_t dwFilter = FWL_EVENT_ALL_MASK) override; FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener) override; void ClearEventTargets(FX_BOOL bRemoveAll) override; - int32_t GetQueueMaxSize() const override; - FWL_ERR SetQueueMaxSize(const int32_t size) override; IFWL_NoteThread* GetOwnerThread() const override; FWL_ERR PushNoteLoop(IFWL_NoteLoop* pNoteLoop) override; IFWL_NoteLoop* PopNoteLoop() override; @@ -81,7 +77,6 @@ class CFWL_NoteDriver : public IFWL_NoteDriver { FX_BOOL UnqueueMessage(CFWL_NoteLoop* pNoteLoop); CFWL_NoteLoop* GetTopLoop(); int32_t CountLoop(); - void SetHook(FWLMessageHookCallback callback, void* info); FX_BOOL ProcessMessage(CFWL_Message* pMessage); protected: @@ -106,14 +101,11 @@ class CFWL_NoteDriver : public IFWL_NoteDriver { CFX_PtrArray m_noteLoopQueue; CFX_MapPtrToPtr m_eventTargets; int32_t m_sendEventCalled; - int32_t m_maxSize; FX_BOOL m_bFullScreen; IFWL_Widget* m_pHover; IFWL_Widget* m_pFocus; IFWL_Widget* m_pGrab; CFWL_NoteLoop* m_pNoteLoop; - FWLMessageHookCallback m_hook; - void* m_hookInfo; }; typedef CFX_MapPtrTemplate CFWL_EventSource; @@ -151,9 +143,6 @@ class CFWL_ToolTipContainer { FX_BOOL ProcessEnter(CFWL_EvtMouse* pEvt, IFWL_Widget* pOwner); FX_BOOL ProcessLeave(CFWL_EvtMouse* pEvt); - FX_ERR SetToolTipInitialDelay(int32_t iDelayTime); - FX_ERR SetToolTipAutoPopDelay(int32_t iDelayTime); - protected: CFWL_ToolTipContainer(); virtual ~CFWL_ToolTipContainer(); diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index 961b60e172..19b2f2430a 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -1085,25 +1085,3 @@ IFWL_Custom::IFWL_Custom() {} FWL_ERR IFWL_Custom::SetProxy(IFWL_Proxy* pProxy) { return static_cast(GetImpl())->SetProxy(pProxy); } -void FWL_SetWidgetRect(IFWL_Widget* widget, const CFX_RectF& rect) { - static_cast(widget->GetImpl())->m_pProperties->m_rtWidget = - rect; -} -void FWL_SetWidgetStates(IFWL_Widget* widget, uint32_t dwStates) { - static_cast(widget->GetImpl())->m_pProperties->m_dwStates = - dwStates; -} -void FWL_SetWidgetStyles(IFWL_Widget* widget, uint32_t dwStyles) { - static_cast(widget->GetImpl())->m_pProperties->m_dwStyles = - dwStyles; -} -FWL_ERR FWL_EnabelWidget(IFWL_Widget* widget, FX_BOOL bEnable) { - widget->SetStates(FWL_WGTSTATE_Disabled, !bEnable); - IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr(); - IFWL_Widget* child = widgetMgr->GetWidget(widget, FWL_WGTRELATION_FirstChild); - while (child) { - FWL_EnabelWidget(child, bEnable); - child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); - } - return FWL_ERR_Succeeded; -} diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h index e460fb9733..e7520d6c87 100644 --- a/xfa/fwl/core/fwl_widgetimp.h +++ b/xfa/fwl/core/fwl_widgetimp.h @@ -138,6 +138,9 @@ class CFWL_WidgetImp : public CFWL_TargetImp { void NotifyDriver(); FX_BOOL IsParent(IFWL_Widget* pParent); + + friend class CFWL_WidgetImpDelegate; + CFWL_WidgetMgr* m_pWidgetMgr; CFWL_NoteThreadImp* m_pOwnerThread; CFWL_WidgetImpProperties* m_pProperties; @@ -147,10 +150,6 @@ class CFWL_WidgetImp : public CFWL_TargetImp { IFWL_Widget* m_pOuter; IFWL_Widget* m_pInterface; int32_t m_iLock; - friend class CFWL_WidgetImpDelegate; - friend void FWL_SetWidgetRect(IFWL_Widget* widget, const CFX_RectF& rect); - friend void FWL_SetWidgetStates(IFWL_Widget* widget, uint32_t dwStates); - friend void FWL_SetWidgetStyles(IFWL_Widget* widget, uint32_t dwStyles); }; class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate { diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp index cbf6a9d883..e0ffd9c7b9 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.cpp +++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp @@ -1007,20 +1007,3 @@ FX_BOOL CFWL_WidgetMgrDelegate::bUseOffscreenDirect(IFWL_Widget* pWidget) { #endif return pItem->iRedrawCounter == 0; } -FX_BOOL FWL_WidgetIsChild(IFWL_Widget* parent, IFWL_Widget* find) { - if (!find) { - return FALSE; - } - IFWL_Widget* child = - FWL_GetWidgetMgr()->GetWidget(parent, FWL_WGTRELATION_FirstChild); - while (child) { - if (child == find) { - return TRUE; - } - if (FWL_WidgetIsChild(child, find)) { - return TRUE; - } - child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); - } - return FALSE; -} diff --git a/xfa/fwl/core/ifwl_notedriver.h b/xfa/fwl/core/ifwl_notedriver.h index 706e97af15..64b4a634b9 100644 --- a/xfa/fwl/core/ifwl_notedriver.h +++ b/xfa/fwl/core/ifwl_notedriver.h @@ -36,8 +36,6 @@ class IFWL_NoteDriver { uint32_t dwFilter = FWL_EVENT_ALL_MASK) = 0; virtual FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener) = 0; virtual void ClearEventTargets(FX_BOOL bRemoveAll) = 0; - virtual int32_t GetQueueMaxSize() const = 0; - virtual FWL_ERR SetQueueMaxSize(const int32_t size) = 0; virtual IFWL_NoteThread* GetOwnerThread() const = 0; virtual FWL_ERR PushNoteLoop(IFWL_NoteLoop* pNoteLoop) = 0; virtual IFWL_NoteLoop* PopNoteLoop() = 0; @@ -47,11 +45,4 @@ class IFWL_NoteDriver { virtual FWL_ERR Run() = 0; }; -IFWL_Widget* FWL_GetCurrentThreadModalWidget(IFWL_NoteThread* pNoteThread); - -typedef FX_BOOL (*FWLMessageHookCallback)(CFWL_Message* msg, void* info); -FWL_ERR FWL_SetHook(IFWL_NoteDriver* driver, - FWLMessageHookCallback callback, - void* info); - #endif // XFA_FWL_CORE_IFWL_NOTEDRIVER_H_ diff --git a/xfa/fwl/core/ifwl_noteloop.h b/xfa/fwl/core/ifwl_noteloop.h index a56d880b4a..b0b182e793 100644 --- a/xfa/fwl/core/ifwl_noteloop.h +++ b/xfa/fwl/core/ifwl_noteloop.h @@ -15,7 +15,6 @@ class CFWL_Message; class IFWL_NoteLoop { public: virtual ~IFWL_NoteLoop() {} - virtual FX_BOOL PreProcessMessage(CFWL_Message* pMessage) = 0; virtual FWL_ERR Idle(int32_t count) = 0; }; diff --git a/xfa/fwl/core/ifwl_tooltiptarget.h b/xfa/fwl/core/ifwl_tooltiptarget.h index b0bbe44a7a..0b364f2754 100644 --- a/xfa/fwl/core/ifwl_tooltiptarget.h +++ b/xfa/fwl/core/ifwl_tooltiptarget.h @@ -29,9 +29,4 @@ class IFWL_ToolTipTarget { virtual FWL_ERR GetToolTipPos(CFX_PointF& pt) { return FWL_ERR_Indefinite; } }; -FWL_ERR FWL_AddToolTipTarget(IFWL_ToolTipTarget* pTarget); -FWL_ERR FWL_RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget); -FWL_ERR FWL_SetToolTipInitialDelay(int32_t iDelayTime); -FWL_ERR FWL_SetToolTipAutoPopDelay(int32_t iDelayTime); - #endif // XFA_FWL_CORE_IFWL_TOOLTIPTARGET_H_ diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h index eb1183fdf1..d8e757ac59 100644 --- a/xfa/fwl/core/ifwl_widget.h +++ b/xfa/fwl/core/ifwl_widget.h @@ -58,12 +58,4 @@ class IFWL_Widget : public IFWL_Target { CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); }; -typedef CFX_MapPtrTemplate CFX_MapAccelerators; - -FWL_ERR FWL_Accelerator_SetApp(CFX_MapAccelerators* pMapAccel); -FWL_ERR FWL_Accelerator_SetThread(CFX_MapAccelerators* pMapAccel); -FWL_ERR FWL_Accelerator_SetForm(IFWL_Form* pFrom, - CFX_MapAccelerators* pMapAccel); -FWL_ERR FWL_EnabelWidget(IFWL_Widget* widget, FX_BOOL bEnable); - #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ diff --git a/xfa/fwl/core/ifwl_widgetmgr.h b/xfa/fwl/core/ifwl_widgetmgr.h index 955e6bab5b..3924ba8a29 100644 --- a/xfa/fwl/core/ifwl_widgetmgr.h +++ b/xfa/fwl/core/ifwl_widgetmgr.h @@ -43,6 +43,5 @@ class IFWL_WidgetMgr { }; IFWL_WidgetMgr* FWL_GetWidgetMgr(); -FX_BOOL FWL_WidgetIsChild(IFWL_Widget* parent, IFWL_Widget* find); #endif // XFA_FWL_CORE_IFWL_WIDGETMGR_H_ -- cgit v1.2.3