diff options
author | dsinclair <dsinclair@chromium.org> | 2016-05-04 13:51:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-04 13:51:51 -0700 |
commit | 8f4bf9a8ac211e150f7fa4d8ed061f264cb3aa9e (patch) | |
tree | 9ac5bb23a12623ea77ecb13e74a665733efedc8c /xfa/fwl/basewidget | |
parent | 7d89e728a450c681c53d40d7f67ee2eef0400705 (diff) | |
download | pdfium-8f4bf9a8ac211e150f7fa4d8ed061f264cb3aa9e.tar.xz |
More define cleanup.
This CL converts defines into constants, enums, enum classes or removes them
as needed.
Review-Url: https://codereview.chromium.org/1938163002
Diffstat (limited to 'xfa/fwl/basewidget')
-rw-r--r-- | xfa/fwl/basewidget/fwl_checkboximp.cpp | 23 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_comboboximp.cpp | 40 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_datetimepickerimp.cpp | 32 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_editimp.cpp | 38 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_listboximp.cpp | 18 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_monthcalendarimp.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_pushbuttonimp.cpp | 12 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_scrollbarimp.cpp | 11 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_spinbuttonimp.cpp | 24 | ||||
-rw-r--r-- | xfa/fwl/basewidget/ifwl_barcode.h | 30 |
10 files changed, 127 insertions, 109 deletions
diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/basewidget/fwl_checkboximp.cpp index f11a917eb1..ba63e2f663 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.cpp +++ b/xfa/fwl/basewidget/fwl_checkboximp.cpp @@ -18,7 +18,11 @@ #include "xfa/fwl/core/fwl_widgetmgrimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" -#define FWL_CKB_CaptionMargin 5 +namespace { + +const int kCaptionMargin = 5; + +} // namespace // static IFWL_CheckBox* IFWL_CheckBox::Create(const CFWL_WidgetImpProperties& properties, @@ -84,7 +88,7 @@ FWL_ERR CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_MultiLine); rect.Set(0, 0, sz.x, sz.y); } - rect.Inflate(FWL_CKB_CaptionMargin, FWL_CKB_CaptionMargin); + rect.Inflate(kCaptionMargin, kCaptionMargin); IFWL_CheckBoxDP* pData = static_cast<IFWL_CheckBoxDP*>(m_pProperties->m_pDataProvider); FX_FLOAT fCheckBox = pData->GetBoxSize(m_pInterface); @@ -241,7 +245,7 @@ void CFWL_CheckBoxImp::Layout() { m_rtBox.Set(fBoxLeft, fBoxTop, fCheckBox, fCheckBox); m_rtCaption.Set(fTextLeft, m_rtClient.top, fTextRight - fTextLeft, m_rtClient.height); - m_rtCaption.Inflate(-FWL_CKB_CaptionMargin, -FWL_CKB_CaptionMargin); + m_rtCaption.Inflate(-kCaptionMargin, -kCaptionMargin); CFX_RectF rtFocus; rtFocus.Set(m_rtCaption.left, m_rtCaption.top, m_rtCaption.width, m_rtCaption.height); @@ -429,21 +433,20 @@ int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - uint32_t dwCmd = pMsg->m_dwCmd; - switch (dwCmd) { - case FWL_MSGMOUSECMD_LButtonDown: { + switch (pMsg->m_dwCmd) { + case FWL_MouseCommand::LeftButtonDown: { OnLButtonDown(pMsg); break; } - case FWL_MSGMOUSECMD_LButtonUp: { + case FWL_MouseCommand::LeftButtonUp: { OnLButtonUp(pMsg); break; } - case FWL_MSGMOUSECMD_MouseMove: { + case FWL_MouseCommand::Move: { OnMouseMove(pMsg); break; } - case FWL_MSGMOUSECMD_MouseLeave: { + case FWL_MouseCommand::Leave: { OnMouseLeave(pMsg); break; } @@ -454,7 +457,7 @@ int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } case CFWL_MessageType::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); - if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) + if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pKey); break; } diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index 35ac5fa240..e86a52eaa0 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -159,7 +159,7 @@ int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - if ((pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) && + if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) && ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { m_pOwner->SetSelected(); m_pOwner->SetComboBoxFocus(TRUE); @@ -308,24 +308,24 @@ int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { return pDelegate->OnProcessMessage(pMsg); } } - uint32_t dwCmd = pMsg->m_dwCmd; - switch (dwCmd) { - case FWL_MSGMOUSECMD_MouseMove: { + switch (pMsg->m_dwCmd) { + case FWL_MouseCommand::Move: { backDefault = FALSE; OnDropListMouseMove(pMsg); break; } - case FWL_MSGMOUSECMD_LButtonDown: { + case FWL_MouseCommand::LeftButtonDown: { backDefault = FALSE; OnDropListLButtonDown(pMsg); break; } - case FWL_MSGMOUSECMD_LButtonUp: { + case FWL_MouseCommand::LeftButtonUp: { backDefault = FALSE; OnDropListLButtonUp(pMsg); break; } - default: {} + default: + break; } } else if (dwHashCode == CFWL_MessageType::Key) { backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); @@ -415,7 +415,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { CFWL_ComboBoxImp* pOuter = static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); FX_BOOL bPropagate = FALSE; - if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { + if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { uint32_t dwKeyCode = pKey->m_dwKeyCode; switch (dwKeyCode) { case FWL_VKEY_Return: @@ -432,7 +432,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { } default: { bPropagate = TRUE; } } - } else if (pKey->m_dwCmd == FWL_MSGKEYCMD_Char) { + } else if (pKey->m_dwCmd == FWL_KeyCommand::Char) { bPropagate = TRUE; } if (bPropagate) { @@ -1381,19 +1381,19 @@ int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(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; } - case FWL_MSGMOUSECMD_MouseMove: { + case FWL_MouseCommand::Move: { OnMouseMove(pMsg); break; } - case FWL_MSGMOUSECMD_MouseLeave: { + case FWL_MouseCommand::Leave: { OnMouseLeave(pMsg); break; } @@ -1615,11 +1615,11 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( backDefault = FALSE; CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { - case FWL_MSGMOUSECMD_LButtonDown: { + case FWL_MouseCommand::LeftButtonDown: { DisForm_OnLButtonDown(pMsg); break; } - case FWL_MSGMOUSECMD_LButtonUp: { + case FWL_MouseCommand::LeftButtonUp: { OnLButtonUp(pMsg); break; } @@ -1631,10 +1631,10 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( case CFWL_MessageType::Key: { backDefault = FALSE; CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); - if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) + if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp) break; if (m_pOwner->DisForm_IsDropListShowed() && - pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { + pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { FX_BOOL bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || pKey->m_dwKeyCode == FWL_VKEY_Down || pKey->m_dwKeyCode == FWL_VKEY_Return || @@ -1758,15 +1758,15 @@ int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(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; } - case FWL_MSGMOUSECMD_MouseMove: { + case FWL_MouseCommand::Move: { OnMouseMove(pMsg); break; } diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index 84a4437fff..7cefdc3477 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -18,8 +18,12 @@ #include "xfa/fwl/core/fwl_widgetmgrimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" -#define FWL_DTP_WIDTH 100 -#define FWL_DTP_HEIGHT 20 +namespace { + +const int kDateTimePickerWidth = 100; +const int kDateTimePickerHeight = 20; + +} // namespace // static IFWL_DateTimePicker* IFWL_DateTimePicker::Create( @@ -189,8 +193,8 @@ int32_t CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { if (dwHashCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); - if (pMouse->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown || - pMouse->m_dwCmd == FWL_MSGMOUSECMD_RButtonDown) { + if (pMouse->m_dwCmd == FWL_MouseCommand::LeftButtonDown || + pMouse->m_dwCmd == FWL_MouseCommand::RightButtonDown) { if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; } @@ -244,10 +248,10 @@ int32_t CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( return pDelegate->OnProcessMessage(pMessage); } else if (dwCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) { + if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) { OnLButtonDownEx(pMsg); return 1; - } else if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonUp) { + } else if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { OnLButtonUpEx(pMsg); return 1; } @@ -375,7 +379,7 @@ int32_t CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { if (pMessage->GetClassID() == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonUp) { + if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { DisForm_OnLButtonUpEx(pMsg); return 1; } @@ -487,7 +491,7 @@ FWL_ERR CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, return DisForm_GetWidgetRect(rect, bAutoSize); } if (bAutoSize) { - rect.Set(0, 0, FWL_DTP_WIDTH, FWL_DTP_HEIGHT); + rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight); CFWL_WidgetImp::GetWidgetRect(rect, TRUE); } else { rect = m_pProperties->m_rtWidget; @@ -531,7 +535,7 @@ FWL_ERR CFWL_DateTimePickerImp::Update() { CFX_RectF rtMonthCal; m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); CFX_RectF rtPopUp; - rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + FWL_DTP_HEIGHT, + rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); @@ -957,7 +961,7 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { CFX_RectF rtMonthCal; m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); CFX_RectF rtPopUp; - rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + FWL_DTP_HEIGHT, + rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); @@ -1033,19 +1037,19 @@ int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMouse->m_dwCmd) { - case FWL_MSGMOUSECMD_LButtonDown: { + case FWL_MouseCommand::LeftButtonDown: { OnLButtonDown(pMouse); break; } - case FWL_MSGMOUSECMD_LButtonUp: { + case FWL_MouseCommand::LeftButtonUp: { OnLButtonUp(pMouse); break; } - case FWL_MSGMOUSECMD_MouseMove: { + case FWL_MouseCommand::Move: { OnMouseMove(pMouse); break; } - case FWL_MSGMOUSECMD_MouseLeave: { + case FWL_MouseCommand::Leave: { OnMouseLeave(pMouse); break; } diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index a80b89f9a7..8deec9beb2 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -32,6 +32,8 @@ namespace { +const int kEditMargin = 3; + bool FX_EDIT_ISLATINWORD(FX_WCHAR c) { return c == 0x2D || (c <= 0x005A && c >= 0x0041) || (c <= 0x007A && c >= 0x0061) || (c <= 0x02AF && c >= 0x00C0) || @@ -195,7 +197,7 @@ FX_BOOL IFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, return static_cast<CFWL_EditImp*>(GetImpl()) ->ReplaceSpellCheckWord(pointf, bsReplace); } -#define FWL_EDIT_Margin 3 + CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_WidgetImp(properties, pOuter), @@ -282,13 +284,13 @@ FWL_ERR CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); rect.width += *pfWidth; - rect.width += FWL_EDIT_Margin; + rect.width += kEditMargin; } if (IsShowScrollBar(FALSE)) { FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); rect.height += *pfWidth; - rect.height += FWL_EDIT_Margin; + rect.height += kEditMargin; } } } @@ -1473,8 +1475,8 @@ void CFWL_EditImp::Layout() { InitScrollBar(); CFX_RectF rtVertScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - rtVertScr.Set(m_rtClient.right() + FWL_EDIT_Margin, m_rtClient.top, - fWidth, m_rtClient.height); + rtVertScr.Set(m_rtClient.right() + kEditMargin, m_rtClient.top, fWidth, + m_rtClient.height); } else { rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, m_rtClient.height); @@ -1493,7 +1495,7 @@ void CFWL_EditImp::Layout() { InitScrollBar(FALSE); CFX_RectF rtHoriScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + FWL_EDIT_Margin, + rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, m_rtClient.width, fWidth); } else { rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, @@ -1526,8 +1528,8 @@ void CFWL_EditImp::LayoutScrollBar() { InitScrollBar(); CFX_RectF rtVertScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - rtVertScr.Set(m_rtClient.right() + FWL_EDIT_Margin, m_rtClient.top, - fWidth, m_rtClient.height); + rtVertScr.Set(m_rtClient.right() + kEditMargin, m_rtClient.top, fWidth, + m_rtClient.height); } else { rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, m_rtClient.height); @@ -1552,7 +1554,7 @@ void CFWL_EditImp::LayoutScrollBar() { InitScrollBar(FALSE); CFX_RectF rtHoriScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + FWL_EDIT_Margin, + rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, m_rtClient.width, fWidth); } else { rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, @@ -1735,25 +1737,24 @@ int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - uint32_t dwCmd = pMsg->m_dwCmd; - switch (dwCmd) { - case FWL_MSGMOUSECMD_LButtonDown: { + switch (pMsg->m_dwCmd) { + case FWL_MouseCommand::LeftButtonDown: { OnLButtonDown(pMsg); break; } - case FWL_MSGMOUSECMD_LButtonUp: { + case FWL_MouseCommand::LeftButtonUp: { OnLButtonUp(pMsg); break; } - case FWL_MSGMOUSECMD_LButtonDblClk: { + case FWL_MouseCommand::LeftButtonDblClk: { OnButtonDblClk(pMsg); break; } - case FWL_MSGMOUSECMD_MouseMove: { + case FWL_MouseCommand::Move: { OnMouseMove(pMsg); break; } - case FWL_MSGMOUSECMD_RButtonDown: { + case FWL_MouseCommand::RightButtonDown: { DoButtonDown(pMsg); break; } @@ -1764,10 +1765,9 @@ int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } case CFWL_MessageType::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); - uint32_t dwCmd = pKey->m_dwCmd; - if (dwCmd == FWL_MSGKEYCMD_KeyDown) + if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pKey); - else if (dwCmd == FWL_MSGKEYCMD_Char) + else if (pKey->m_dwCmd == FWL_KeyCommand::Char) OnChar(pKey); break; } 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<FX_FLOAT*>(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<CFWL_MsgMouse*>(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<CFWL_MsgKey*>(pMessage); - if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown) + if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pMsg); break; } diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index 4b7f342bf7..3feb1122a7 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -1039,19 +1039,19 @@ int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMouse->m_dwCmd) { - case FWL_MSGMOUSECMD_LButtonDown: { + case FWL_MouseCommand::LeftButtonDown: { OnLButtonDown(pMouse); break; } - case FWL_MSGMOUSECMD_LButtonUp: { + case FWL_MouseCommand::LeftButtonUp: { OnLButtonUp(pMouse); break; } - case FWL_MSGMOUSECMD_MouseMove: { + case FWL_MouseCommand::Move: { OnMouseMove(pMouse); break; } - case FWL_MSGMOUSECMD_MouseLeave: { + case FWL_MouseCommand::Leave: { OnMouseLeave(pMouse); break; } diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp index 9d6e3b19a9..b1e5f6bdb4 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp @@ -422,19 +422,19 @@ int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(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; } - case FWL_MSGMOUSECMD_MouseMove: { + case FWL_MouseCommand::Move: { OnMouseMove(pMsg); break; } - case FWL_MSGMOUSECMD_MouseLeave: { + case FWL_MouseCommand::Leave: { OnMouseLeave(pMsg); break; } @@ -445,7 +445,7 @@ int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } case CFWL_MessageType::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); - if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) + if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pKey); break; } @@ -544,7 +544,7 @@ void CFWL_PushButtonImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { if (pMsg->m_dwKeyCode == FWL_VKEY_Return) { CFWL_EvtMouse wmMouse; wmMouse.m_pSrcTarget = m_pOwner->m_pInterface; - wmMouse.m_dwCmd = FWL_MSGMOUSECMD_LButtonUp; + wmMouse.m_dwCmd = FWL_MouseCommand::LeftButtonUp; m_pOwner->DispatchEvent(&wmMouse); CFWL_EvtClick wmClick; wmClick.m_pSrcTarget = m_pOwner->m_pInterface; diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp index 69c28959d9..0db7c29e9d 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp @@ -636,21 +636,20 @@ int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { CFWL_MessageType dwMsgCode = pMessage->GetClassID(); if (dwMsgCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - uint32_t dwCmd = pMsg->m_dwCmd; - switch (dwCmd) { - case FWL_MSGMOUSECMD_LButtonDown: { + switch (pMsg->m_dwCmd) { + case FWL_MouseCommand::LeftButtonDown: { OnLButtonDown(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); break; } - case FWL_MSGMOUSECMD_LButtonUp: { + case FWL_MouseCommand::LeftButtonUp: { OnLButtonUp(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); break; } - case FWL_MSGMOUSECMD_MouseMove: { + case FWL_MouseCommand::Move: { OnMouseMove(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); break; } - case FWL_MSGMOUSECMD_MouseLeave: { + case FWL_MouseCommand::Leave: { OnMouseLeave(); break; } diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp index 5692087762..9a70d7187d 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp @@ -16,9 +16,13 @@ #include "xfa/fwl/core/ifwl_themeprovider.h" #include "xfa/fwl/core/ifwl_timer.h" -#define FWL_SPN_MinWidth 18 -#define FWL_SPN_MinHeight 32 -#define FWL_SPIN_Elapse 200 +namespace { + +const int kMinWidth = 18; +const int kMinHeight = 32; +const int kElapseTime = 200; + +} // namespace // static IFWL_SpinButton* IFWL_SpinButton::Create( @@ -75,7 +79,7 @@ FWL_ERR CFWL_SpinButtonImp::Finalize() { } FWL_ERR CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { - rect.Set(0, 0, FWL_SPN_MinWidth, FWL_SPN_MinHeight); + rect.Set(0, 0, kMinWidth, kMinHeight); CFWL_WidgetImp::GetWidgetRect(rect, TRUE); } else { rect = m_pProperties->m_rtWidget; @@ -218,19 +222,19 @@ int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(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; } - case FWL_MSGMOUSECMD_MouseMove: { + case FWL_MouseCommand::Move: { OnMouseMove(pMsg); break; } - case FWL_MSGMOUSECMD_MouseLeave: { + case FWL_MouseCommand::Leave: { OnMouseLeave(pMsg); break; } @@ -241,7 +245,7 @@ int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } case CFWL_MessageType::Key: { CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); - if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) + if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pKey); break; } @@ -297,7 +301,7 @@ void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { m_pOwner->DispatchEvent(&wmPosChanged); m_pOwner->Repaint(bUpPress ? &m_pOwner->m_rtUpButton : &m_pOwner->m_rtDnButton); - m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, FWL_SPIN_Elapse); + m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, kElapseTime); } void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { if (m_pOwner->m_pProperties->m_dwStates & CFWL_PartState_Disabled) { diff --git a/xfa/fwl/basewidget/ifwl_barcode.h b/xfa/fwl/basewidget/ifwl_barcode.h index 4263177994..6cc4c59112 100644 --- a/xfa/fwl/basewidget/ifwl_barcode.h +++ b/xfa/fwl/basewidget/ifwl_barcode.h @@ -14,19 +14,23 @@ class CFWL_WidgetImpProperties; #define FWL_CLASS_Barcode L"FWL_BARCODE" #define FWL_CLASSHASH_Barcode 366886968 -#define FWL_BCDATTRIBUTE_CHARENCODING (1L << 0) -#define FWL_BCDATTRIBUTE_MODULEHEIGHT (1L << 1) -#define FWL_BCDATTRIBUTE_MODULEWIDTH (1L << 2) -#define FWL_BCDATTRIBUTE_DATALENGTH (1L << 3) -#define FWL_BCDATTRIBUTE_CALCHECKSUM (1L << 4) -#define FWL_BCDATTRIBUTE_PRINTCHECKSUM (1L << 5) -#define FWL_BCDATTRIBUTE_TEXTLOCATION (1L << 6) -#define FWL_BCDATTRIBUTE_WIDENARROWRATIO (1L << 7) -#define FWL_BCDATTRIBUTE_STARTCHAR (1L << 8) -#define FWL_BCDATTRIBUTE_ENDCHAR (1L << 9) -#define FWL_BCDATTRIBUTE_VERSION (1L << 10) -#define FWL_BCDATTRIBUTE_ECLEVEL (1L << 11) -#define FWL_BCDATTRIBUTE_TRUNCATED (1L << 12) + +enum FWL_BCDAttribute { + FWL_BCDATTRIBUTE_NONE = 0, + FWL_BCDATTRIBUTE_CHARENCODING = 1 << 0, + FWL_BCDATTRIBUTE_MODULEHEIGHT = 1 << 1, + FWL_BCDATTRIBUTE_MODULEWIDTH = 1 << 2, + FWL_BCDATTRIBUTE_DATALENGTH = 1 << 3, + FWL_BCDATTRIBUTE_CALCHECKSUM = 1 << 4, + FWL_BCDATTRIBUTE_PRINTCHECKSUM = 1 << 5, + FWL_BCDATTRIBUTE_TEXTLOCATION = 1 << 6, + FWL_BCDATTRIBUTE_WIDENARROWRATIO = 1 << 7, + FWL_BCDATTRIBUTE_STARTCHAR = 1 << 8, + FWL_BCDATTRIBUTE_ENDCHAR = 1 << 9, + FWL_BCDATTRIBUTE_VERSION = 1 << 10, + FWL_BCDATTRIBUTE_ECLEVEL = 1 << 11, + FWL_BCDATTRIBUTE_TRUNCATED = 1 << 12 +}; class IFWL_BarcodeDP : public IFWL_EditDP { public: |