From 8f4bf9a8ac211e150f7fa4d8ed061f264cb3aa9e Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 4 May 2016 13:51:51 -0700 Subject: More define cleanup. This CL converts defines into constants, enums, enum classes or removes them as needed. Review-Url: https://codereview.chromium.org/1938163002 --- xfa/fwl/basewidget/fwl_listboximp.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'xfa/fwl/basewidget/fwl_listboximp.cpp') diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index d514f7e1e3..b2a4e2c20c 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -17,7 +17,11 @@ #include "xfa/fwl/core/fwl_widgetimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" -#define FWL_LISTBOX_ItemTextMargin 2 +namespace { + +const int kItemTextMargin = 2; + +} // namespace // static IFWL_ListBox* IFWL_ListBox::Create(const CFWL_WidgetImpProperties& properties, @@ -699,7 +703,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, return; } CFX_RectF rtText(rtItem); - rtText.Deflate(FWL_LISTBOX_ItemTextMargin, FWL_LISTBOX_ItemTextMargin); + rtText.Deflate(kItemTextMargin, kItemTextMargin); if (bHasIcon || bHasCheck) { rtText.Deflate(rtItem.height, 0, 0, 0); } @@ -765,7 +769,7 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { } } else { fWidth = GetMaxTextWidth(); - fWidth += 2 * FWL_LISTBOX_ItemTextMargin; + fWidth += 2 * kItemTextMargin; if (!bAutoSize) { FX_FLOAT fActualWidth = m_rtClient.width - rtUIMargin.left - rtUIMargin.width; @@ -935,7 +939,7 @@ FX_FLOAT CFWL_ListBoxImp::GetItemHeigt() { static_cast(GetThemeCapacity(CFWL_WidgetCapacity::FontSize)); if (!pfFont) return 20; - return *pfFont + 2 * FWL_LISTBOX_ItemTextMargin; + return *pfFont + 2 * kItemTextMargin; } void CFWL_ListBoxImp::InitScrollBar(FX_BOOL bVert) { if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) { @@ -999,11 +1003,11 @@ int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast(pMessage); switch (pMsg->m_dwCmd) { - case FWL_MSGMOUSECMD_LButtonDown: { + case FWL_MouseCommand::LeftButtonDown: { OnLButtonDown(pMsg); break; } - case FWL_MSGMOUSECMD_LButtonUp: { + case FWL_MouseCommand::LeftButtonUp: { OnLButtonUp(pMsg); break; } @@ -1018,7 +1022,7 @@ int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } case CFWL_MessageType::Key: { CFWL_MsgKey* pMsg = static_cast(pMessage); - if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown) + if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pMsg); break; } -- cgit v1.2.3