diff options
Diffstat (limited to 'xfa')
57 files changed, 930 insertions, 835 deletions
diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp index 771d7b9833..8238d6af04 100644 --- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp +++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp @@ -111,20 +111,20 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() { CFWL_ThemePart part; part.m_pWidget = m_pInterface; IFWL_ThemeProvider* pTheme = GetAvailableTheme(); - IFX_Font* pFont = - static_cast<IFX_Font*>(pTheme->GetCapacity(&part, FWL_WGTCAPACITY_Font)); + IFX_Font* pFont = static_cast<IFX_Font*>( + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Font)); CFX_Font* pCXFont = pFont ? static_cast<CFX_Font*>(pFont->GetDevFont()) : nullptr; if (pCXFont) { m_pBarcodeEngine->SetFont(pCXFont); } FX_FLOAT* pFontSize = static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_FontSize)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::FontSize)); if (pFontSize) { m_pBarcodeEngine->SetFontSize(*pFontSize); } FX_ARGB* pFontColor = static_cast<FX_ARGB*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_TextColor)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TextColor)); if (pFontColor) { m_pBarcodeEngine->SetFontColor(*pFontColor); } diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp index e7ce56777e..959398cbd2 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.cpp +++ b/xfa/fwl/basewidget/fwl_caretimp.cpp @@ -123,8 +123,8 @@ FX_BOOL CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics, if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) { return FWL_ERR_Succeeded; } - param.m_iPart = FWL_PART_CAT_Background; - param.m_dwStates = FWL_PARTSTATE_CAT_HightLight; + param.m_iPart = CFWL_Part::Background; + param.m_dwStates = CFWL_PartState_HightLight; if (pMatrix) { param.m_matrix.Concat(*pMatrix); } diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/basewidget/fwl_checkboximp.cpp index d2d149ffd4..9ed2f0b8ed 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.cpp +++ b/xfa/fwl/basewidget/fwl_checkboximp.cpp @@ -118,17 +118,17 @@ FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_CKB_Border, m_pProperties->m_pThemeProvider, + DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_CKB_Edge, pTheme, pMatrix); + DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } int32_t dwStates = GetPartStates(); { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_CKB_Background; + param.m_iPart = CFWL_Part::Background; param.m_dwStates = dwStates; param.m_pGraphics = pGraphics; if (pMatrix) { @@ -139,7 +139,7 @@ FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, param.m_pData = &m_rtFocus; } pTheme->DrawBackground(¶m); - param.m_iPart = FWL_PART_CKB_CheckBox; + param.m_iPart = CFWL_Part::CheckBox; param.m_rtPart = m_rtBox; pTheme->DrawBackground(¶m); } @@ -153,7 +153,7 @@ FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Indefinite; CFWL_ThemeText textParam; textParam.m_pWidget = m_pInterface; - textParam.m_iPart = FWL_PART_CKB_Caption; + textParam.m_iPart = CFWL_Part::Caption; textParam.m_dwStates = dwStates; textParam.m_pGraphics = pGraphics; if (pMatrix) { @@ -280,25 +280,25 @@ void CFWL_CheckBoxImp::Layout() { } } uint32_t CFWL_CheckBoxImp::GetPartStates() { - int32_t dwStates = FWL_PARTSTATE_CKB_UnChecked; + int32_t dwStates = CFWL_PartState_Normal; if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) == FWL_STATE_CKB_Neutral) { - dwStates = FWL_PARTSTATE_CKB_Neutral; + dwStates = CFWL_PartState_Neutral; } else if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) == FWL_STATE_CKB_Checked) { - dwStates = FWL_PARTSTATE_CKB_Checked; + dwStates = CFWL_PartState_Checked; } if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) { - dwStates |= FWL_PARTSTATE_CKB_Disabled; + dwStates |= CFWL_PartState_Disabled; } else if (m_pProperties->m_dwStates & FWL_STATE_CKB_Hovered) { - dwStates |= FWL_PARTSTATE_CKB_Hovered; + dwStates |= CFWL_PartState_Hovered; } else if (m_pProperties->m_dwStates & FWL_STATE_CKB_Pressed) { - dwStates |= FWL_PARTSTATE_CKB_Pressed; + dwStates |= CFWL_PartState_Pressed; } else { - dwStates |= FWL_PARTSTATE_CKB_Normal; + dwStates |= CFWL_PartState_Normal; } if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { - dwStates |= FWL_PARTSTATE_CKB_Focused; + dwStates |= CFWL_PartState_Focused; } return dwStates; } diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index b7d85d3174..b093b6c171 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -472,7 +472,7 @@ CFWL_ComboBoxImp::CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, m_pForm(NULL), m_bLButtonDown(FALSE), m_iCurSel(-1), - m_iBtnState(FWL_PARTSTATE_CMB_Normal), + m_iBtnState(CFWL_PartState_Normal), m_fComboFormHandler(0), m_bNeedShowList(FALSE) { m_rtClient.Reset(); @@ -538,7 +538,7 @@ FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { ReSetTheme(); } FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( - GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) return FWL_ERR_Indefinite; rect.Inflate(0, 0, *pFWidth, 0); @@ -586,7 +586,7 @@ FWL_ERR CFWL_ComboBoxImp::Update() { part.m_pWidget = m_pInterface; m_fComboFormHandler = *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity( - &part, FWL_WGTCAPACITY_CMB_ComboFormHandler)); + &part, CFWL_WidgetCapacity::ComboFormHandler)); return FWL_ERR_Succeeded; } uint32_t CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -607,17 +607,17 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; FX_BOOL bIsDropDown = IsDropDownStyle(); if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_CMB_Border, pTheme, pMatrix); + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_CMB_Edge, pTheme, pMatrix); + DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } if (!bIsDropDown) { CFX_RectF rtTextBk(m_rtClient); rtTextBk.width -= m_rtBtn.width; CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_CMB_Background; + param.m_iPart = CFWL_Part::Background; param.m_pGraphics = pGraphics; if (pMatrix) { param.m_matrix.Concat(*pMatrix); @@ -634,12 +634,12 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, } } if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) { - param.m_dwStates = FWL_PARTSTATE_CMB_Disabled; + param.m_dwStates = CFWL_PartState_Disabled; } else if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) && (m_iCurSel >= 0)) { - param.m_dwStates = FWL_PARTSTATE_CMB_Selected; + param.m_dwStates = CFWL_PartState_Selected; } else { - param.m_dwStates = FWL_PARTSTATE_CMB_Normal; + param.m_dwStates = CFWL_PartState_Normal; } pTheme->DrawBackground(¶m); if (m_iCurSel >= 0) { @@ -653,14 +653,14 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, ->GetItemText(hItem, wsText); CFWL_ThemeText param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_CMB_Caption; + param.m_iPart = CFWL_Part::Caption; param.m_dwStates = m_iBtnState; param.m_pGraphics = pGraphics; param.m_matrix.Concat(*pMatrix); param.m_rtPart = rtTextBk; param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) - ? FWL_PARTSTATE_CMB_Selected - : FWL_PARTSTATE_CMB_Normal; + ? CFWL_PartState_Selected + : CFWL_PartState_Normal; param.m_wsText = wsText; param.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; param.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; @@ -670,9 +670,9 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_CMB_DropDownButton; + param.m_iPart = CFWL_Part::DropDownButton; param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) - ? FWL_PARTSTATE_CMB_Disabled + ? CFWL_PartState_Disabled : m_iBtnState; param.m_pGraphics = pGraphics; param.m_matrix.Concat(*pMatrix); @@ -878,8 +878,8 @@ void CFWL_ComboBoxImp::DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground param; param.m_pGraphics = pGraphics; - param.m_iPart = FWL_PART_CMB_StretcgHandler; - param.m_dwStates = FWL_PARTSTATE_CMB_Normal; + param.m_iPart = CFWL_Part::StretchHandler; + param.m_dwStates = CFWL_PartState_Normal; param.m_pWidget = m_pInterface; if (pMatrix) { param.m_matrix.Concat(*pMatrix); @@ -1000,8 +1000,8 @@ void CFWL_ComboBoxImp::Layout() { return DisForm_Layout(); } GetClientRect(m_rtClient); - FX_FLOAT* pFWidth = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) return; FX_FLOAT fBtn = *pFWidth; @@ -1282,7 +1282,7 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, if (!m_rtBtn.IsEmpty(0.1f)) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_CMB_DropDownButton; + param.m_iPart = CFWL_Part::DropDownButton; param.m_dwStates = m_iBtnState; param.m_pGraphics = pGraphics; param.m_rtPart = m_rtBtn; @@ -1320,19 +1320,18 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { void CFWL_ComboBoxImp::DisForm_Layout() { GetClientRect(m_rtClient); m_rtContent = m_rtClient; - FX_FLOAT* pFWidth = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) return; - FX_FLOAT borderWidth = 0; - { borderWidth = FWL_PART_CMB_Border; } + FX_FLOAT borderWidth = 1; FX_FLOAT fBtn = *pFWidth; if (!(GetStylesEx() & FWL_STYLEEXT_CMB_ReadOnly)) { m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top + borderWidth, fBtn - borderWidth, m_rtClient.height - 2 * borderWidth); } CFX_RectF* pUIMargin = - static_cast<CFX_RectF*>(GetThemeCapacity(FWL_WGTCAPACITY_UIMargin)); + static_cast<CFX_RectF*>(GetThemeCapacity(CFWL_WidgetCapacity::UIMargin)); if (pUIMargin) { m_rtContent.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, pUIMargin->height); @@ -1481,30 +1480,29 @@ void CFWL_ComboBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { m_pOwner->MatchEditText(); } m_pOwner->m_bLButtonDown = TRUE; - m_pOwner->m_iBtnState = FWL_PARTSTATE_CMB_Pressed; + m_pOwner->m_iBtnState = CFWL_PartState_Pressed; m_pOwner->Repaint(&m_pOwner->m_rtClient); m_pOwner->ShowDropList(TRUE); - m_pOwner->m_iBtnState = FWL_PARTSTATE_CMB_Normal; + m_pOwner->m_iBtnState = CFWL_PartState_Normal; m_pOwner->Repaint(&m_pOwner->m_rtClient); } } void CFWL_ComboBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { m_pOwner->m_bLButtonDown = FALSE; if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { - m_pOwner->m_iBtnState = FWL_PARTSTATE_CMB_Hovered; + m_pOwner->m_iBtnState = CFWL_PartState_Hovered; } else { - m_pOwner->m_iBtnState = FWL_PARTSTATE_CMB_Normal; + m_pOwner->m_iBtnState = CFWL_PartState_Normal; } m_pOwner->Repaint(&m_pOwner->m_rtBtn); } void CFWL_ComboBoxImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { int32_t iOldState = m_pOwner->m_iBtnState; if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { - m_pOwner->m_iBtnState = m_pOwner->m_bLButtonDown - ? FWL_PARTSTATE_CMB_Pressed - : FWL_PARTSTATE_CMB_Hovered; + m_pOwner->m_iBtnState = m_pOwner->m_bLButtonDown ? CFWL_PartState_Pressed + : CFWL_PartState_Hovered; } else { - m_pOwner->m_iBtnState = FWL_PARTSTATE_CMB_Normal; + m_pOwner->m_iBtnState = CFWL_PartState_Normal; } if ((iOldState != m_pOwner->m_iBtnState) && !((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == @@ -1516,7 +1514,7 @@ void CFWL_ComboBoxImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) { if (!m_pOwner->IsDropListShowed() && !((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == FWL_WGTSTATE_Disabled)) { - m_pOwner->m_iBtnState = FWL_PARTSTATE_CMB_Normal; + m_pOwner->m_iBtnState = CFWL_PartState_Normal; m_pOwner->Repaint(&m_pOwner->m_rtBtn); } } diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index d436c47374..21616992b1 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -250,11 +250,11 @@ int32_t CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( } void CFWL_DateTimeCalendarImpDelegate::OnLButtonDownEx(CFWL_MsgMouse* pMsg) { if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { - m_pOwner->m_iLBtnPartStates = FWL_PARTSTATE_MCD_Pressed; + m_pOwner->m_iLBtnPartStates = CFWL_PartState_Pressed; m_pOwner->PrevMonth(); m_pOwner->Repaint(&m_pOwner->m_rtClient); } else if (m_pOwner->m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { - m_pOwner->m_iRBtnPartStates |= FWL_PARTSTATE_MCD_Pressed; + m_pOwner->m_iRBtnPartStates |= CFWL_PartState_Pressed; m_pOwner->NextMonth(); m_pOwner->Repaint(&m_pOwner->m_rtClient); } else if (m_pOwner->m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) { @@ -499,8 +499,8 @@ FWL_ERR CFWL_DateTimePickerImp::Update() { } m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider); GetClientRect(m_rtClient); - FX_FLOAT* pFWidth = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) return FWL_ERR_Indefinite; FX_FLOAT fBtn = *pFWidth; @@ -554,10 +554,10 @@ FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_DTP_Border, pTheme, pMatrix); + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_DTP_Edge, pTheme, pMatrix); + DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } if (!m_rtBtn.IsEmpty()) { DrawDropDownButton(pGraphics, pTheme, pMatrix); @@ -692,7 +692,7 @@ void CFWL_DateTimePickerImp::DrawDropDownButton(CFX_Graphics* pGraphics, } else { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_DTP_DropDownButton; + param.m_iPart = CFWL_Part::DropDownButton; param.m_dwStates = m_iBtnState; param.m_pGraphics = pGraphics; param.m_rtPart = m_rtBtn; @@ -948,8 +948,8 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { pData->GetToday(m_pInterface, m_MonthCalendarDP.m_iCurYear, m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay); } - FX_FLOAT* pWidth = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + FX_FLOAT* pWidth = static_cast<FX_FLOAT*>( + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pWidth) return 0; m_fBtn = *pWidth; @@ -1112,23 +1112,23 @@ void CFWL_DateTimePickerImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { return; m_pOwner->m_bLBtnDown = FALSE; if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { - m_pOwner->m_iBtnState = FWL_PARTSTATE_DTP_Hovered; + m_pOwner->m_iBtnState = CFWL_PartState_Hovered; } else { - m_pOwner->m_iBtnState = FWL_PARTSTATE_DTP_Normal; + m_pOwner->m_iBtnState = CFWL_PartState_Normal; } m_pOwner->Repaint(&m_pOwner->m_rtBtn); } void CFWL_DateTimePickerImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { } else { - m_pOwner->m_iBtnState = FWL_PARTSTATE_DTP_Normal; + m_pOwner->m_iBtnState = CFWL_PartState_Normal; } m_pOwner->Repaint(&m_pOwner->m_rtBtn); } void CFWL_DateTimePickerImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) { if (!pMsg) return; - m_pOwner->m_iBtnState = FWL_PARTSTATE_DTP_Normal; + m_pOwner->m_iBtnState = CFWL_PartState_Normal; m_pOwner->Repaint(&m_pOwner->m_rtBtn); } void CFWL_DateTimePickerImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg, diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index 1bc876f691..d25fd09d29 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -259,13 +259,13 @@ FWL_ERR CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { if (IsShowScrollBar(TRUE)) { FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>( - GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); rect.width += *pfWidth; rect.width += FWL_EDIT_Margin; } if (IsShowScrollBar(FALSE)) { FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>( - GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); rect.height += *pfWidth; rect.height += FWL_EDIT_Margin; } @@ -505,10 +505,10 @@ FWL_ERR CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics, DrawSpellCheck(pGraphics, pMatrix); } if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_EDT_Border, pTheme, pMatrix); + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_EDT_Edge, pTheme, pMatrix); + DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } return FWL_ERR_Succeeded; } @@ -940,14 +940,14 @@ void CFWL_EditImp::DrawTextBk(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_EDT_Background; + param.m_iPart = CFWL_Part::Background; param.m_dwData = FWL_PARTDATA_EDT_Background; param.m_dwStates = m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly - ? FWL_PARTSTATE_EDT_ReadOnly - : FWL_PARTSTATE_EDT_Normal; + ? CFWL_PartState_ReadOnly + : CFWL_PartState_Normal; uint32_t dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled); if (dwStates) { - param.m_dwStates = FWL_PARTSTATE_EDT_Disable; + param.m_dwStates = CFWL_PartState_Disabled; } param.m_pGraphics = pGraphics; param.m_matrix = *pMatrix; @@ -1032,7 +1032,7 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics, param.m_pGraphics = pGraphics; param.m_matrix = *pMatrix; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_EDT_Background; + param.m_iPart = CFWL_Part::Background; param.m_pPath = &path; pTheme->DrawBackground(¶m); } @@ -1065,7 +1065,7 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics, param.m_pGraphics = pGraphics; param.m_matrix = *pMatrix; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_EDT_CombTextLine; + param.m_iPart = CFWL_Part::CombTextLine; param.m_pPath = &path; pTheme->DrawBackground(¶m); } @@ -1162,22 +1162,22 @@ void CFWL_EditImp::UpdateEditParams() { params.dwMode |= FDE_TEXTEDITMODE_ReadOnly; } FX_FLOAT* pFontSize = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_FontSize)); + static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::FontSize)); if (!pFontSize) return; m_fFontSize = *pFontSize; uint32_t* pFontColor = - static_cast<uint32_t*>(GetThemeCapacity(FWL_WGTCAPACITY_TextColor)); + static_cast<uint32_t*>(GetThemeCapacity(CFWL_WidgetCapacity::TextColor)); if (!pFontColor) return; params.dwFontColor = *pFontColor; FX_FLOAT* pLineHeight = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_LineHeight)); + static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::LineHeight)); if (!pLineHeight) return; params.fLineSpace = *pLineHeight; IFX_Font* pFont = - static_cast<IFX_Font*>(GetThemeCapacity(FWL_WGTCAPACITY_Font)); + static_cast<IFX_Font*>(GetThemeCapacity(CFWL_WidgetCapacity::Font)); if (!pFont) return; params.pFont = pFont; @@ -1281,7 +1281,7 @@ void CFWL_EditImp::UpdateVAlignment() { FX_FLOAT fSpaceAbove = 0.0f; FX_FLOAT fSpaceBelow = 0.0f; CFX_SizeF* pSpace = static_cast<CFX_SizeF*>( - GetThemeCapacity(FWL_WGTCAPACITY_SpaceAboveBelow)); + GetThemeCapacity(CFWL_WidgetCapacity::SpaceAboveBelow)); if (pSpace) { fSpaceAbove = pSpace->x; fSpaceBelow = pSpace->y; @@ -1470,14 +1470,14 @@ int32_t CFWL_EditImp::AddDoRecord(const CFX_ByteStringC& bsDoRecord) { void CFWL_EditImp::Layout() { GetClientRect(m_rtClient); m_rtEngine = m_rtClient; - FX_FLOAT* pfWidth = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>( + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pfWidth) return; FX_FLOAT fWidth = *pfWidth; if (!m_pOuter) { - CFX_RectF* pUIMargin = - static_cast<CFX_RectF*>(GetThemeCapacity(FWL_WGTCAPACITY_UIMargin)); + CFX_RectF* pUIMargin = static_cast<CFX_RectF*>( + GetThemeCapacity(CFWL_WidgetCapacity::UIMargin)); if (pUIMargin) { m_rtEngine.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, pUIMargin->height); @@ -1487,7 +1487,7 @@ void CFWL_EditImp::Layout() { part.m_pWidget = m_pOuter; CFX_RectF* pUIMargin = static_cast<CFX_RectF*>(m_pOuter->GetThemeProvider()->GetCapacity( - &part, FWL_WGTCAPACITY_UIMargin)); + &part, CFWL_WidgetCapacity::UIMargin)); if (pUIMargin) { m_rtEngine.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, pUIMargin->height); @@ -1547,7 +1547,7 @@ void CFWL_EditImp::LayoutScrollBar() { if (bShowVertScrollbar) { if (!m_pVertScrollBar) { pfWidth = static_cast<FX_FLOAT*>( - GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); FX_FLOAT fWidth = pfWidth ? *pfWidth : 0; InitScrollBar(); CFX_RectF rtVertScr; @@ -1572,7 +1572,7 @@ void CFWL_EditImp::LayoutScrollBar() { if (!m_pHorzScrollBar) { if (!pfWidth) { pfWidth = static_cast<FX_FLOAT*>( - GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); } FX_FLOAT fWidth = pfWidth ? *pfWidth : 0; InitScrollBar(FALSE); diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index 24b29d6ac0..2adeb97496 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -172,10 +172,10 @@ FWL_ERR CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; pGraphics->SaveGraphState(); if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_LTB_Border, pTheme, pMatrix); + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_LTB_Edge, pTheme, pMatrix); + DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } CFX_RectF rtClip(m_rtConent); if (IsShowScrollBar(FALSE)) { @@ -555,7 +555,7 @@ void CFWL_ListBoxImp::DrawBkground(CFX_Graphics* pGraphics, return; CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_LTB_Background; + param.m_iPart = CFWL_Part::Background; param.m_dwStates = 0; param.m_pGraphics = pGraphics; param.m_matrix.Concat(*pMatrix); @@ -564,7 +564,7 @@ void CFWL_ListBoxImp::DrawBkground(CFX_Graphics* pGraphics, param.m_pData = &m_rtStatic; } if (!IsEnabled()) { - param.m_dwStates = FWL_PARTSTATE_LTB_Disabled; + param.m_dwStates = CFWL_PartState_Disabled; } pTheme->DrawBackground(¶m); } @@ -630,15 +630,15 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); uint32_t dwItemStyles = pData->GetItemStyles(m_pInterface, hItem); - uint32_t dwPartStates = FWL_PARTSTATE_LTB_Normal; + uint32_t dwPartStates = CFWL_PartState_Normal; if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) { - dwPartStates = FWL_PARTSTATE_LTB_Disabled; + dwPartStates = CFWL_PartState_Disabled; } else if (dwItemStyles & FWL_ITEMSTATE_LTB_Selected) { - dwPartStates = FWL_PARTSTATE_LTB_Selected; + dwPartStates = CFWL_PartState_Selected; } if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused && dwItemStyles & FWL_ITEMSTATE_LTB_Focused) { - dwPartStates |= FWL_PARTSTATE_LTB_Focused; + dwPartStates |= CFWL_PartState_Focused; } FWL_ListBoxItemData itemData; itemData.pDataProvider = pData; @@ -646,7 +646,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_LTB_ListItem; + param.m_iPart = CFWL_Part::ListItem; param.m_dwStates = dwPartStates; param.m_pGraphics = pGraphics; param.m_matrix.Concat(*pMatrix); @@ -655,7 +655,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, CFX_RectF rtFocus(rtItem); param.m_pData = &rtFocus; if (m_pVertScrollBar && !m_pHorzScrollBar && - (dwPartStates & FWL_PARTSTATE_LTB_Focused)) { + (dwPartStates & CFWL_PartState_Focused)) { param.m_rtPart.left += 1; param.m_rtPart.width -= (m_fScorllBarWidth + 1); rtFocus.Deflate(0.5, 0.5, 1 + m_fScorllBarWidth, 1); @@ -671,7 +671,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, if (pDib) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_LTB_Icon; + param.m_iPart = CFWL_Part::Icon; param.m_pGraphics = pGraphics; param.m_matrix.Concat(*pMatrix); param.m_rtPart = rtDIB; @@ -688,12 +688,12 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, pData->SetItemCheckRect(m_pInterface, hItem, rtCheck); CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_LTB_Check; + param.m_iPart = CFWL_Part::Check; param.m_pGraphics = pGraphics; if (GetItemChecked(hItem)) { - param.m_dwStates = FWL_PARTSTATE_LTB_Checked; + param.m_dwStates = CFWL_PartState_Checked; } else { - param.m_dwStates = FWL_PARTSTATE_LTB_UnChecked; + param.m_dwStates = CFWL_PartState_Normal; } param.m_matrix.Concat(*pMatrix); param.m_rtPart = rtCheck; @@ -712,7 +712,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, } CFWL_ThemeText textParam; textParam.m_pWidget = m_pInterface; - textParam.m_iPart = FWL_PART_LTB_ListItem; + textParam.m_iPart = CFWL_Part::ListItem; textParam.m_dwStates = dwPartStates; textParam.m_pGraphics = pGraphics; textParam.m_matrix.Concat(*pMatrix); @@ -734,8 +734,8 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { CFX_RectF rtUIMargin; rtUIMargin.Set(0, 0, 0, 0); if (!m_pOuter) { - CFX_RectF* pUIMargin = - static_cast<CFX_RectF*>(GetThemeCapacity(FWL_WGTCAPACITY_UIMargin)); + CFX_RectF* pUIMargin = static_cast<CFX_RectF*>( + GetThemeCapacity(CFWL_WidgetCapacity::UIMargin)); if (pUIMargin) { m_rtConent.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, pUIMargin->height); @@ -752,7 +752,7 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); CFWL_ThemePart itemPart; itemPart.m_pWidget = m_pInterface; - itemPart.m_iPart = FWL_PART_LTB_ListItem; + itemPart.m_iPart = CFWL_Part::ListItem; itemPart.m_pData = m_pProperties->m_pDataProvider; itemPart.m_dwData = i; CFX_RectF r; @@ -931,15 +931,15 @@ FX_FLOAT CFWL_ListBoxImp::GetMaxTextWidth() { return fRet; } FX_FLOAT CFWL_ListBoxImp::GetScrollWidth() { - FX_FLOAT* pfWidth = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>( + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pfWidth) return 0; return *pfWidth; } FX_FLOAT CFWL_ListBoxImp::GetItemHeigt() { FX_FLOAT* pfFont = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_FontSize)); + static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::FontSize)); if (!pfFont) return 20; return *pfFont + 2 * FWL_LISTBOX_ItemTextMargin; diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index d55144a805..1965e400b7 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -27,6 +27,98 @@ #define MONTHCAL_HEADER_BTN_VMARGIN 7 #define MONTHCAL_HEADER_BTN_HMARGIN 5 +namespace { + +CFX_WideString* GetCapacityForDay(IFWL_ThemeProvider* pTheme, + CFWL_ThemePart& params, + uint32_t day) { + ASSERT(day < 7); + + if (day == 0) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Sun)); + } + if (day == 1) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Mon)); + } + if (day == 2) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Tue)); + } + if (day == 3) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Wed)); + } + if (day == 4) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Thu)); + } + if (day == 5) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Fri)); + } + + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Sat)); +} + +CFX_WideString* GetCapacityForMonth(IFWL_ThemeProvider* pTheme, + CFWL_ThemePart& params, + uint32_t month) { + ASSERT(month < 12); + + if (month == 0) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::January)); + } + if (month == 1) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::February)); + } + if (month == 2) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::March)); + } + if (month == 3) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::April)); + } + if (month == 4) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::May)); + } + if (month == 5) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::June)); + } + if (month == 6) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::July)); + } + if (month == 7) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::August)); + } + if (month == 8) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::September)); + } + if (month == 9) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::October)); + } + if (month == 10) { + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::November)); + } + + return static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::December)); +} + +} // namespace + // static IFWL_MonthCalendar* IFWL_MonthCalendar::Create( const CFWL_WidgetImpProperties& properties, @@ -66,8 +158,8 @@ CFWL_MonthCalendarImp::CFWL_MonthCalendarImp( m_iMonth(1), m_iDay(1), m_iHovered(-1), - m_iLBtnPartStates(FWL_PARTSTATE_MCD_Normal), - m_iRBtnPartStates(FWL_PARTSTATE_MCD_Normal) { + m_iLBtnPartStates(CFWL_PartState_Normal), + m_iRBtnPartStates(CFWL_PartState_Normal) { m_rtHead.Reset(); m_rtWeek.Reset(); m_rtLBtn.Reset(); @@ -143,10 +235,10 @@ FWL_ERR CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics, } IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_MCD_Border, pTheme, pMatrix); + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_MCD_Edge, pTheme, pMatrix); + DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } DrawBkground(pGraphics, pTheme, pMatrix); DrawHeadBK(pGraphics, pTheme, pMatrix); @@ -192,9 +284,9 @@ void CFWL_MonthCalendarImp::DrawBkground(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_Background; + params.m_iPart = CFWL_Part::Background; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_rtPart = m_rtClient; if (pMatrix) { params.m_matrix.Concat(*pMatrix); @@ -206,9 +298,9 @@ void CFWL_MonthCalendarImp::DrawHeadBK(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_Header; + params.m_iPart = CFWL_Part::Header; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_rtPart = m_rtHead; if (pMatrix) { params.m_matrix.Concat(*pMatrix); @@ -220,7 +312,7 @@ void CFWL_MonthCalendarImp::DrawLButton(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_LBtn; + params.m_iPart = CFWL_Part::LBtn; params.m_pGraphics = pGraphics; params.m_dwStates = m_iLBtnPartStates; params.m_rtPart = m_rtLBtn; @@ -234,7 +326,7 @@ void CFWL_MonthCalendarImp::DrawRButton(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_RBtn; + params.m_iPart = CFWL_Part::RBtn; params.m_pGraphics = pGraphics; params.m_dwStates = m_iRBtnPartStates; params.m_rtPart = m_rtRBtn; @@ -248,8 +340,8 @@ void CFWL_MonthCalendarImp::DrawCaption(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeText textParam; textParam.m_pWidget = m_pInterface; - textParam.m_iPart = FWL_PART_MCD_Caption; - textParam.m_dwStates = FWL_PARTSTATE_MCD_Normal; + textParam.m_iPart = CFWL_Part::Caption; + textParam.m_dwStates = CFWL_PartState_Normal; textParam.m_pGraphics = pGraphics; int32_t iYear; int32_t iMonth; @@ -273,9 +365,9 @@ void CFWL_MonthCalendarImp::DrawSeperator(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_HSeparator; + params.m_iPart = CFWL_Part::HSeparator; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_rtPart = m_rtHSep; if (pMatrix) { params.m_matrix.Concat(*pMatrix); @@ -287,7 +379,7 @@ void CFWL_MonthCalendarImp::DrawDatesInBK(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_DateInBK; + params.m_iPart = CFWL_Part::DateInBK; params.m_pGraphics = pGraphics; if (pMatrix) { params.m_matrix.Concat(*pMatrix); @@ -296,19 +388,19 @@ void CFWL_MonthCalendarImp::DrawDatesInBK(CFX_Graphics* pGraphics, for (int32_t j = 0; j < iCount; j++) { FWL_DATEINFO* pDataInfo = (FWL_DATEINFO*)m_arrDates.GetAt(j); if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Selected) { - params.m_dwStates |= FWL_PARTSTATE_MCD_Selected; + params.m_dwStates |= CFWL_PartState_Selected; if (((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) == 0) && pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Flag) { - params.m_dwStates |= FWL_PARTSTATE_MCD_Flagged; + params.m_dwStates |= CFWL_PartState_Flagged; } if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Focused) { - params.m_dwStates |= FWL_PARTSTATE_MCD_Focused; + params.m_dwStates |= CFWL_PartState_Focused; } } else if (j == m_iHovered - 1) { - params.m_dwStates |= FWL_PARTSTATE_MCD_Hovered; + params.m_dwStates |= CFWL_PartState_Hovered; } else if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Flag) { - params.m_dwStates = FWL_PARTSTATE_MCD_Flagged; + params.m_dwStates = CFWL_PartState_Flagged; pTheme->DrawBackground(¶ms); } params.m_rtPart = pDataInfo->rect; @@ -321,9 +413,9 @@ void CFWL_MonthCalendarImp::DrawWeek(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeText params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_Week; + params.m_iPart = CFWL_Part::Week; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; CFX_RectF rtDayOfWeek; if (pMatrix) { @@ -332,10 +424,8 @@ void CFWL_MonthCalendarImp::DrawWeek(CFX_Graphics* pGraphics, for (int32_t i = 0; i < 7; i++) { rtDayOfWeek.Set(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2), m_rtWeek.top, m_szCell.x, m_szCell.y); - CFX_WideString* wsWeekDay = static_cast<CFX_WideString*>( - pTheme->GetCapacity(¶ms, i + FWL_MCCAPACITY_Sun)); params.m_rtPart = rtDayOfWeek; - params.m_wsText = *wsWeekDay; + params.m_wsText = *GetCapacityForDay(pTheme, params, i); params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; pTheme->DrawText(¶ms); } @@ -345,9 +435,9 @@ void CFWL_MonthCalendarImp::DrawWeekNumber(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeText params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_WeekNum; + params.m_iPart = CFWL_Part::WeekNum; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; CFX_WideString wsWeekNum; params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; @@ -377,9 +467,9 @@ void CFWL_MonthCalendarImp::DrawWeekNumberSep(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_WeekNumSep; + params.m_iPart = CFWL_Part::WeekNumSep; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_rtPart = m_rtWeekNumSep; if (pMatrix) { params.m_matrix.Concat(*pMatrix); @@ -394,12 +484,12 @@ void CFWL_MonthCalendarImp::DrawToday(CFX_Graphics* pGraphics, } CFWL_ThemeText params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_Today; + params.m_iPart = CFWL_Part::Today; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; CFX_WideString* wsDay = static_cast<CFX_WideString*>( - pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today)); + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Today)); CFX_WideString wsText; GetTodayText(m_iYear, m_iMonth, m_iDay, wsText); params.m_wsText = *wsDay + wsText; @@ -417,9 +507,9 @@ void CFWL_MonthCalendarImp::DrawDatesIn(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeText params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_DatesIn; + params.m_iPart = CFWL_Part::DatesIn; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; if (pMatrix) { params.m_matrix.Concat(*pMatrix); @@ -431,7 +521,7 @@ void CFWL_MonthCalendarImp::DrawDatesIn(CFX_Graphics* pGraphics, params.m_rtPart = pDataInfo->rect; params.m_dwStates = pDataInfo->dwStates; if (j + 1 == m_iHovered) { - params.m_dwStates |= FWL_PARTSTATE_MCD_Hovered; + params.m_dwStates |= CFWL_PartState_Hovered; } params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; pTheme->DrawText(¶ms); @@ -442,9 +532,9 @@ void CFWL_MonthCalendarImp::DrawDatesOut(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeText params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_DatesOut; + params.m_iPart = CFWL_Part::DatesOut; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; if (pMatrix) { params.m_matrix.Concat(*pMatrix); @@ -468,10 +558,10 @@ void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics, return; CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_DateInCircle; + params.m_iPart = CFWL_Part::DateInCircle; params.m_pGraphics = pGraphics; params.m_rtPart = pDate->rect; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; if (pMatrix) { params.m_matrix.Concat(*pMatrix); } @@ -488,9 +578,9 @@ void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics, } CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_MCD_TodayCircle; + params.m_iPart = CFWL_Part::TodayCircle; params.m_pGraphics = pGraphics; - params.m_dwStates = FWL_PARTSTATE_MCD_Normal; + params.m_dwStates = CFWL_PartState_Normal; params.m_rtPart = m_rtTodayFlag; if (pMatrix) { params.m_matrix.Concat(*pMatrix); @@ -510,15 +600,16 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) { CFWL_ThemePart params; params.m_pWidget = m_pInterface; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - CFX_WideString* wsText = NULL; FX_FLOAT fMaxWeekW = 0.0f; FX_FLOAT fMaxWeekH = 0.0f; - for (uint32_t week = FWL_MCCAPACITY_Sun; week <= FWL_MCCAPACITY_Sat; week++) { - wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(¶ms, week)); - CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider); + + for (uint32_t i = 0; i < 7; ++i) { + CFX_SizeF sz = CalcTextSize(*GetCapacityForDay(pTheme, params, i), + m_pProperties->m_pThemeProvider); fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x; fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y; } + FX_FLOAT fDayMaxW = 0.0f; FX_FLOAT fDayMaxH = 0.0f; for (int day = 10; day <= 31; day++) { @@ -536,10 +627,10 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) { MONTHCAL_HEADER_BTN_HMARGIN * 2; FX_FLOAT fMonthMaxW = 0.0f; FX_FLOAT fMonthMaxH = 0.0f; - for (uint32_t month = FWL_MCCAPACITY_January; - month <= FWL_MCCAPACITY_December; month++) { - wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(¶ms, month)); - CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider); + + for (uint32_t i = 0; i < 12; ++i) { + CFX_SizeF sz = CalcTextSize(*GetCapacityForMonth(pTheme, params, i), + m_pProperties->m_pThemeProvider); fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x; fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y; } @@ -552,8 +643,8 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) { fs.x = std::max(fs.x, fMonthMaxW); CFX_WideString wsToday; GetTodayText(m_iYear, m_iMonth, m_iDay, wsToday); - wsText = static_cast<CFX_WideString*>( - pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today)); + CFX_WideString* wsText = static_cast<CFX_WideString*>( + pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Today)); m_wsToday = *wsText + wsToday; m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider); m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y; @@ -645,60 +736,60 @@ void CFWL_MonthCalendarImp::GetCapValue() { CFWL_ThemePart part; part.m_pWidget = m_pInterface; m_fHeadWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_WIDTH)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderWidth)); m_fHeadHei = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_Height)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderHeight)); m_fHeadBtnWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderBtnWidth)); m_fHeadBtnHei = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderBtnHeight)); m_fHeadBtnHMargin = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderBtnHMargin)); m_fHeadBtnVMargin = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderBtnVMargin)); m_fHeadTextWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderTextWidth)); m_fHeadTextHei = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderTextHeight)); m_fHeadTextHMargin = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderTextHMargin)); m_fHeadTextVMargin = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderTextVMargin)); m_fHSepWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_WIDTH)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HSepWidth)); m_fHSepHei = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_HEIGHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HSepHeight)); m_fWeekNumWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::WeekNumWidth)); m_fSepDOffset = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_DOFFSET)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::SepDOffset)); m_fSepX = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_X)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::SepX)); m_fSepY = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_Y)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::SepY)); m_fWeekNumHeigh = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::WeekNumHeight)); m_fWeekWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_WIDTH)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::WeekWidth)); m_fWeekHei = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_HEIGHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::WeekHeight)); m_fDateCellWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::DatesCellWidth)); m_fDateCellHei = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::DatesCellHeight)); m_fTodayWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_WIDHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TodayWidth)); m_fTodayHei = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_HEIGHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TodayHeight)); m_fTodayFlagWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TodayFlagWidth)); m_fMCWid = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WIDTH)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Width)); if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { m_fMCWid += m_fWeekNumWid; } m_fMCHei = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEIGHT)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Height)); } int32_t CFWL_MonthCalendarImp::CalWeekNumber(int32_t iYear, int32_t iMonth, @@ -990,11 +1081,11 @@ void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg, } void CFWL_MonthCalendarImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { - m_pOwner->m_iLBtnPartStates = FWL_PARTSTATE_MCD_Pressed; + m_pOwner->m_iLBtnPartStates = CFWL_PartState_Pressed; m_pOwner->PrevMonth(); m_pOwner->Repaint(&m_pOwner->m_rtClient); } else if (m_pOwner->m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { - m_pOwner->m_iRBtnPartStates |= FWL_PARTSTATE_MCD_Pressed; + m_pOwner->m_iRBtnPartStates |= CFWL_PartState_Pressed; m_pOwner->NextMonth(); m_pOwner->Repaint(&m_pOwner->m_rtClient); } else if (m_pOwner->m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) { diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.cpp b/xfa/fwl/basewidget/fwl_pictureboximp.cpp index 2787423d6e..e61dae3b2b 100644 --- a/xfa/fwl/basewidget/fwl_pictureboximp.cpp +++ b/xfa/fwl/basewidget/fwl_pictureboximp.cpp @@ -90,10 +90,10 @@ FWL_ERR CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Indefinite; IFWL_ThemeProvider* pTheme = GetAvailableTheme(); if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_PTB_Border, pTheme, pMatrix); + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_PTB_Edge, pTheme, pMatrix); + DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } DrawBkground(pGraphics, pTheme, pMatrix); return FWL_ERR_Succeeded; diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp index 89654d0271..92f0ca11d2 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp @@ -76,7 +76,7 @@ FWL_ERR CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { rect.Set(0, 0, sz.x, sz.y); } FX_FLOAT* fcaption = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_PSB_Margin)); + static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin)); rect.Inflate(*fcaption, *fcaption); CFWL_WidgetImp::GetWidgetRect(rect, TRUE); } else { @@ -102,7 +102,7 @@ FWL_ERR CFWL_PushButtonImp::Update() { GetClientRect(m_rtClient); m_rtCaption = m_rtClient; FX_FLOAT* fcaption = - static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_PSB_Margin)); + static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin)); m_rtCaption.Inflate(-*fcaption, -*fcaption); return FWL_ERR_Succeeded; } @@ -117,11 +117,11 @@ FWL_ERR CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, CFX_DIBitmap* pPicture = NULL; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_PSB_Border, m_pProperties->m_pThemeProvider, + DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_PSB_Edge, m_pProperties->m_pThemeProvider, + DrawEdge(pGraphics, CFWL_Part::Edge, m_pProperties->m_pThemeProvider, pMatrix); } DrawBkground(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); @@ -299,7 +299,7 @@ void CFWL_PushButtonImp::DrawBkground(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_PSB_Background; + param.m_iPart = CFWL_Part::Background; param.m_dwStates = GetPartStates(); param.m_pGraphics = pGraphics; if (pMatrix) { @@ -323,7 +323,7 @@ void CFWL_PushButtonImp::DrawText(CFX_Graphics* pGraphics, } CFWL_ThemeText param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_PSB_Caption; + param.m_iPart = CFWL_Part::Caption; param.m_dwStates = GetPartStates(); param.m_pGraphics = pGraphics; if (pMatrix) { @@ -336,18 +336,18 @@ void CFWL_PushButtonImp::DrawText(CFX_Graphics* pGraphics, pTheme->DrawText(¶m); } uint32_t CFWL_PushButtonImp::GetPartStates() { - uint32_t dwStates = FWL_PARTSTATE_PSB_Normal; + uint32_t dwStates = CFWL_PartState_Normal; if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { - dwStates |= FWL_PARTSTATE_PSB_Focused; + dwStates |= CFWL_PartState_Focused; } if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) { - dwStates = FWL_PARTSTATE_PSB_Disabled; + dwStates = CFWL_PartState_Disabled; } else if (m_pProperties->m_dwStates & FWL_STATE_PSB_Pressed) { - dwStates |= FWL_PARTSTATE_PSB_Pressed; + dwStates |= CFWL_PartState_Pressed; } else if (m_pProperties->m_dwStates & FWL_STATE_PSB_Hovered) { - dwStates |= FWL_PARTSTATE_PSB_Hovered; + dwStates |= CFWL_PartState_Hovered; } else if (m_pProperties->m_dwStates & FWL_STATE_PSB_Default) { - dwStates |= FWL_PARTSTATE_PSB_Default; + dwStates |= CFWL_PartState_Default; } return dwStates; } diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp index 23bda25d58..8812076f6b 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp @@ -75,11 +75,11 @@ CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, m_fStepSize(0), m_fPos(0), m_fTrackPos(0), - m_iMinButtonState(FWL_PARTSTATE_SCB_Normal), - m_iMaxButtonState(FWL_PARTSTATE_SCB_Normal), - m_iThumbButtonState(FWL_PARTSTATE_SCB_Normal), - m_iMinTrackState(FWL_PARTSTATE_SCB_Normal), - m_iMaxTrackState(FWL_PARTSTATE_SCB_Normal), + m_iMinButtonState(CFWL_PartState_Normal), + m_iMaxButtonState(CFWL_PartState_Normal), + m_iThumbButtonState(CFWL_PartState_Normal), + m_iMinTrackState(CFWL_PartState_Normal), + m_iMaxTrackState(CFWL_PartState_Normal), m_fLastTrackPos(0), m_cpTrackPointX(0), m_cpTrackPointY(0), @@ -122,7 +122,7 @@ FWL_ERR CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( - GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); + GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pfMinWidth) return FWL_ERR_Indefinite; if (IsVertical()) { @@ -154,10 +154,10 @@ FWL_ERR CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_SCB_Border, pTheme, pMatrix); + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_SCB_Edge, pTheme, pMatrix); + DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } DrawTrack(pGraphics, pTheme, TRUE, pMatrix); DrawTrack(pGraphics, pTheme, FALSE, pMatrix); @@ -247,9 +247,9 @@ void CFWL_ScrollBarImp::DrawTrack(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = bLower ? FWL_PART_SCB_LowerTrack : FWL_PART_SCB_UpperTrack; + param.m_iPart = bLower ? CFWL_Part::LowerTrack : CFWL_Part::UpperTrack; param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) - ? FWL_PARTSTATE_SCB_Disabled + ? CFWL_PartState_Disabled : (bLower ? m_iMinTrackState : m_iMaxTrackState); param.m_pGraphics = pGraphics; param.m_matrix.Concat(*pMatrix); @@ -262,9 +262,9 @@ void CFWL_ScrollBarImp::DrawArrowBtn(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = bMinBtn ? FWL_PART_SCB_ForeArrow : FWL_PART_SCB_BackArrow; + param.m_iPart = bMinBtn ? CFWL_Part::ForeArrow : CFWL_Part::BackArrow; param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) - ? FWL_PARTSTATE_SCB_Disabled + ? CFWL_PartState_Disabled : (bMinBtn ? m_iMinButtonState : m_iMaxButtonState); param.m_pGraphics = pGraphics; param.m_matrix.Concat(*pMatrix); @@ -280,9 +280,9 @@ void CFWL_ScrollBarImp::DrawThumb(CFX_Graphics* pGraphics, } CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_SCB_Thumb; + param.m_iPart = CFWL_Part::Thumb; param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) - ? FWL_PARTSTATE_SCB_Disabled + ? CFWL_PartState_Disabled : m_iThumbButtonState; param.m_pGraphics = pGraphics; param.m_matrix.Concat(*pMatrix); @@ -294,7 +294,7 @@ void CFWL_ScrollBarImp::Layout() { CFWL_ThemePart part; part.m_pWidget = m_pInterface; m_fMinThumb = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_CAPACITY_SCB_Size)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Size)); m_bCustomLayout = pTheme->IsCustomizedLayout(m_pInterface); GetClientRect(m_rtClient); CalcButtonLen(); @@ -320,9 +320,9 @@ void CFWL_ScrollBarImp::CalcMinButtonRect(CFX_RectF& rect) { CFWL_ThemePart pPart; pPart.m_rtPart = m_rtMinBtn; pPart.m_pWidget = m_pInterface; - pPart.m_iPart = FWL_PART_SCB_ForeArrow; + pPart.m_iPart = CFWL_Part::ForeArrow; pPart.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) - ? FWL_PARTSTATE_SCB_Disabled + ? CFWL_PartState_Disabled : m_iMinButtonState; pTheme->GetPartRect(&pPart, rect); } else { @@ -338,9 +338,9 @@ void CFWL_ScrollBarImp::CalcMaxButtonRect(CFX_RectF& rect) { CFWL_ThemePart pPart; pPart.m_rtPart = m_rtMaxBtn; pPart.m_pWidget = m_pInterface; - pPart.m_iPart = FWL_PART_SCB_BackArrow; + pPart.m_iPart = CFWL_Part::BackArrow; pPart.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) - ? FWL_PARTSTATE_SCB_Disabled + ? CFWL_PartState_Disabled : m_iMaxButtonState; pTheme->GetPartRect(&pPart, rect); } else { @@ -592,19 +592,19 @@ void CFWL_ScrollBarImp::GetTrackRect(CFX_RectF& rect, FX_BOOL bLower) { } } FX_BOOL CFWL_ScrollBarImp::SendEvent() { - if (m_iMinButtonState == FWL_PARTSTATE_SCB_Pressed) { + if (m_iMinButtonState == CFWL_PartState_Pressed) { DoScroll(FWL_SCBCODE_StepBackward, m_fTrackPos); return FALSE; } - if (m_iMaxButtonState == FWL_PARTSTATE_SCB_Pressed) { + if (m_iMaxButtonState == CFWL_PartState_Pressed) { DoScroll(FWL_SCBCODE_StepForward, m_fTrackPos); return FALSE; } - if (m_iMinTrackState == FWL_PARTSTATE_SCB_Pressed) { + if (m_iMinTrackState == CFWL_PartState_Pressed) { DoScroll(FWL_SCBCODE_PageBackward, m_fTrackPos); return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY); } - if (m_iMaxTrackState == FWL_PARTSTATE_SCB_Pressed) { + if (m_iMaxTrackState == CFWL_PartState_Pressed) { DoScroll(FWL_SCBCODE_PageForward, m_fTrackPos); return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY); } @@ -748,10 +748,10 @@ void CFWL_ScrollBarImpDelegate::DoMouseDown(int32_t iItem, if (!rtItem.Contains(fx, fy)) { return; } - if (iState == FWL_PARTSTATE_SCB_Pressed) { + if (iState == CFWL_PartState_Pressed) { return; } - iState = FWL_PARTSTATE_SCB_Pressed; + iState = CFWL_PartState_Pressed; m_pOwner->Repaint(&rtItem); } void CFWL_ScrollBarImpDelegate::DoMouseUp(int32_t iItem, @@ -759,8 +759,8 @@ void CFWL_ScrollBarImpDelegate::DoMouseUp(int32_t iItem, int32_t& iState, FX_FLOAT fx, FX_FLOAT fy) { - int32_t iNewState = rtItem.Contains(fx, fy) ? FWL_PARTSTATE_SCB_Hovered - : FWL_PARTSTATE_SCB_Normal; + int32_t iNewState = + rtItem.Contains(fx, fy) ? CFWL_PartState_Hovered : CFWL_PartState_Normal; if (iState == iNewState) { return; } @@ -774,15 +774,15 @@ void CFWL_ScrollBarImpDelegate::DoMouseMove(int32_t iItem, FX_FLOAT fx, FX_FLOAT fy) { if (!m_pOwner->m_bMouseDown) { - int32_t iNewState = rtItem.Contains(fx, fy) ? FWL_PARTSTATE_SCB_Hovered - : FWL_PARTSTATE_SCB_Normal; + int32_t iNewState = rtItem.Contains(fx, fy) ? CFWL_PartState_Hovered + : CFWL_PartState_Normal; if (iState == iNewState) { return; } iState = iNewState; m_pOwner->Repaint(&rtItem); } else if ((2 == iItem) && - (m_pOwner->m_iThumbButtonState == FWL_PARTSTATE_SCB_Pressed)) { + (m_pOwner->m_iThumbButtonState == CFWL_PartState_Pressed)) { FX_FLOAT fPos = m_pOwner->GetTrackPointPos(fx, fy); m_pOwner->m_fTrackPos = fPos; m_pOwner->OnScroll(FWL_SCBCODE_TrackPos, fPos); @@ -791,18 +791,18 @@ void CFWL_ScrollBarImpDelegate::DoMouseMove(int32_t iItem, void CFWL_ScrollBarImpDelegate::DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState) { - if (iState == FWL_PARTSTATE_SCB_Normal) { + if (iState == CFWL_PartState_Normal) { return; } - iState = FWL_PARTSTATE_SCB_Normal; + iState = CFWL_PartState_Normal; m_pOwner->Repaint(&rtItem); } void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState) { - if (iState == FWL_PARTSTATE_SCB_Hovered) { + if (iState == CFWL_PartState_Hovered) { return; } - iState = FWL_PARTSTATE_SCB_Hovered; + iState = CFWL_PartState_Hovered; m_pOwner->Repaint(&rtItem); } diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp index 9f276b7281..e52529d3c6 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp @@ -45,8 +45,8 @@ CFWL_SpinButtonImp::CFWL_SpinButtonImp( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_WidgetImp(properties, pOuter), - m_dwUpState(FWL_PARTSTATE_SPB_Normal), - m_dwDnState(FWL_PARTSTATE_SPB_Normal), + m_dwUpState(CFWL_PartState_Normal), + m_dwDnState(CFWL_PartState_Normal), m_iButtonIndex(0), m_bLButtonDwn(FALSE), m_hTimer(NULL) { @@ -112,7 +112,7 @@ uint32_t CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { CFX_RectF rtEdge; GetEdgeRect(rtEdge); if (rtEdge.Contains(fx, fy)) { - return FWL_PART_SPB_Edge; + return FWL_WGTHITTEST_Left; } } if (m_rtUpButton.Contains(fx, fy)) { @@ -133,10 +133,10 @@ FWL_ERR CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, } IFWL_ThemeProvider* pTheme = GetAvailableTheme(); if (HasBorder()) { - DrawBorder(pGraphics, FWL_PART_SPB_Border, pTheme, pMatrix); + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); } if (HasEdge()) { - DrawEdge(pGraphics, FWL_PART_SPB_Edge, pTheme, pMatrix); + DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } DrawUpButton(pGraphics, pTheme, pMatrix); DrawDownButton(pGraphics, pTheme, pMatrix); @@ -154,31 +154,31 @@ int32_t CFWL_SpinButtonImp::Run(FWL_HTIMER hTimer) { FWL_ERR CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { if (bUp) { if (bEnable) { - m_dwUpState = FWL_PARTSTATE_SPB_Normal; + m_dwUpState = CFWL_PartState_Normal; } else { - m_dwUpState = FWL_PARTSTATE_SPB_Disabled; + m_dwUpState = CFWL_PartState_Disabled; } } else { if (bEnable) { - m_dwDnState = FWL_PARTSTATE_SPB_Normal; + m_dwDnState = CFWL_PartState_Normal; } else { - m_dwDnState = FWL_PARTSTATE_SPB_Disabled; + m_dwDnState = CFWL_PartState_Disabled; } } return FWL_ERR_Succeeded; } FX_BOOL CFWL_SpinButtonImp::IsButtonEnable(FX_BOOL bUp) { if (bUp) { - return (m_dwUpState != FWL_PARTSTATE_SPB_Disabled); + return (m_dwUpState != CFWL_PartState_Disabled); } - return (m_dwDnState != FWL_PARTSTATE_SPB_Disabled); + return (m_dwDnState != CFWL_PartState_Disabled); } void CFWL_SpinButtonImp::DrawUpButton(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_SPB_UpButton; + params.m_iPart = CFWL_Part::UpButton; params.m_pGraphics = pGraphics; params.m_dwStates = m_dwUpState + 1; if (pMatrix) { @@ -192,7 +192,7 @@ void CFWL_SpinButtonImp::DrawDownButton(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground params; params.m_pWidget = m_pInterface; - params.m_iPart = FWL_PART_SPB_DownButton; + params.m_iPart = CFWL_Part::DownButton; params.m_pGraphics = pGraphics; params.m_dwStates = m_dwDnState + 1; if (pMatrix) { @@ -285,11 +285,11 @@ void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { } if (bUpPress) { m_pOwner->m_iButtonIndex = 0; - m_pOwner->m_dwUpState = FWL_PARTSTATE_SPB_Pressed; + m_pOwner->m_dwUpState = CFWL_PartState_Pressed; } if (bDnPress) { m_pOwner->m_iButtonIndex = 1; - m_pOwner->m_dwDnState = FWL_PARTSTATE_SPB_Pressed; + m_pOwner->m_dwDnState = CFWL_PartState_Pressed; } CFWL_EvtSpbClick wmPosChanged; wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; @@ -300,7 +300,7 @@ void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, FWL_SPIN_Elapse); } void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { - if (m_pOwner->m_pProperties->m_dwStates & FWL_PARTSTATE_SPB_Disabled) { + if (m_pOwner->m_pProperties->m_dwStates & CFWL_PartState_Disabled) { return; } m_pOwner->m_bLButtonDwn = FALSE; @@ -312,14 +312,14 @@ void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { } FX_BOOL bRepaint = FALSE; CFX_RectF rtInvalidate; - if (m_pOwner->m_dwUpState == FWL_PARTSTATE_SPB_Pressed && + if (m_pOwner->m_dwUpState == CFWL_PartState_Pressed && m_pOwner->IsButtonEnable(TRUE)) { - m_pOwner->m_dwUpState = FWL_PARTSTATE_SPB_Normal; + m_pOwner->m_dwUpState = CFWL_PartState_Normal; bRepaint = TRUE; rtInvalidate = m_pOwner->m_rtUpButton; - } else if (m_pOwner->m_dwDnState == FWL_PARTSTATE_SPB_Pressed && + } else if (m_pOwner->m_dwDnState == CFWL_PartState_Pressed && m_pOwner->IsButtonEnable(FALSE)) { - m_pOwner->m_dwDnState = FWL_PARTSTATE_SPB_Normal; + m_pOwner->m_dwDnState = CFWL_PartState_Normal; bRepaint = TRUE; rtInvalidate = m_pOwner->m_rtDnButton; } @@ -338,14 +338,14 @@ void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { rtInvlidate.Reset(); if (m_pOwner->m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy)) { if (m_pOwner->IsButtonEnable(TRUE)) { - if (m_pOwner->m_dwUpState == FWL_PARTSTATE_SPB_Hovered) { - m_pOwner->m_dwUpState = FWL_PARTSTATE_SPB_Hovered; + if (m_pOwner->m_dwUpState == CFWL_PartState_Hovered) { + m_pOwner->m_dwUpState = CFWL_PartState_Hovered; bRepaint = TRUE; rtInvlidate = m_pOwner->m_rtUpButton; } - if (m_pOwner->m_dwDnState != FWL_PARTSTATE_SPB_Normal && + if (m_pOwner->m_dwDnState != CFWL_PartState_Normal && m_pOwner->IsButtonEnable(FALSE)) { - m_pOwner->m_dwDnState = FWL_PARTSTATE_SPB_Normal; + m_pOwner->m_dwDnState = CFWL_PartState_Normal; if (bRepaint) { rtInvlidate.Union(m_pOwner->m_rtDnButton); } else { @@ -359,14 +359,14 @@ void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { } } else if (m_pOwner->m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy)) { if (m_pOwner->IsButtonEnable(FALSE)) { - if (m_pOwner->m_dwDnState != FWL_PARTSTATE_SPB_Hovered) { - m_pOwner->m_dwDnState = FWL_PARTSTATE_SPB_Hovered; + if (m_pOwner->m_dwDnState != CFWL_PartState_Hovered) { + m_pOwner->m_dwDnState = CFWL_PartState_Hovered; bRepaint = TRUE; rtInvlidate = m_pOwner->m_rtDnButton; } - if (m_pOwner->m_dwUpState != FWL_PARTSTATE_SPB_Normal && + if (m_pOwner->m_dwUpState != CFWL_PartState_Normal && m_pOwner->IsButtonEnable(TRUE)) { - m_pOwner->m_dwUpState = FWL_PARTSTATE_SPB_Normal; + m_pOwner->m_dwUpState = CFWL_PartState_Normal; if (bRepaint) { rtInvlidate.Union(m_pOwner->m_rtUpButton); } else { @@ -375,15 +375,15 @@ void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { bRepaint = TRUE; } } - } else if (m_pOwner->m_dwUpState != FWL_PARTSTATE_SPB_Normal || - m_pOwner->m_dwDnState != FWL_PARTSTATE_SPB_Normal) { - if (m_pOwner->m_dwUpState != FWL_PARTSTATE_SPB_Normal) { - m_pOwner->m_dwUpState = FWL_PARTSTATE_SPB_Normal; + } else if (m_pOwner->m_dwUpState != CFWL_PartState_Normal || + m_pOwner->m_dwDnState != CFWL_PartState_Normal) { + if (m_pOwner->m_dwUpState != CFWL_PartState_Normal) { + m_pOwner->m_dwUpState = CFWL_PartState_Normal; bRepaint = TRUE; rtInvlidate = m_pOwner->m_rtUpButton; } - if (m_pOwner->m_dwDnState != FWL_PARTSTATE_SPB_Normal) { - m_pOwner->m_dwDnState = FWL_PARTSTATE_SPB_Normal; + if (m_pOwner->m_dwDnState != CFWL_PartState_Normal) { + m_pOwner->m_dwDnState = CFWL_PartState_Normal; if (bRepaint) { rtInvlidate.Union(m_pOwner->m_rtDnButton); } else { @@ -399,13 +399,13 @@ void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { void CFWL_SpinButtonImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) { if (!pMsg) return; - if (m_pOwner->m_dwUpState != FWL_PARTSTATE_SPB_Normal && + if (m_pOwner->m_dwUpState != CFWL_PartState_Normal && m_pOwner->IsButtonEnable(TRUE)) { - m_pOwner->m_dwUpState = FWL_PARTSTATE_SPB_Normal; + m_pOwner->m_dwUpState = CFWL_PartState_Normal; } - if (m_pOwner->m_dwDnState != FWL_PARTSTATE_SPB_Normal && + if (m_pOwner->m_dwDnState != CFWL_PartState_Normal && m_pOwner->IsButtonEnable(FALSE)) { - m_pOwner->m_dwDnState = FWL_PARTSTATE_SPB_Normal; + m_pOwner->m_dwDnState = CFWL_PartState_Normal; } m_pOwner->Repaint(&m_pOwner->m_rtClient); } diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp index 3f5fccd0e9..36751b637d 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp @@ -17,6 +17,7 @@ #include "xfa/fwl/core/fwl_widgetimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" #include "xfa/fwl/core/ifwl_tooltiptarget.h" +#include "xfa/fwl/theme/cfwl_widgettp.h" // static IFWL_ToolTip* IFWL_ToolTip::Create(const CFWL_WidgetImpProperties& properties, @@ -94,8 +95,8 @@ FWL_ERR CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (iLen > 0) { CFX_SizeF sz = CalcTextSize(wsCaption, m_pProperties->m_pThemeProvider); rect.Set(0, 0, sz.x, sz.y); - rect.width += FWL_WGTCAPACITY_CXBorder * 25; - rect.height += FWL_WGTCAPACITY_CYBorder * 8; + rect.width += 25; + rect.height += 16; } CFWL_WidgetImp::GetWidgetRect(rect, TRUE); } else { @@ -124,9 +125,9 @@ FWL_ERR CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) { CFWL_ThemePart part; part.m_pWidget = m_pInterface; x = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CXBorder)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); y = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CYBorder)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); } rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); @@ -154,7 +155,7 @@ void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_TTP_Background; + param.m_iPart = CFWL_Part::Background; param.m_dwStates = m_pProperties->m_dwStates; param.m_pGraphics = pGraphics; if (pMatrix) { @@ -178,7 +179,7 @@ void CFWL_ToolTipImp::DrawText(CFX_Graphics* pGraphics, } CFWL_ThemeText param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_TTP_Caption; + param.m_iPart = CFWL_Part::Caption; param.m_dwStates = m_pProperties->m_dwStates; param.m_pGraphics = pGraphics; if (pMatrix) { diff --git a/xfa/fwl/basewidget/ifwl_barcode.h b/xfa/fwl/basewidget/ifwl_barcode.h index 0dbdcb03c1..a506dd8002 100644 --- a/xfa/fwl/basewidget/ifwl_barcode.h +++ b/xfa/fwl/basewidget/ifwl_barcode.h @@ -27,9 +27,6 @@ class CFWL_WidgetImpProperties; #define FWL_BCDATTRIBUTE_VERSION (1L << 10) #define FWL_BCDATTRIBUTE_ECLEVEL (1L << 11) #define FWL_BCDATTRIBUTE_TRUNCATED (1L << 12) -#define FWL_PART_BCD_Border 1 -#define FWL_PART_BCD_Edge 2 -#define FWL_PART_BCD_Background 3 #define FWL_BCUPDATECMD_Data FWL_WGTUPDATECMD_User class IFWL_BarcodeDP : public IFWL_EditDP { diff --git a/xfa/fwl/basewidget/ifwl_caret.h b/xfa/fwl/basewidget/ifwl_caret.h index 229bf12198..08a98c91c4 100644 --- a/xfa/fwl/basewidget/ifwl_caret.h +++ b/xfa/fwl/basewidget/ifwl_caret.h @@ -13,8 +13,6 @@ #define FWL_CLASS_Caret L"FWL_CARET" #define FWL_CLASSHASH_Caret 671181879 #define FWL_STATE_CAT_HightLight 1 -#define FWL_PART_CAT_Background 1 -#define FWL_PARTSTATE_CAT_HightLight 1 class IFWL_Caret : public IFWL_Widget { public: diff --git a/xfa/fwl/basewidget/ifwl_checkbox.h b/xfa/fwl/basewidget/ifwl_checkbox.h index 355121ac1e..f4cfe5f956 100644 --- a/xfa/fwl/basewidget/ifwl_checkbox.h +++ b/xfa/fwl/basewidget/ifwl_checkbox.h @@ -44,21 +44,6 @@ #define FWL_STATE_CKB_Checked (1 << (FWL_WGTSTATE_MAX + 2)) #define FWL_STATE_CKB_Neutral (2 << (FWL_WGTSTATE_MAX + 2)) #define FWL_STATE_CKB_CheckMask (3L << (FWL_WGTSTATE_MAX + 2)) -#define FWL_PART_CKB_Border 1 -#define FWL_PART_CKB_Edge 2 -#define FWL_PART_CKB_Background 3 -#define FWL_PART_CKB_CheckBox 4 -#define FWL_PART_CKB_Caption 5 -#define FWL_PARTSTATE_CKB_Normal (0L << 0) -#define FWL_PARTSTATE_CKB_Pressed (1L << 0) -#define FWL_PARTSTATE_CKB_Hovered (2L << 0) -#define FWL_PARTSTATE_CKB_Disabled (3L << 0) -#define FWL_PARTSTATE_CKB_UnChecked (0L << 2) -#define FWL_PARTSTATE_CKB_Checked (1L << 2) -#define FWL_PARTSTATE_CKB_Neutral (2L << 2) -#define FWL_PARTSTATE_CKB_Focused (1L << 4) -#define FWL_PARTSTATE_CKB_Mask1 (3L << 0) -#define FWL_PARTSTATE_CKB_Mask2 (3L << 2) // TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_CKB_CheckStateChanged 2503252963 diff --git a/xfa/fwl/basewidget/ifwl_combobox.h b/xfa/fwl/basewidget/ifwl_combobox.h index c5a30cf115..826404f9aa 100644 --- a/xfa/fwl/basewidget/ifwl_combobox.h +++ b/xfa/fwl/basewidget/ifwl_combobox.h @@ -38,18 +38,6 @@ class IFWL_ComboBox; #define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12) #define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 12) #define FWL_STYLEEXT_CMB_ReadOnly (1L << 13) -#define FWL_PART_CMB_Border 1 -#define FWL_PART_CMB_Edge 2 -#define FWL_PART_CMB_Background 3 -#define FWL_PART_CMB_DropDownButton 4 -#define FWL_PART_CMB_Caption 5 -#define FWL_PART_CMB_StretcgHandler 6 -#define FWL_PARTSTATE_CMB_Normal (0L << 0) -#define FWL_PARTSTATE_CMB_Hovered (1L << 0) -#define FWL_PARTSTATE_CMB_Pressed (2L << 0) -#define FWL_PARTSTATE_CMB_Disabled (3L << 0) -#define FWL_PARTSTATE_CMB_Selected (1L << 2) -#define FWL_WGTCAPACITY_CMB_ComboFormHandler (FWL_WGTCAPACITY_MAX + 7) // TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_CMB_PreDropDown 1357646798 #define FWL_EVTHASH_CMB_PostDropDown 3677010285 diff --git a/xfa/fwl/basewidget/ifwl_datetimepicker.h b/xfa/fwl/basewidget/ifwl_datetimepicker.h index f73aa73490..07bc8715c3 100644 --- a/xfa/fwl/basewidget/ifwl_datetimepicker.h +++ b/xfa/fwl/basewidget/ifwl_datetimepicker.h @@ -30,14 +30,6 @@ #define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4) #define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6) #define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8) -#define FWL_PART_DTP_Border 1 -#define FWL_PART_DTP_Edge 2 -#define FWL_PART_DTP_Background 3 -#define FWL_PART_DTP_DropDownButton 4 -#define FWL_PARTSTATE_DTP_Normal (0L << 0) -#define FWL_PARTSTATE_DTP_Hovered (1L << 0) -#define FWL_PARTSTATE_DTP_Pressed (2L << 0) -#define FWL_PARTSTATE_DTP_Disabled (3L << 0) // TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_DTP_DropDown 264728733 #define FWL_EVTHASH_DTP_CloseUp 4280973803 diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h index 90df9d959c..b1de2f91e8 100644 --- a/xfa/fwl/basewidget/ifwl_edit.h +++ b/xfa/fwl/basewidget/ifwl_edit.h @@ -48,15 +48,8 @@ #define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26) #define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27) #define FWL_STATE_EDT_Editing (1 << FWL_WGTSTATE_MAX) -#define FWL_PART_EDT_Border 1 -#define FWL_PART_EDT_Edge 2 -#define FWL_PART_EDT_Background 3 -#define FWL_PART_EDT_CombTextLine 4 #define FWL_PARTDATA_EDT_Background 0 #define FWL_PARTDATA_EDT_StaticBackground 1 -#define FWL_PARTSTATE_EDT_Normal (0L << 0) -#define FWL_PARTSTATE_EDT_ReadOnly (1L << 0) -#define FWL_PARTSTATE_EDT_Disable (2L << 0) // TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 #define FWL_EVTHASH_EDT_TextChanged 1064022132 #define FWL_EVTHASH_EDT_PreSelfAdaption 1001979178 diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h index d73ca0f38d..e80a3289f8 100644 --- a/xfa/fwl/basewidget/ifwl_listbox.h +++ b/xfa/fwl/basewidget/ifwl_listbox.h @@ -30,19 +30,6 @@ #define FWL_ITEMSTATE_LTB_Selected (1L << 0) #define FWL_ITEMSTATE_LTB_Focused (1L << 1) #define FWL_ITEMSTATE_LTB_Checked (1L << 2) -#define FWL_PART_LTB_Border 1 -#define FWL_PART_LTB_Edge 2 -#define FWL_PART_LTB_Background 3 -#define FWL_PART_LTB_ListItem 4 -#define FWL_PART_LTB_Check 5 -#define FWL_PART_LTB_Icon 6 -#define FWL_PARTSTATE_LTB_Normal (0L << 0) -#define FWL_PARTSTATE_LTB_Selected (1L << 0) -#define FWL_PARTSTATE_LTB_Disabled (2L << 0) -#define FWL_PARTSTATE_LTB_Focused (1L << 2) -#define FWL_PARTSTATE_LTB_UnChecked (0L << 3) -#define FWL_PARTSTATE_LTB_Checked (1L << 3) -#define FWL_PARTSTATE_LTB_Mask (3L << 0) #define FWL_WGTHITTEST_LTB_Item FWL_WGTHITTEST_MAX + 1 #define FWL_WGTHITTEST_LTB_HScrollBar FWL_WGTHITTEST_MAX + 2 #define FWL_WGTHITTEST_LTB_VScrollBar FWL_WGTHITTEST_MAX + 3 diff --git a/xfa/fwl/basewidget/ifwl_monthcalendar.h b/xfa/fwl/basewidget/ifwl_monthcalendar.h index 8ac9c36f4d..a635b1cde9 100644 --- a/xfa/fwl/basewidget/ifwl_monthcalendar.h +++ b/xfa/fwl/basewidget/ifwl_monthcalendar.h @@ -18,84 +18,10 @@ #define FWL_STYLEEXT_MCD_NoToday (1L << 1) #define FWL_STYLEEXT_MCD_NoTodayCircle (1L << 2) #define FWL_STYLEEXT_MCD_WeekNumbers (1L << 3) -#define FWL_WGTCAPACITY_MC_HEADER_WIDTH 12 -#define FWL_WGTCAPACITY_MC_HEADER_Height 13 -#define FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH 14 -#define FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT 15 -#define FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN 16 -#define FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN 17 -#define FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT 18 -#define FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT 19 -#define FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN 20 -#define FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN 21 -#define FWL_WGTCAPACITY_MC_HSEP_WIDTH 22 -#define FWL_WGTCAPACITY_MC_HSEP_HEIGHT 23 -#define FWL_WGTCAPACITY_MC_VSEP_WIDTH 24 -#define FWL_WGTCAPACITY_MC_VSEP_HEIGHT 25 -#define FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH 26 -#define FWL_WGTCAPACITY_MC_SEP_DOFFSET 40 -#define FWL_WGTCAPACITY_MC_SEP_X 27 -#define FWL_WGTCAPACITY_MC_SEP_Y 28 -#define FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT 29 -#define FWL_WGTCAPACITY_MC_WEEK_WIDTH 30 -#define FWL_WGTCAPACITY_MC_WEEK_HEIGHT 31 -#define FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH 32 -#define FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT 33 -#define FWL_WGTCAPACITY_MC_TODAY_WIDHT 34 -#define FWL_WGTCAPACITY_MC_TODAY_HEIGHT 35 -#define FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT 36 -#define FWL_WGTCAPACITY_MC_WIDTH 37 -#define FWL_WGTCAPACITY_MC_HEIGHT 38 #define FWL_ITEMSTATE_MCD_Nomal (0L << 0) #define FWL_ITEMSTATE_MCD_Flag (1L << 0) #define FWL_ITEMSTATE_MCD_Selected (1L << 1) #define FWL_ITEMSTATE_MCD_Focused (1L << 2) -#define FWL_PART_MCD_Border 1 -#define FWL_PART_MCD_Edge 2 -#define FWL_PART_MCD_Background 3 -#define FWL_PART_MCD_LBtn 4 -#define FWL_PART_MCD_RBtn 5 -#define FWL_PART_MCD_HSeparator 6 -#define FWL_PART_MCD_VSeparator 7 -#define FWL_PART_MCD_TodayCircle 8 -#define FWL_PART_MCD_DateInCircle 9 -#define FWL_PART_MCD_DateInBK 10 -#define FWL_PART_MCD_Caption 9 -#define FWL_PART_MCD_DatesIn 10 -#define FWL_PART_MCD_DatesOut 11 -#define FWL_PART_MCD_Week 12 -#define FWL_PART_MCD_Today 13 -#define FWL_PART_MCD_Header 14 -#define FWL_PART_MCD_WeekNum 15 -#define FWL_PART_MCD_WeekNumSep 16 -#define FWL_PARTSTATE_MCD_Normal (0L << 0) -#define FWL_PARTSTATE_MCD_Pressed (1L << 0) -#define FWL_PARTSTATE_MCD_Hovered (2L << 0) -#define FWL_PARTSTATE_MCD_Selected (3L << 0) -#define FWL_PARTSTATE_MCD_LSelected (1L << 2) -#define FWL_PARTSTATE_MCD_RSelected (2L << 2) -#define FWL_PARTSTATE_MCD_Flagged (1L << 3) -#define FWL_PARTSTATE_MCD_Focused (1L << 4) -#define FWL_MCCAPACITY_Sun FWL_WGTCAPACITY_MAX + 5 -#define FWL_MCCAPACITY_Mon FWL_WGTCAPACITY_MAX + 6 -#define FWL_MCCAPACITY_Tue FWL_WGTCAPACITY_MAX + 7 -#define FWL_MCCAPACITY_Wed FWL_WGTCAPACITY_MAX + 8 -#define FWL_MCCAPACITY_Thu FWL_WGTCAPACITY_MAX + 9 -#define FWL_MCCAPACITY_Fri FWL_WGTCAPACITY_MAX + 10 -#define FWL_MCCAPACITY_Sat FWL_WGTCAPACITY_MAX + 11 -#define FWL_MCCAPACITY_January FWL_WGTCAPACITY_MAX + 12 -#define FWL_MCCAPACITY_February FWL_WGTCAPACITY_MAX + 13 -#define FWL_MCCAPACITY_March FWL_WGTCAPACITY_MAX + 14 -#define FWL_MCCAPACITY_April FWL_WGTCAPACITY_MAX + 15 -#define FWL_MCCAPACITY_May FWL_WGTCAPACITY_MAX + 16 -#define FWL_MCCAPACITY_June FWL_WGTCAPACITY_MAX + 17 -#define FWL_MCCAPACITY_July FWL_WGTCAPACITY_MAX + 18 -#define FWL_MCCAPACITY_August FWL_WGTCAPACITY_MAX + 19 -#define FWL_MCCAPACITY_September FWL_WGTCAPACITY_MAX + 20 -#define FWL_MCCAPACITY_October FWL_WGTCAPACITY_MAX + 21 -#define FWL_MCCAPACITY_November FWL_WGTCAPACITY_MAX + 22 -#define FWL_MCCAPACITY_December FWL_WGTCAPACITY_MAX + 23 -#define FWL_MCCAPACITY_Today FWL_WGTCAPACITY_MAX + 24 #define FWL_EVENT_MCD_DATESELECTED L"FWL_EVENT_MCD_DateSelected" #define FWL_NOTEHASH_MCD_DATASELECTED 1085596932 // TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 diff --git a/xfa/fwl/basewidget/ifwl_picturebox.h b/xfa/fwl/basewidget/ifwl_picturebox.h index acc34f78d4..e663f23432 100644 --- a/xfa/fwl/basewidget/ifwl_picturebox.h +++ b/xfa/fwl/basewidget/ifwl_picturebox.h @@ -29,11 +29,6 @@ #define FWL_STYLEEXT_PTB_HAlignMask 3L << 0 #define FWL_STYLEEXT_PTB_VAlignMask 3L << 2 #define FWL_STYLEEXT_PTB_StretchAlignMask 7L << 4 -#define FWL_PART_PTB_Border 1 -#define FWL_PART_PTB_Edge 2 -#define FWL_PART_PTB_Image 3 -#define FWL_PARTSTATE_PTB_Normal (0L << 0) -#define FWL_PARTSTATE_PTB_Disabled (1L << 0) class CFX_DIBitmap; diff --git a/xfa/fwl/basewidget/ifwl_pushbutton.h b/xfa/fwl/basewidget/ifwl_pushbutton.h index 400b0c1b38..32e1e17215 100644 --- a/xfa/fwl/basewidget/ifwl_pushbutton.h +++ b/xfa/fwl/basewidget/ifwl_pushbutton.h @@ -29,18 +29,6 @@ #define FWL_STATE_PSB_Hovered (1 << FWL_WGTSTATE_MAX) #define FWL_STATE_PSB_Pressed (1 << (FWL_WGTSTATE_MAX + 1)) #define FWL_STATE_PSB_Default (1 << (FWL_WGTSTATE_MAX + 2)) -#define FWL_WGTCAPACITY_PSB_Margin (FWL_WGTCAPACITY_MAX + 1) -#define FWL_PART_PSB_Border 1 -#define FWL_PART_PSB_Edge 2 -#define FWL_PART_PSB_Background 3 -#define FWL_PART_PSB_Caption 4 -#define FWL_PARTSTATE_PSB_Normal (0L << 0) -#define FWL_PARTSTATE_PSB_Pressed (1L << 0) -#define FWL_PARTSTATE_PSB_Hovered (2L << 0) -#define FWL_PARTSTATE_PSB_Default (3L << 0) -#define FWL_PARTSTATE_PSB_Disabled (4L << 0) -#define FWL_PARTSTATE_PSB_Focused (1L << 3) -#define FWL_PARTSTATE_PSB_Mask (7L << 0) class CFX_DIBitmap; diff --git a/xfa/fwl/basewidget/ifwl_scrollbar.h b/xfa/fwl/basewidget/ifwl_scrollbar.h index a5b17eab90..2f2994b8f0 100644 --- a/xfa/fwl/basewidget/ifwl_scrollbar.h +++ b/xfa/fwl/basewidget/ifwl_scrollbar.h @@ -18,24 +18,11 @@ #define FWL_CLASSHASH_ScrollBar 2826584844 #define FWL_STYLEEXT_SCB_Horz (0L << 0) #define FWL_STYLEEXT_SCB_Vert (1L << 0) -#define FWL_PART_SCB_Border 1 -#define FWL_PART_SCB_Edge 2 -#define FWL_PART_SCB_Background 3 -#define FWL_PART_SCB_ForeArrow 4 -#define FWL_PART_SCB_BackArrow 5 -#define FWL_PART_SCB_Thumb 6 -#define FWL_PART_SCB_LowerTrack 7 -#define FWL_PART_SCB_UpperTrack 8 -#define FWL_PARTSTATE_SCB_Normal (0L << 0) -#define FWL_PARTSTATE_SCB_Hovered (1L << 0) -#define FWL_PARTSTATE_SCB_Pressed (2L << 0) -#define FWL_PARTSTATE_SCB_Disabled (3L << 0) #define FWL_WGTHITTEST_SCB_ForeArrow FWL_WGTHITTEST_MAX + 1 #define FWL_WGTHITTEST_SCB_BackArrow FWL_WGTHITTEST_MAX + 2 #define FWL_WGTHITTEST_SCB_LowerTrack FWL_WGTHITTEST_MAX + 3 #define FWL_WGTHITTEST_SCB_UpperTrack FWL_WGTHITTEST_MAX + 4 #define FWL_WGTHITTEST_SCB_Thumb FWL_WGTHITTEST_MAX + 5 -#define FWL_CAPACITY_SCB_Size FWL_WGTCAPACITY_MAX enum FWL_SCBCODE { FWL_SCBCODE_None = 1, diff --git a/xfa/fwl/basewidget/ifwl_spinbutton.h b/xfa/fwl/basewidget/ifwl_spinbutton.h index 87f38b4d5f..9a8ff59520 100644 --- a/xfa/fwl/basewidget/ifwl_spinbutton.h +++ b/xfa/fwl/basewidget/ifwl_spinbutton.h @@ -12,14 +12,6 @@ #define FWL_CLASS_SpinButton L"FWL_SPINBUTTON" #define FWL_CLASSHASH_SpinButton 3793043646 #define FWL_STYLEEXE_SPB_Vert (1L << 0) -#define FWL_PART_SPB_Border 1 -#define FWL_PART_SPB_Edge 2 -#define FWL_PART_SPB_UpButton 3 -#define FWL_PART_SPB_DownButton 4 -#define FWL_PARTSTATE_SPB_Normal (0L << 0) -#define FWL_PARTSTATE_SPB_Hovered (1L << 0) -#define FWL_PARTSTATE_SPB_Pressed (2L << 0) -#define FWL_PARTSTATE_SPB_Disabled (3L << 0) #define FWL_WGTHITTEST_SPB_UpButton (FWL_WGTHITTEST_MAX + 1) #define FWL_WGTHITTEST_SPB_DownButton (FWL_WGTHITTEST_MAX + 2) // TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 diff --git a/xfa/fwl/basewidget/ifwl_tooltip.h b/xfa/fwl/basewidget/ifwl_tooltip.h index 278544b459..b9a07613a8 100644 --- a/xfa/fwl/basewidget/ifwl_tooltip.h +++ b/xfa/fwl/basewidget/ifwl_tooltip.h @@ -19,9 +19,6 @@ class IFWL_ToolTip; #define FWL_STYLEEXT_TTP_Balloon (1L << 4) #define FWL_STYLEEXT_TTP_Multiline (1L << 5) #define FWL_STYLEEXT_TTP_NoAnchor (1L << 6) -#define FWL_PART_TTP_Border 1 -#define FWL_PART_TTP_Background 2 -#define FWL_PART_TTP_Caption 3 class IFWL_ToolTipDP : public IFWL_DataProvider { public: diff --git a/xfa/fwl/core/cfwl_themebackground.h b/xfa/fwl/core/cfwl_themebackground.h index 6cecbbf26a..9761183011 100644 --- a/xfa/fwl/core/cfwl_themebackground.h +++ b/xfa/fwl/core/cfwl_themebackground.h @@ -16,7 +16,9 @@ class CFX_Path; class CFWL_ThemeBackground : public CFWL_ThemePart { public: - CFWL_ThemeBackground() : m_pGraphics(NULL), m_pImage(NULL), m_pPath(NULL) {} + CFWL_ThemeBackground() + : m_pGraphics(nullptr), m_pImage(nullptr), m_pPath(nullptr) {} + CFX_Graphics* m_pGraphics; CFX_DIBitmap* m_pImage; CFX_Path* m_pPath; diff --git a/xfa/fwl/core/cfwl_themepart.h b/xfa/fwl/core/cfwl_themepart.h index 884f38101f..5868465c08 100644 --- a/xfa/fwl/core/cfwl_themepart.h +++ b/xfa/fwl/core/cfwl_themepart.h @@ -11,10 +11,81 @@ #include "core/fxcrt/include/fx_system.h" #include "xfa/fwl/core/ifwl_widget.h" +enum class CFWL_Part { + None = 0, + + BackArrow, + Background, + Border, + Caption, + Check, + CheckBox, + CloseBox, + CombTextLine, + DateInBK, + DateInCircle, + DatesIn, + DatesOut, + DownButton, + DropDownButton, + Edge, + ForeArrow, + HSeparator, + HeadText, + Header, + Icon, + Image, + LBtn, + ListItem, + LowerTrack, + MinimizeBox, + MaximizeBox, + NarrowCaption, + RBtn, + StretchHandler, + Thumb, + ThumbBackArrow, + ThumbForeArrow, + ThumbLowerTrack, + ThumbThumb, + ThumbUpperTrack, + Today, + TodayCircle, + UpButton, + UpperTrack, + VSeparator, + Week, + WeekNum, + WeekNumSep +}; + +enum CFWL_PartState { + CFWL_PartState_Normal = 0, + + CFWL_PartState_Checked = 1 << 1, + CFWL_PartState_Default = 1 << 2, + CFWL_PartState_Disabled = 1 << 3, + CFWL_PartState_Flagged = 1 << 4, + CFWL_PartState_Focused = 1 << 5, + CFWL_PartState_HightLight = 1 << 6, + CFWL_PartState_Hovered = 1 << 7, + CFWL_PartState_Inactive = 1 << 8, + CFWL_PartState_Neutral = 1 << 9, + CFWL_PartState_Pressed = 1 << 10, + CFWL_PartState_ReadOnly = 1 << 11, + CFWL_PartState_LSelected = 1 << 12, + CFWL_PartState_RSelected = 1 << 13, + CFWL_PartState_Selected = 1 << 14 +}; + class CFWL_ThemePart { public: CFWL_ThemePart() - : m_pWidget(NULL), m_iPart(0), m_dwStates(0), m_dwData(0), m_pData(NULL) { + : m_pWidget(nullptr), + m_iPart(CFWL_Part::None), + m_dwStates(CFWL_PartState_Normal), + m_dwData(0), + m_pData(nullptr) { m_rtPart.Reset(); m_matrix.SetIdentity(); } @@ -22,7 +93,7 @@ class CFWL_ThemePart { CFX_Matrix m_matrix; CFX_RectF m_rtPart; IFWL_Widget* m_pWidget; - int32_t m_iPart; + CFWL_Part m_iPart; uint32_t m_dwStates; uint32_t m_dwData; void* m_pData; diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 5b1fe7aa28..338c55fee1 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -21,6 +21,7 @@ #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_themeprovider.h" +#include "xfa/fwl/theme/cfwl_widgettp.h" #define FWL_SYSBTNSIZE 21 #define FWL_SYSBTNMARGIN 5 @@ -168,11 +169,11 @@ FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { CFWL_ThemePart part; part.m_pWidget = m_pInterface; x = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CXBorder)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); y = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CYBorder)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); t = *static_cast<FX_FLOAT*>( - pTheme->GetCapacity(&part, FWL_WGTCAPACITY_FRM_CYCaption)); + pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYCaption)); } rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); @@ -270,8 +271,7 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; FX_BOOL bInactive = !IsActive(); - int32_t iState = - bInactive ? FWL_PARTSTATE_FRM_Inactive : FWL_PARTSTATE_FRM_Normal; + int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { DrawBackground(pGraphics, pTheme); } @@ -287,33 +287,33 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, param.m_matrix.Concat(*pMatrix); } if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { - param.m_iPart = FWL_PART_FRM_Border; + param.m_iPart = CFWL_Part::Border; pTheme->DrawBackground(¶m); } if ((m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_EdgeMask) != FWL_WGTSTYLE_EdgeNone) { CFX_RectF rtEdge; GetEdgeRect(rtEdge); - param.m_iPart = FWL_PART_FRM_Edge; + param.m_iPart = CFWL_Part::Edge; param.m_rtPart = rtEdge; param.m_dwStates = iState; pTheme->DrawBackground(¶m); } if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) { - param.m_iPart = FWL_PART_FRM_Caption; + param.m_iPart = CFWL_Part::Caption; param.m_dwStates = iState; param.m_rtPart = m_rtCaption; pTheme->DrawBackground(¶m); DrawCaptionText(pGraphics, pTheme, pMatrix); } else if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_NarrowCaption) { - param.m_iPart = FWL_PART_FRM_NarrowCaption; + param.m_iPart = CFWL_Part::NarrowCaption; param.m_dwStates = iState; param.m_rtPart = m_rtCaption; pTheme->DrawBackground(¶m); DrawCaptionText(pGraphics, pTheme, pMatrix); } if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { - param.m_iPart = FWL_PART_FRM_Icon; + param.m_iPart = CFWL_Part::Icon; if (HasIcon()) { DrawIconImage(pGraphics, pTheme, pMatrix); } @@ -321,35 +321,35 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, #if (_FX_OS_ == _FX_MACOSX_) { if (m_pCloseBox) { - param.m_iPart = FWL_PART_FRM_CloseBox; + param.m_iPart = CFWL_Part::CloseBox; param.m_dwStates = m_pCloseBox->GetPartState(); if (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) { - param.m_dwStates = FWL_PARTSTATE_FRM_Disabled; - } else if (FWL_PARTSTATE_FRM_Normal == param.m_dwStates && m_bMouseIn) { - param.m_dwStates = FWL_PARTSTATE_FRM_Hover; + param.m_dwStates = CFWL_PartState_Disabled; + } else if (CFWL_PartState_Normal == param.m_dwStates && m_bMouseIn) { + param.m_dwStates = CFWL_PartState_Hovered; } param.m_rtPart = m_pCloseBox->m_rtBtn; pTheme->DrawBackground(¶m); } if (m_pMaxBox) { - param.m_iPart = FWL_PART_FRM_MaximizeBox; + param.m_iPart = CFWL_Part::MaximizeBox; param.m_dwStates = m_pMaxBox->GetPartState(); if (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) { - param.m_dwStates = FWL_PARTSTATE_FRM_Disabled; - } else if (FWL_PARTSTATE_FRM_Normal == param.m_dwStates && m_bMouseIn) { - param.m_dwStates = FWL_PARTSTATE_FRM_Hover; + param.m_dwStates = CFWL_PartState_Disabled; + } else if (CFWL_PartState_Normal == param.m_dwStates && m_bMouseIn) { + param.m_dwStates = CFWL_PartState_Hovered; } param.m_rtPart = m_pMaxBox->m_rtBtn; param.m_dwData = m_bMaximized; pTheme->DrawBackground(¶m); } if (m_pMinBox) { - param.m_iPart = FWL_PART_FRM_MinimizeBox; + param.m_iPart = CFWL_Part::MinimizeBox; param.m_dwStates = m_pMinBox->GetPartState(); if (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) { - param.m_dwStates = FWL_PARTSTATE_FRM_Disabled; - } else if (FWL_PARTSTATE_FRM_Normal == param.m_dwStates && m_bMouseIn) { - param.m_dwStates = FWL_PARTSTATE_FRM_Hover; + param.m_dwStates = CFWL_PartState_Disabled; + } else if (CFWL_PartState_Normal == param.m_dwStates && m_bMouseIn) { + param.m_dwStates = CFWL_PartState_Hovered; } param.m_rtPart = m_pMinBox->m_rtBtn; pTheme->DrawBackground(¶m); @@ -359,20 +359,20 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, #else { if (m_pCloseBox) { - param.m_iPart = FWL_PART_FRM_CloseBox; + param.m_iPart = CFWL_Part::CloseBox; param.m_dwStates = m_pCloseBox->GetPartState(); param.m_rtPart = m_pCloseBox->m_rtBtn; pTheme->DrawBackground(¶m); } if (m_pMaxBox) { - param.m_iPart = FWL_PART_FRM_MaximizeBox; + param.m_iPart = CFWL_Part::MaximizeBox; param.m_dwStates = m_pMaxBox->GetPartState(); param.m_rtPart = m_pMaxBox->m_rtBtn; param.m_dwData = m_bMaximized; pTheme->DrawBackground(¶m); } if (m_pMinBox) { - param.m_iPart = FWL_PART_FRM_MinimizeBox; + param.m_iPart = CFWL_Part::MinimizeBox; param.m_dwStates = m_pMinBox->GetPartState(); param.m_rtPart = m_pMinBox->m_rtBtn; pTheme->DrawBackground(¶m); @@ -439,7 +439,7 @@ void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_FRM_Background; + param.m_iPart = CFWL_Part::Background; param.m_pGraphics = pGraphics; param.m_rtPart = m_rtRelative; param.m_rtPart.Deflate(m_fCYBorder, m_rtCaption.height, m_fCYBorder, @@ -559,13 +559,14 @@ int32_t CFWL_FormImp::GetSysBtnIndex(CFWL_SysBtn* pBtn) { return arrBtn.Find(pBtn); } FX_FLOAT CFWL_FormImp::GetCaptionHeight() { - uint32_t dwCapacity = 0; + CFWL_WidgetCapacity dwCapacity = CFWL_WidgetCapacity::None; + if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) { - dwCapacity = FWL_WGTCAPACITY_FRM_CYCaption; + dwCapacity = CFWL_WidgetCapacity::CYCaption; } else if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_NarrowCaption) { - dwCapacity = FWL_WGTCAPACITY_FRM_CYNarrowCaption; + dwCapacity = CFWL_WidgetCapacity::CYNarrowCaption; } - if (dwCapacity > 0) { + if (dwCapacity != CFWL_WidgetCapacity::None) { FX_FLOAT* pfCapHeight = static_cast<FX_FLOAT*>(GetThemeCapacity(dwCapacity)); return pfCapHeight ? *pfCapHeight : 0; @@ -583,8 +584,8 @@ void CFWL_FormImp::DrawCaptionText(CFX_Graphics* pGs, } CFWL_ThemeText textParam; textParam.m_pWidget = m_pInterface; - textParam.m_iPart = FWL_PART_FRM_Caption; - textParam.m_dwStates = FWL_PARTSTATE_FRM_Normal; + textParam.m_iPart = CFWL_Part::Caption; + textParam.m_dwStates = CFWL_PartState_Normal; textParam.m_pGraphics = pGs; if (pMatrix) { textParam.m_matrix.Concat(*pMatrix); @@ -613,7 +614,7 @@ void CFWL_FormImp::DrawIconImage(CFX_Graphics* pGs, static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_FRM_Icon; + param.m_iPart = CFWL_Part::Icon; param.m_pGraphics = pGs; param.m_pImage = pData->GetIcon(m_pInterface, FALSE); param.m_rtPart = m_rtIcon; @@ -648,9 +649,9 @@ void CFWL_FormImp::Layout() { } void CFWL_FormImp::ReSetSysBtn() { m_fCXBorder = - *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_CXBorder)); + *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::CXBorder)); m_fCYBorder = - *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_CYBorder)); + *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::CYBorder)); RemoveSysButtons(); IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; m_bCustomizeLayout = pTheme->IsCustomizedLayout(m_pInterface); @@ -665,7 +666,7 @@ void CFWL_FormImp::ReSetSysBtn() { if (m_bCustomizeLayout) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_FRM_CloseBox; + param.m_iPart = CFWL_Part::CloseBox; pTheme->GetPartRect(¶m, m_pCloseBox->m_rtBtn); } else { m_pCloseBox->m_rtBtn.Set( @@ -679,7 +680,7 @@ void CFWL_FormImp::ReSetSysBtn() { if (m_bCustomizeLayout) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_FRM_MaximizeBox; + param.m_iPart = CFWL_Part::MaximizeBox; pTheme->GetPartRect(¶m, m_pMaxBox->m_rtBtn); } else { if (m_pCloseBox) { @@ -699,7 +700,7 @@ void CFWL_FormImp::ReSetSysBtn() { if (m_bCustomizeLayout) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_FRM_MinimizeBox; + param.m_iPart = CFWL_Part::MinimizeBox; pTheme->GetPartRect(¶m, m_pMinBox->m_rtBtn); } else { if (m_pMaxBox) { @@ -725,7 +726,7 @@ void CFWL_FormImp::ReSetSysBtn() { if (m_bCustomizeLayout) { CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; - param.m_iPart = FWL_PART_FRM_Icon; + param.m_iPart = CFWL_Part::Icon; CFX_WideString wsText; m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsText); param.m_pData = &wsText; @@ -738,7 +739,7 @@ void CFWL_FormImp::ReSetSysBtn() { if (m_bCustomizeLayout) { CFWL_ThemeText parma; parma.m_pWidget = m_pInterface; - parma.m_iPart = FWL_PART_FRM_HeadText; + parma.m_iPart = CFWL_Part::HeadText; m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText); pTheme->GetPartRect(&parma, m_rtCaptionText); } @@ -768,9 +769,9 @@ FX_BOOL CFWL_FormImp::IsDoModal() { } void CFWL_FormImp::SetThemeData() { m_fSmallIconSz = - *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_FRM_SmallIcon)); + *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::SmallIcon)); m_fBigIconSz = - *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_FRM_BigIcon)); + *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon)); } FX_BOOL CFWL_FormImp::HasIcon() { IFWL_FormDP* pData = diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h index 66e96b33b8..dccdf7f2af 100644 --- a/xfa/fwl/core/fwl_formimp.h +++ b/xfa/fwl/core/fwl_formimp.h @@ -48,7 +48,7 @@ class CFWL_SysBtn { : m_dwState &= ~FWL_SYSBUTTONSTATE_Disabled; } int32_t GetPartState() { - return (IsDisabled() ? FWL_PARTSTATE_FRM_Disabled : (m_dwState + 1)); + return (IsDisabled() ? CFWL_PartState_Disabled : (m_dwState + 1)); } CFX_RectF m_rtBtn; diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index ad75483fe4..b11530eab5 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -575,28 +575,28 @@ void CFWL_WidgetImp::GetEdgeRect(CFX_RectF& rtEdge) { } FX_FLOAT CFWL_WidgetImp::GetBorderSize(FX_BOOL bCX) { FX_FLOAT* pfBorder = static_cast<FX_FLOAT*>(GetThemeCapacity( - bCX ? FWL_WGTCAPACITY_CXBorder : FWL_WGTCAPACITY_CYBorder)); + bCX ? CFWL_WidgetCapacity::CXBorder : CFWL_WidgetCapacity::CYBorder)); if (!pfBorder) return 0; return *pfBorder; } FX_FLOAT CFWL_WidgetImp::GetEdgeWidth() { - uint32_t dwCapacity = 0; + CFWL_WidgetCapacity dwCapacity = CFWL_WidgetCapacity::None; switch (m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask) { case FWL_WGTSTYLE_EdgeFlat: { - dwCapacity = FWL_WGTCAPACITY_EdgeFlat; + dwCapacity = CFWL_WidgetCapacity::EdgeFlat; break; } case FWL_WGTSTYLE_EdgeRaised: { - dwCapacity = FWL_WGTCAPACITY_EdgeRaised; + dwCapacity = CFWL_WidgetCapacity::EdgeRaised; break; } case FWL_WGTSTYLE_EdgeSunken: { - dwCapacity = FWL_WGTCAPACITY_EdgeSunken; + dwCapacity = CFWL_WidgetCapacity::EdgeSunken; break; } } - if (dwCapacity > 0) { + if (dwCapacity != CFWL_WidgetCapacity::None) { FX_FLOAT* fRet = static_cast<FX_FLOAT*>(GetThemeCapacity(dwCapacity)); return fRet ? *fRet : 0; } @@ -606,7 +606,7 @@ void CFWL_WidgetImp::GetRelativeRect(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; rect.left = rect.top = 0; } -void* CFWL_WidgetImp::GetThemeCapacity(uint32_t dwCapacity) { +void* CFWL_WidgetImp::GetThemeCapacity(CFWL_WidgetCapacity dwCapacity) { IFWL_ThemeProvider* pTheme = GetAvailableTheme(); if (!pTheme) return NULL; @@ -866,7 +866,7 @@ void CFWL_WidgetImp::Repaint(const CFX_RectF* pRect) { m_pWidgetMgr->RepaintWidget(m_pInterface, &rect); } void CFWL_WidgetImp::DrawBackground(CFX_Graphics* pGraphics, - int32_t iPartBk, + CFWL_Part iPartBk, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { CFX_RectF rtRelative; @@ -882,7 +882,7 @@ void CFWL_WidgetImp::DrawBackground(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); } void CFWL_WidgetImp::DrawBorder(CFX_Graphics* pGraphics, - int32_t iPartBorder, + CFWL_Part iPartBorder, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { CFX_RectF rtRelative; @@ -898,7 +898,7 @@ void CFWL_WidgetImp::DrawBorder(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); } void CFWL_WidgetImp::DrawEdge(CFX_Graphics* pGraphics, - int32_t iPartEdge, + CFWL_Part iPartEdge, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { CFX_RectF rtEdge; diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h index bd9be7edc5..2e5e761512 100644 --- a/xfa/fwl/core/fwl_widgetimp.h +++ b/xfa/fwl/core/fwl_widgetimp.h @@ -10,8 +10,10 @@ #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_system.h" #include "xfa/fwl/core/cfwl_event.h" +#include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/fwl_targetimp.h" #include "xfa/fwl/core/ifwl_widgetdelegate.h" +#include "xfa/fwl/theme/cfwl_widgettp.h" class CFWL_MsgKey; class CFWL_ThreadImp; @@ -86,7 +88,7 @@ class CFWL_WidgetImp : public CFWL_TargetImp { FX_FLOAT GetBorderSize(FX_BOOL bCX = TRUE); FX_FLOAT GetEdgeWidth(); void GetRelativeRect(CFX_RectF& rect); - void* GetThemeCapacity(uint32_t dwCapacity); + void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity); IFWL_ThemeProvider* GetAvailableTheme(); CFWL_WidgetImp* GetRootOuter(); CFX_SizeF CalcTextSize(const CFX_WideString& wsText, @@ -124,15 +126,15 @@ class CFWL_WidgetImp : public CFWL_TargetImp { void DispatchEvent(CFWL_Event* pEvent); void Repaint(const CFX_RectF* pRect = NULL); void DrawBackground(CFX_Graphics* pGraphics, - int32_t iPartBk, + CFWL_Part iPartBk, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix = NULL); void DrawBorder(CFX_Graphics* pGraphics, - int32_t iPartBorder, + CFWL_Part iPartBorder, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix = NULL); void DrawEdge(CFX_Graphics* pGraphics, - int32_t iPartEdge, + CFWL_Part iPartEdge, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix = NULL); void NotifyDriver(); diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 95cae64fa2..185e059826 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -28,26 +28,6 @@ #define FWL_UseMacSystemBorder #endif -#define FWL_WGTCAPACITY_FRM_CYCaption (FWL_WGTCAPACITY_MAX + 1) -#define FWL_WGTCAPACITY_FRM_CYNarrowCaption (FWL_WGTCAPACITY_MAX + 2) -#define FWL_WGTCAPACITY_FRM_BigIcon (FWL_WGTCAPACITY_MAX + 3) -#define FWL_WGTCAPACITY_FRM_SmallIcon (FWL_WGTCAPACITY_MAX + 4) -#define FWL_PART_FRM_Border 1 -#define FWL_PART_FRM_Edge 2 -#define FWL_PART_FRM_Background 3 -#define FWL_PART_FRM_Caption 4 -#define FWL_PART_FRM_NarrowCaption 5 -#define FWL_PART_FRM_CloseBox 6 -#define FWL_PART_FRM_MinimizeBox 7 -#define FWL_PART_FRM_MaximizeBox 8 -#define FWL_PART_FRM_HeadText 9 -#define FWL_PART_FRM_Icon 10 -#define FWL_PARTSTATE_FRM_Normal 1 -#define FWL_PARTSTATE_FRM_Hover 2 -#define FWL_PARTSTATE_FRM_Pressed 3 -#define FWL_PARTSTATE_FRM_Inactive 4 -#define FWL_PARTSTATE_FRM_Disabled 5 - enum FWL_FORMSIZE { FWL_FORMSIZE_Manual = 0, FWL_FORMSIZE_Width, diff --git a/xfa/fwl/core/ifwl_themeprovider.h b/xfa/fwl/core/ifwl_themeprovider.h index f0fb1492a8..c790da5f4e 100644 --- a/xfa/fwl/core/ifwl_themeprovider.h +++ b/xfa/fwl/core/ifwl_themeprovider.h @@ -10,21 +10,7 @@ #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_system.h" #include "xfa/fwl/core/fwl_error.h" - -#define FWL_WGTCAPACITY_CXBorder 1 -#define FWL_WGTCAPACITY_CYBorder 2 -#define FWL_WGTCAPACITY_ScrollBarWidth 3 -#define FWL_WGTCAPACITY_EdgeFlat 4 -#define FWL_WGTCAPACITY_EdgeRaised 5 -#define FWL_WGTCAPACITY_EdgeSunken 6 -#define FWL_WGTCAPACITY_Font 7 -#define FWL_WGTCAPACITY_FontSize 8 -#define FWL_WGTCAPACITY_TextColor 9 -#define FWL_WGTCAPACITY_TextSelColor 10 -#define FWL_WGTCAPACITY_LineHeight 11 -#define FWL_WGTCAPACITY_UIMargin 12 -#define FWL_WGTCAPACITY_SpaceAboveBelow 13 -#define FWL_WGTCAPACITY_MAX 65535 +#include "xfa/fwl/theme/cfwl_widgettp.h" class CFWL_ThemeBackground; class CFWL_ThemePart; @@ -45,7 +31,7 @@ class IFWL_ThemeProvider { virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) = 0; virtual FX_BOOL DrawText(CFWL_ThemeText* pParams) = 0; virtual void* GetCapacity(CFWL_ThemePart* pThemePart, - uint32_t dwCapacity) = 0; + CFWL_WidgetCapacity dwCapacity) = 0; virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) = 0; virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) = 0; diff --git a/xfa/fwl/lightwidget/cfwl_theme.cpp b/xfa/fwl/lightwidget/cfwl_theme.cpp index fdb0a89997..65a5aaf689 100644 --- a/xfa/fwl/lightwidget/cfwl_theme.cpp +++ b/xfa/fwl/lightwidget/cfwl_theme.cpp @@ -81,7 +81,8 @@ FX_BOOL CFWL_Theme::DrawText(CFWL_ThemeText* pParams) { return GetTheme(pParams->m_pWidget)->DrawText(pParams); } -void* CFWL_Theme::GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity) { +void* CFWL_Theme::GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity) { return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity); } diff --git a/xfa/fwl/lightwidget/cfwl_theme.h b/xfa/fwl/lightwidget/cfwl_theme.h index 925cdb780a..110a9dbb69 100644 --- a/xfa/fwl/lightwidget/cfwl_theme.h +++ b/xfa/fwl/lightwidget/cfwl_theme.h @@ -36,7 +36,8 @@ class CFWL_Theme : public IFWL_ThemeProvider { const CFX_Matrix& matrix) override; FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; FX_BOOL DrawText(CFWL_ThemeText* pParams) override; - void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity) override; + void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity) override; FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) override; FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp index 0edc29b775..bdcd89e9dd 100644 --- a/xfa/fwl/theme/cfwl_barcodetp.cpp +++ b/xfa/fwl/theme/cfwl_barcodetp.cpp @@ -24,16 +24,16 @@ FX_BOOL CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; switch (pParams->m_iPart) { - case FWL_PART_BCD_Border: { + case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_BCD_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_BCD_Background: { + case CFWL_Part::Background: { FillBackground(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp index 0ebc519642..39ba20bad7 100644 --- a/xfa/fwl/theme/cfwl_carettp.cpp +++ b/xfa/fwl/theme/cfwl_carettp.cpp @@ -24,8 +24,8 @@ FX_BOOL CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; switch (pParams->m_iPart) { - case FWL_PART_CAT_Background: { - if (!(pParams->m_dwStates & FWL_PARTSTATE_CAT_HightLight)) { + case CFWL_Part::Background: { + if (!(pParams->m_dwStates & CFWL_PartState_HightLight)) { return TRUE; } DrawCaretBK(pParams->m_pGraphics, pParams->m_dwStates, @@ -33,6 +33,8 @@ FX_BOOL CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) { &(pParams->m_matrix)); break; } + default: + break; } return TRUE; } diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 39a19b7981..ccde660693 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -51,8 +51,7 @@ uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) return FALSE; - m_pTextOut->SetTextColor((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Disabled + m_pTextOut->SetTextColor(pParams->m_dwStates & CFWL_PartState_Disabled ? FWLTHEME_CAPACITY_TextDisColor : FWLTHEME_CAPACITY_TextColor); return CFWL_WidgetTP::DrawText(pParams); @@ -61,38 +60,35 @@ FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; switch (pParams->m_iPart) { - case FWL_PART_CKB_Border: { + case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_CKB_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_CKB_Background: { + case CFWL_Part::Background: { FillBackground(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - if (pParams->m_dwStates & FWL_PARTSTATE_CKB_Focused) { + if (pParams->m_dwStates & CFWL_PartState_Focused) { pParams->m_rtPart = *(CFX_RectF*)pParams->m_pData; DrawFocus(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); } break; } - case FWL_PART_CKB_CheckBox: { + case CFWL_Part::CheckBox: { DrawBoxBk(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, pParams->m_dwStates, &pParams->m_matrix); - if (((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Checked) | - ((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Neutral)) { + if ((pParams->m_dwStates & CFWL_PartState_Checked) | + (pParams->m_dwStates & CFWL_PartState_Neutral)) { DrawSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, pParams->m_dwStates, &pParams->m_matrix); } - FX_BOOL bDisable = (pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Disabled; - DrawSignBorder(pParams->m_pWidget, pParams->m_pGraphics, - &pParams->m_rtPart, bDisable, &pParams->m_matrix); + DrawSignBorder( + pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, + pParams->m_dwStates & CFWL_PartState_Disabled, &pParams->m_matrix); break; } default: { return FALSE; } @@ -120,8 +116,7 @@ void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget, path.Create(); FX_FLOAT fRight = pRect->right(); FX_FLOAT fBottom = pRect->bottom(); - FX_BOOL bClipSign = - (dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered; + FX_BOOL bClipSign = dwStates & CFWL_PartState_Hovered; if ((dwStyleEx == FWL_STYLEEXT_CKB_ShapeSolidSquare) || (dwStyleEx == FWL_STYLEEXT_CKB_ShapeSunkenSquare)) { path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); @@ -145,19 +140,16 @@ void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget, } } int32_t iTheme = 1; - if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered) { + if (dwStates & CFWL_PartState_Hovered) { iTheme = 2; - } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Pressed) { + } else if (dwStates & CFWL_PartState_Pressed) { iTheme = 3; - } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Disabled) { + } else if (dwStates & CFWL_PartState_Disabled) { iTheme = 4; } - if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Checked) { + if (dwStates & CFWL_PartState_Checked) { iTheme += 4; - } else if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Neutral) { + } else if (dwStates & CFWL_PartState_Neutral) { iTheme += 8; } DrawAxialShading(pGraphics, pRect->left - 1, pRect->top - 1, fRight, fBottom, @@ -173,30 +165,20 @@ void CFWL_CheckBoxTP::DrawSign(IFWL_Widget* pWidget, rtSign.Deflate(CHECKBOX_SIZE_SIGNMARGIN, CHECKBOX_SIZE_SIGNMARGIN); uint32_t dwColor = m_pThemeData->clrSignCheck; FX_BOOL bCheck = TRUE; - if (((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Disabled) && - ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Checked)) { + if ((dwStates & CFWL_PartState_Disabled) && + (dwStates & CFWL_PartState_Checked)) { dwColor = m_pThemeData->clrSignBorderDisable; - } else if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Neutral) { - switch (dwStates & FWL_PARTSTATE_CKB_Mask1) { - case FWL_PARTSTATE_CKB_Normal: { - bCheck = FALSE; - dwColor = m_pThemeData->clrSignNeutralNormal; - break; - } - case FWL_PARTSTATE_CKB_Hovered: { - bCheck = FALSE; - dwColor = m_pThemeData->clrSignNeutralHover; - break; - } - case FWL_PARTSTATE_CKB_Pressed: { - bCheck = FALSE, dwColor = m_pThemeData->clrSignNeutralPressed; - break; - } - case FWL_PARTSTATE_CKB_Disabled: { - bCheck = FALSE, dwColor = m_pThemeData->clrSignBorderDisable; - break; - } + } else if (dwStates & CFWL_PartState_Neutral) { + if (dwStates & CFWL_PartState_Normal) { + bCheck = FALSE; + dwColor = m_pThemeData->clrSignNeutralNormal; + } else if (dwStates & CFWL_PartState_Hovered) { + bCheck = FALSE; + dwColor = m_pThemeData->clrSignNeutralHover; + } else if (dwStates & CFWL_PartState_Pressed) { + bCheck = FALSE, dwColor = m_pThemeData->clrSignNeutralPressed; + } else if (dwStates & CFWL_PartState_Disabled) { + bCheck = FALSE, dwColor = m_pThemeData->clrSignBorderDisable; } } if (bCheck) { diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp index b9dd7a0300..131e6388f7 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.cpp +++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp @@ -28,26 +28,26 @@ FX_BOOL CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; switch (pParams->m_iPart) { - case FWL_PART_CMB_Border: { + case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_CMB_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_CMB_Background: { + case CFWL_Part::Background: { CFX_Path path; path.Create(); CFX_RectF& rect = pParams->m_rtPart; path.AddRectangle(rect.left, rect.top, rect.width, rect.height); CFX_Color cr; switch (pParams->m_dwStates) { - case FWL_PARTSTATE_CMB_Selected: + case CFWL_PartState_Selected: cr = FWLTHEME_COLOR_BKSelected; break; - case FWL_PARTSTATE_CMB_Disabled: + case CFWL_PartState_Disabled: cr = FWLTHEME_COLOR_EDGERB1; break; default: @@ -59,11 +59,11 @@ FX_BOOL CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { pParams->m_pGraphics->RestoreGraphState(); break; } - case FWL_PART_CMB_DropDownButton: { + case CFWL_Part::DropDownButton: { DrawDropDownButton(pParams, pParams->m_dwStates, &pParams->m_matrix); break; } - case FWL_PART_CMB_StretcgHandler: { + case CFWL_Part::StretchHandler: { DrawStrethHandler(pParams, 0, &pParams->m_matrix); break; } @@ -83,8 +83,8 @@ void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); } void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart, - uint32_t dwCapacity) { - if (dwCapacity == FWL_WGTCAPACITY_CMB_ComboFormHandler) { + CFWL_WidgetCapacity dwCapacity) { + if (dwCapacity == CFWL_WidgetCapacity::ComboFormHandler) { m_fValue = FWLTHEME_CAPACITY_ComboFormHandler; return &m_fValue; } @@ -96,19 +96,19 @@ void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; switch (dwStates) { - case FWL_PARTSTATE_CMB_Normal: { + case CFWL_PartState_Normal: { eState = FWLTHEME_STATE_Normal; break; } - case FWL_PARTSTATE_CMB_Hovered: { + case CFWL_PartState_Hovered: { eState = FWLTHEME_STATE_Hover; break; } - case FWL_PARTSTATE_CMB_Pressed: { + case CFWL_PartState_Pressed: { eState = FWLTHEME_STATE_Pressed; break; } - case FWL_PARTSTATE_CMB_Disabled: { + case CFWL_PartState_Disabled: { eState = FWLTHEME_STATE_Disabale; break; } diff --git a/xfa/fwl/theme/cfwl_comboboxtp.h b/xfa/fwl/theme/cfwl_comboboxtp.h index fd65fa5fab..42ed55ac47 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.h +++ b/xfa/fwl/theme/cfwl_comboboxtp.h @@ -15,7 +15,8 @@ class CFWL_ComboBoxTP : public CFWL_WidgetTP { virtual ~CFWL_ComboBoxTP(); virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity); + virtual void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity); protected: void DrawDropDownButton(CFWL_ThemeBackground* pParams, diff --git a/xfa/fwl/theme/cfwl_datetimepickedtp.cpp b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp index 899180faa0..54ddcdeb9e 100644 --- a/xfa/fwl/theme/cfwl_datetimepickedtp.cpp +++ b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp @@ -25,16 +25,16 @@ FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; switch (pParams->m_iPart) { - case FWL_PART_DTP_Border: { + case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_DTP_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_DTP_DropDownButton: { + case CFWL_Part::DropDownButton: { DrawDropDownButton(pParams, &pParams->m_matrix); break; } @@ -49,19 +49,19 @@ void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, dwStates &= 0x03; FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; switch (eState & dwStates) { - case FWL_PARTSTATE_DTP_Normal: { + case CFWL_PartState_Normal: { eState = FWLTHEME_STATE_Normal; break; } - case FWL_PARTSTATE_DTP_Hovered: { + case CFWL_PartState_Hovered: { eState = FWLTHEME_STATE_Hover; break; } - case FWL_PARTSTATE_DTP_Pressed: { + case CFWL_PartState_Pressed: { eState = FWLTHEME_STATE_Pressed; break; } - case FWL_PARTSTATE_DTP_Disabled: { + case CFWL_PartState_Disabled: { eState = FWLTHEME_STATE_Disabale; break; } diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index 92f32dcaa9..8f060ee6bf 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp @@ -22,16 +22,16 @@ FX_BOOL CFWL_EditTP::IsValidWidget(IFWL_Widget* pWidget) { } FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { switch (pParams->m_iPart) { - case FWL_PART_EDT_Border: { + case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_EDT_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_EDT_Background: { + case CFWL_Part::Background: { if (pParams->m_pPath) { CFX_Graphics* pGraphics = pParams->m_pGraphics; pGraphics->SaveGraphState(); @@ -51,15 +51,12 @@ FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { pParams->m_rtPart.width, pParams->m_rtPart.height); CFX_Color cr(FWLTHEME_COLOR_Background); if (!bStatic) { - if ((pParams->m_dwStates & FWL_PARTSTATE_EDT_Disable) == - FWL_PARTSTATE_EDT_Disable) { + if (pParams->m_dwStates & CFWL_PartState_Disabled) cr.Set(FWLTHEME_COLOR_EDGERB1); - } else if ((pParams->m_dwStates & FWL_PARTSTATE_EDT_ReadOnly) == - FWL_PARTSTATE_EDT_ReadOnly) { + else if (pParams->m_dwStates & CFWL_PartState_ReadOnly) cr.Set(ArgbEncode(255, 236, 233, 216)); - } else { + else cr.Set(0xFFFFFFFF); - } } pParams->m_pGraphics->SaveGraphState(); pParams->m_pGraphics->SetFillColor(&cr); @@ -69,7 +66,7 @@ FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { } break; } - case FWL_PART_EDT_CombTextLine: { + case CFWL_Part::CombTextLine: { FX_ARGB cr = 0xFF000000; FX_FLOAT fWidth = 1.0f; CFX_Color crLine(cr); diff --git a/xfa/fwl/theme/cfwl_formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp index e7cc1221d0..ec06f4ad24 100644 --- a/xfa/fwl/theme/cfwl_formtp.cpp +++ b/xfa/fwl/theme/cfwl_formtp.cpp @@ -79,67 +79,67 @@ FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; int32_t iActive = 0; - if (pParams->m_dwStates & FWL_PARTSTATE_FRM_Inactive) { + if (pParams->m_dwStates & CFWL_PartState_Inactive) { iActive = 1; } FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; switch (pParams->m_dwStates & 0x03) { - case FWL_PARTSTATE_FRM_Hover: { + case CFWL_PartState_Hovered: { eState = FWLTHEME_STATE_Hover; break; } - case FWL_PARTSTATE_FRM_Pressed: { + case CFWL_PartState_Pressed: { eState = FWLTHEME_STATE_Pressed; break; } - case FWL_PARTSTATE_FRM_Disabled: { + case CFWL_PartState_Disabled: { eState = FWLTHEME_STATE_Disabale; break; } default: {} } switch (pParams->m_iPart) { - case FWL_PART_FRM_Border: { + case CFWL_Part::Border: { DrawFormBorder(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } - case FWL_PART_FRM_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_FRM_Background: { + case CFWL_Part::Background: { FillBackground(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_FRM_Caption: { + case CFWL_Part::Caption: { DrawCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } - case FWL_PART_FRM_NarrowCaption: { + case CFWL_Part::NarrowCaption: { DrawNarrowCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } - case FWL_PART_FRM_CloseBox: { + case CFWL_Part::CloseBox: { DrawCloseBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } - case FWL_PART_FRM_MinimizeBox: { + case CFWL_Part::MinimizeBox: { DrawMinimizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } - case FWL_PART_FRM_MaximizeBox: { + case CFWL_Part::MaximizeBox: { DrawMaximizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, pParams->m_dwData, &pParams->m_matrix, iActive); break; } - case FWL_PART_FRM_Icon: { + case CFWL_Part::Icon: { DrawIconImage(pParams->m_pGraphics, pParams->m_pImage, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; @@ -151,7 +151,7 @@ FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) { FX_BOOL CFWL_FormTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) return FALSE; - if (pParams->m_iPart == FWL_PART_FRM_Caption) { + if (pParams->m_iPart == CFWL_Part::Caption) { m_pTextOut->SetTextColor(0xFFFFFFFF); } else { m_pTextOut->SetTextColor(0xFF000000); @@ -159,36 +159,36 @@ FX_BOOL CFWL_FormTP::DrawText(CFWL_ThemeText* pParams) { return CFWL_WidgetTP::DrawText(pParams); } void* CFWL_FormTP::GetCapacity(CFWL_ThemePart* pThemePart, - uint32_t dwCapacity) { + CFWL_WidgetCapacity dwCapacity) { FX_BOOL bDefPro = FALSE; FX_BOOL bDwordVal = FALSE; switch (dwCapacity) { - case FWL_WGTCAPACITY_CXBorder: { + case CFWL_WidgetCapacity::CXBorder: { m_fValue = FWLTHEME_CAPACITY_CXFormBorder; break; } - case FWL_WGTCAPACITY_CYBorder: { + case CFWL_WidgetCapacity::CYBorder: { m_fValue = FWLTHEME_CAPACITY_CYFormBorder; break; } - case FWL_WGTCAPACITY_FRM_CYCaption: { + case CFWL_WidgetCapacity::CYCaption: { m_fValue = FWLTHEME_CAPACITY_CYCaption; break; } - case FWL_WGTCAPACITY_FRM_CYNarrowCaption: { + case CFWL_WidgetCapacity::CYNarrowCaption: { m_fValue = FWLTHEME_CAPACITY_CYCaption; break; } - case FWL_WGTCAPACITY_TextColor: { + case CFWL_WidgetCapacity::TextColor: { bDwordVal = TRUE; m_dwValue = FWLTHEME_CAPACITY_FormTextColor; break; } - case FWL_WGTCAPACITY_FRM_BigIcon: { + case CFWL_WidgetCapacity::BigIcon: { m_fValue = FWLTHEME_CAPACITY_BigIconSize; break; } - case FWL_WGTCAPACITY_FRM_SmallIcon: { + case CFWL_WidgetCapacity::SmallIcon: { m_fValue = FWLTHEME_CAPACITY_SmallIconSize; break; } @@ -205,23 +205,23 @@ void* CFWL_FormTP::GetCapacity(CFWL_ThemePart* pThemePart, FWL_ERR CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) { switch (pThemePart->m_iPart) { - case FWL_PART_FRM_CloseBox: { + case CFWL_Part::CloseBox: { CalCloseBox(pThemePart->m_pWidget, rtPart); break; } - case FWL_PART_FRM_MaximizeBox: { + case CFWL_Part::MaximizeBox: { CalMaxBox(pThemePart->m_pWidget, rtPart); break; } - case FWL_PART_FRM_MinimizeBox: { + case CFWL_Part::MinimizeBox: { CalMinBox(pThemePart->m_pWidget, rtPart); break; } - case FWL_PART_FRM_HeadText: { + case CFWL_Part::HeadText: { CalCaption(pThemePart->m_pWidget, rtPart); break; } - case FWL_PART_FRM_Icon: { + case CFWL_Part::Icon: { CalIcon(pThemePart->m_pWidget, rtPart); break; } diff --git a/xfa/fwl/theme/cfwl_formtp.h b/xfa/fwl/theme/cfwl_formtp.h index 838f19858a..24eaed8f85 100644 --- a/xfa/fwl/theme/cfwl_formtp.h +++ b/xfa/fwl/theme/cfwl_formtp.h @@ -13,18 +13,19 @@ class CFWL_FormTP : public CFWL_WidgetTP { public: CFWL_FormTP(); - virtual ~CFWL_FormTP(); + ~CFWL_FormTP() override; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FX_BOOL DrawText(CFWL_ThemeText* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity); - virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart); + FWL_ERR Initialize() override; + FWL_ERR Finalize() override; + FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, + uint32_t dwThemeID, + FX_BOOL bChildren = TRUE) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + FX_BOOL DrawText(CFWL_ThemeText* pParams) override; + void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity) override; + FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; protected: void CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect); diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index 210949aa41..f1a017ab70 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp @@ -24,16 +24,16 @@ FX_BOOL CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; switch (pParams->m_iPart) { - case FWL_PART_LTB_Border: { + case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_LTB_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_LTB_Background: { + case CFWL_Part::Background: { FillSoildRect(pParams->m_pGraphics, ArgbEncode(255, 255, 255, 255), &pParams->m_rtPart, &pParams->m_matrix); if (pParams->m_pData) { @@ -42,21 +42,21 @@ FX_BOOL CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { } break; } - case FWL_PART_LTB_ListItem: { + case CFWL_Part::ListItem: { DrawListBoxItem(pParams->m_pGraphics, pParams->m_dwStates, &pParams->m_rtPart, pParams->m_pData, &pParams->m_matrix); break; } - case FWL_PART_LTB_Icon: { + case CFWL_Part::Icon: { pParams->m_pGraphics->StretchImage(pParams->m_pImage, pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_LTB_Check: { + case CFWL_Part::Check: { uint32_t color = 0xFF000000; - if (pParams->m_dwStates == FWL_PARTSTATE_LTB_Checked) { + if (pParams->m_dwStates == CFWL_PartState_Checked) { color = 0xFFFF0000; - } else if (pParams->m_dwStates == FWL_PARTSTATE_LTB_UnChecked) { + } else if (pParams->m_dwStates == CFWL_PartState_Normal) { color = 0xFF0000FF; } FillSoildRect(pParams->m_pGraphics, color, &pParams->m_rtPart, @@ -79,7 +79,7 @@ void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics, const CFX_RectF* prtItem, void* pData, CFX_Matrix* pMatrix) { - if (dwStates & FWL_PARTSTATE_LTB_Selected) { + if (dwStates & CFWL_PartState_Selected) { pGraphics->SaveGraphState(); CFX_Color crFill(FWL_GetThemeColor(m_dwThemeID) == 0 ? FWLTHEME_COLOR_BKSelected @@ -96,7 +96,7 @@ void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics, pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pGraphics->RestoreGraphState(); } - if (dwStates & FWL_PARTSTATE_LTB_Focused) { + if (dwStates & CFWL_PartState_Focused) { if (pData) { DrawFocus(pGraphics, (CFX_RectF*)pData, pMatrix); } diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index 154a6bdcea..169905824f 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -83,52 +83,52 @@ FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; switch (pParams->m_iPart) { - case FWL_PART_MCD_Border: { + case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_MCD_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_MCD_Background: { + case CFWL_Part::Background: { DrawTotalBK(pParams, &pParams->m_matrix); break; } - case FWL_PART_MCD_Header: { + case CFWL_Part::Header: { DrawHeadBk(pParams, &pParams->m_matrix); break; } - case FWL_PART_MCD_LBtn: { + case CFWL_Part::LBtn: { FWLTHEME_STATE eState = GetState(pParams->m_dwStates); DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Left, eState, &pParams->m_matrix); break; } - case FWL_PART_MCD_RBtn: { + case CFWL_Part::RBtn: { FWLTHEME_STATE eState = GetState(pParams->m_dwStates); DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Right, eState, &pParams->m_matrix); break; } - case FWL_PART_MCD_HSeparator: { + case CFWL_Part::HSeparator: { DrawHSeperator(pParams, &pParams->m_matrix); break; } - case FWL_PART_MCD_DatesIn: { + case CFWL_Part::DatesIn: { DrawDatesInBK(pParams, &pParams->m_matrix); break; } - case FWL_PART_MCD_TodayCircle: { + case CFWL_Part::TodayCircle: { DrawTodayCircle(pParams, &pParams->m_matrix); break; } - case FWL_PART_MCD_DateInCircle: { + case CFWL_Part::DateInCircle: { DrawDatesInCircle(pParams, &pParams->m_matrix); break; } - case FWL_PART_MCD_WeekNumSep: { + case CFWL_Part::WeekNumSep: { DrawWeekNumSep(pParams, &pParams->m_matrix); break; } @@ -139,12 +139,12 @@ FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { FX_BOOL CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) return FALSE; - if ((pParams->m_iPart == FWL_PART_MCD_DatesIn) && + if ((pParams->m_iPart == CFWL_Part::DatesIn) && !(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) && (pParams->m_dwStates & - (FWL_PARTSTATE_MCD_Hovered | FWL_PARTSTATE_MCD_Selected))) { + (CFWL_PartState_Hovered | CFWL_PartState_Selected))) { m_pTextOut->SetTextColor(0xFFFFFFFF); - } else if (pParams->m_iPart == FWL_PART_MCD_Caption) { + } else if (pParams->m_iPart == CFWL_Part::Caption) { m_pTextOut->SetTextColor(m_pThemeData->clrCaption); } else { m_pTextOut->SetTextColor(0xFF000000); @@ -152,200 +152,200 @@ FX_BOOL CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) { return CFWL_WidgetTP::DrawText(pParams); } void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart, - uint32_t dwCapacity) { + CFWL_WidgetCapacity dwCapacity) { FX_BOOL bDefPro = FALSE; FX_BOOL bDwordVal = FALSE; switch (dwCapacity) { - case FWL_WGTCAPACITY_MC_HEADER_WIDTH: { + case CFWL_WidgetCapacity::HeaderWidth: { m_fValue = FWL_THEMECAPACITY_MC_HEADER_WIDTH; break; } - case FWL_WGTCAPACITY_MC_HEADER_Height: { + case CFWL_WidgetCapacity::HeaderHeight: { m_fValue = FWL_THEMECAPACITY_MC_HEADER_HEIGHT; break; } - case FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH: { + case CFWL_WidgetCapacity::HeaderBtnWidth: { m_fValue = FWL_THEMECAPACITY_MC_HEADER_BTN_WIDTH; break; } - case FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT: { + case CFWL_WidgetCapacity::HeaderBtnHeight: { m_fValue = FWL_THEMECAPACITY_MC_HEADER_BTN_HEIGHT; break; } - case FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN: { + case CFWL_WidgetCapacity::HeaderBtnHMargin: { bDwordVal = TRUE; m_dwValue = FWL_THEMECAPACITY_MC_HEADER_BTN_HMARGIN; break; } - case FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN: { + case CFWL_WidgetCapacity::HeaderBtnVMargin: { m_fValue = FWL_THEMECAPACITY_MC_HEADER_BTN_VMARGIN; break; } - case FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT: { + case CFWL_WidgetCapacity::HeaderTextWidth: { m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXTWIDHT; break; } - case FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT: { + case CFWL_WidgetCapacity::HeaderTextHeight: { m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXTHEIGHT; break; } - case FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN: { + case CFWL_WidgetCapacity::HeaderTextHMargin: { m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXT_HMARGIN; break; } - case FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN: { + case CFWL_WidgetCapacity::HeaderTextVMargin: { m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXT_VMARGIN; break; } - case FWL_WGTCAPACITY_MC_HSEP_WIDTH: { + case CFWL_WidgetCapacity::HSepWidth: { m_fValue = FWL_THEMECAPACITY_MC_HSEP_WIDTH; break; } - case FWL_WGTCAPACITY_MC_HSEP_HEIGHT: { + case CFWL_WidgetCapacity::HSepHeight: { m_fValue = FWL_THEMECAPACITY_MC_HSEP_HEIGHT; break; } - case FWL_WGTCAPACITY_MC_VSEP_WIDTH: { + case CFWL_WidgetCapacity::VSepWidth: { m_fValue = FWL_THEMECAPACITY_MC_VSEP_WIDTH; break; } - case FWL_WGTCAPACITY_MC_VSEP_HEIGHT: { + case CFWL_WidgetCapacity::VSepHeight: { m_fValue = FWL_THEMECAPACITY_MC_VSEP_HEIGHT; break; } - case FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH: { + case CFWL_WidgetCapacity::WeekNumWidth: { m_fValue = FWL_THEMECAPACITY_MC_WEEKNUM_WIDTH; break; } - case FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT: { + case CFWL_WidgetCapacity::WeekNumHeight: { m_fValue = FWL_THEMECAPACITY_MC_WEEKNUM_HEIGHT; break; } - case FWL_WGTCAPACITY_MC_WEEK_WIDTH: { + case CFWL_WidgetCapacity::WeekWidth: { m_fValue = FWL_THEMECAPACITY_MC_WEEK_WIDTH; break; } - case FWL_WGTCAPACITY_MC_WEEK_HEIGHT: { + case CFWL_WidgetCapacity::WeekHeight: { m_fValue = FWL_THEMECAPACITY_MC_WEEK_HEIGHT; break; } - case FWL_WGTCAPACITY_MC_SEP_DOFFSET: { + case CFWL_WidgetCapacity::SepDOffset: { m_fValue = FWL_THEMECAPACITY_MC_SEP_DOFFSET; break; } - case FWL_WGTCAPACITY_MC_SEP_X: { + case CFWL_WidgetCapacity::SepX: { m_fValue = FWL_THEMECAPACITY_MC_SEP_X; break; } - case FWL_WGTCAPACITY_MC_SEP_Y: { + case CFWL_WidgetCapacity::SepY: { m_fValue = FWL_THEMECAPACITY_MC_SEP_Y; break; } - case FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH: { + case CFWL_WidgetCapacity::DatesCellWidth: { m_fValue = FWL_THEMECAPACITY_MC_DATES_CELL_WIDTH; break; } - case FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT: { + case CFWL_WidgetCapacity::DatesCellHeight: { m_fValue = FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT; break; } - case FWL_WGTCAPACITY_MC_TODAY_WIDHT: { + case CFWL_WidgetCapacity::TodayWidth: { m_fValue = FWL_THEMECAPACITY_MC_TODAY_WIDHT; break; } - case FWL_WGTCAPACITY_MC_TODAY_HEIGHT: { + case CFWL_WidgetCapacity::TodayHeight: { m_fValue = FWL_THEMECAPACITY_MC_TODAY_HEIGHT; break; } - case FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT: { + case CFWL_WidgetCapacity::TodayFlagWidth: { m_fValue = FWL_THEMECAPACITY_MC_TODAY_FLAG_WIDHT; break; } - case FWL_WGTCAPACITY_MC_WIDTH: { + case CFWL_WidgetCapacity::Width: { m_fValue = FWL_MC_WIDTH; break; } - case FWL_WGTCAPACITY_MC_HEIGHT: { + case CFWL_WidgetCapacity::Height: { m_fValue = FWL_MC_HEIGHT; break; } - case FWL_MCCAPACITY_Sun: { + case CFWL_WidgetCapacity::Sun: { wsResource = L"Sun"; return &wsResource; } - case FWL_MCCAPACITY_Mon: { + case CFWL_WidgetCapacity::Mon: { wsResource = L"Mon"; return &wsResource; } - case FWL_MCCAPACITY_Tue: { + case CFWL_WidgetCapacity::Tue: { wsResource = L"Tue"; return &wsResource; } - case FWL_MCCAPACITY_Wed: { + case CFWL_WidgetCapacity::Wed: { wsResource = L"Wed"; return &wsResource; } - case FWL_MCCAPACITY_Thu: { + case CFWL_WidgetCapacity::Thu: { wsResource = L"Thu"; return &wsResource; } - case FWL_MCCAPACITY_Fri: { + case CFWL_WidgetCapacity::Fri: { wsResource = L"Fri"; return &wsResource; } - case FWL_MCCAPACITY_Sat: { + case CFWL_WidgetCapacity::Sat: { wsResource = L"Sat"; return &wsResource; } - case FWL_MCCAPACITY_January: { + case CFWL_WidgetCapacity::January: { wsResource = L"January"; return &wsResource; } - case FWL_MCCAPACITY_February: { + case CFWL_WidgetCapacity::February: { wsResource = L"February"; return &wsResource; } - case FWL_MCCAPACITY_March: { + case CFWL_WidgetCapacity::March: { wsResource = L"March"; return &wsResource; } - case FWL_MCCAPACITY_April: { + case CFWL_WidgetCapacity::April: { wsResource = L"April"; return &wsResource; } - case FWL_MCCAPACITY_May: { + case CFWL_WidgetCapacity::May: { wsResource = L"May"; return &wsResource; } - case FWL_MCCAPACITY_June: { + case CFWL_WidgetCapacity::June: { wsResource = L"June"; return &wsResource; } - case FWL_MCCAPACITY_July: { + case CFWL_WidgetCapacity::July: { wsResource = L"July"; return &wsResource; } - case FWL_MCCAPACITY_August: { + case CFWL_WidgetCapacity::August: { wsResource = L"August"; return &wsResource; } - case FWL_MCCAPACITY_September: { + case CFWL_WidgetCapacity::September: { wsResource = L"September"; return &wsResource; } - case FWL_MCCAPACITY_October: { + case CFWL_WidgetCapacity::October: { wsResource = L"October"; return &wsResource; } - case FWL_MCCAPACITY_November: { + case CFWL_WidgetCapacity::November: { wsResource = L"November"; return &wsResource; } - case FWL_MCCAPACITY_December: { + case CFWL_WidgetCapacity::December: { wsResource = L"December"; return &wsResource; } - case FWL_MCCAPACITY_Today: { + case CFWL_WidgetCapacity::Today: { wsResource = L"Today"; return &wsResource; } @@ -404,8 +404,7 @@ FX_BOOL CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, CFX_Color clrLBtnEdge(ArgbEncode(0xff, 205, 219, 243)); pParams->m_pGraphics->SetStrokeColor(&clrLBtnEdge); pParams->m_pGraphics->StrokePath(&path, pMatrix); - if ((pParams->m_dwStates & FWL_PARTSTATE_MCD_Pressed) == - FWL_PARTSTATE_MCD_Pressed) { + if (pParams->m_dwStates & CFWL_PartState_Pressed) { CFX_Color clrLBtnFill(ArgbEncode(0xff, 174, 198, 242)); pParams->m_pGraphics->SetFillColor(&clrLBtnFill); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); @@ -437,8 +436,7 @@ FX_BOOL CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, CFX_Color clrRBtnEdge(ArgbEncode(0xff, 205, 219, 243)); pParams->m_pGraphics->SetStrokeColor(&clrRBtnEdge); pParams->m_pGraphics->StrokePath(&path, pMatrix); - if ((pParams->m_dwStates & FWL_PARTSTATE_MCD_Pressed) == - FWL_PARTSTATE_MCD_Pressed) { + if (pParams->m_dwStates & CFWL_PartState_Pressed) { CFX_Color clrRBtnFill(ArgbEncode(0xff, 174, 198, 242)); pParams->m_pGraphics->SetFillColor(&clrRBtnFill); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); @@ -492,7 +490,7 @@ FX_BOOL CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams, FX_BOOL CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { pParams->m_pGraphics->SaveGraphState(); - if (pParams->m_dwStates & FWL_PARTSTATE_MCD_Selected) { + if (pParams->m_dwStates & CFWL_PartState_Selected) { CFX_Path path; path.Create(); CFX_RectF rtSelDay; @@ -503,7 +501,7 @@ FX_BOOL CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, clrSelDayBK = m_pThemeData->clrDatesSelectedBK; pParams->m_pGraphics->SetFillColor(&clrSelDayBK); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - } else if (pParams->m_dwStates & FWL_PARTSTATE_MCD_Hovered) { + } else if (pParams->m_dwStates & CFWL_PartState_Hovered) { CFX_Path path; path.Create(); CFX_RectF rtSelDay; @@ -550,14 +548,15 @@ FX_BOOL CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->RestoreGraphState(); return TRUE; } + FWLTHEME_STATE CFWL_MonthCalendarTP::GetState(uint32_t dwFWLStates) { - if (dwFWLStates & FWL_PARTSTATE_MCD_Hovered) { + if (dwFWLStates & CFWL_PartState_Hovered) return FWLTHEME_STATE_Hover; - } else if (dwFWLStates & FWL_PARTSTATE_MCD_Pressed) { + if (dwFWLStates & CFWL_PartState_Pressed) return FWLTHEME_STATE_Pressed; - } return FWLTHEME_STATE_Normal; } + void CFWL_MonthCalendarTP::SetThemeData(uint32_t dwThemeID) { if (dwThemeID == 0) { m_pThemeData->clrCaption = ArgbEncode(0xff, 0, 153, 255); diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h index 3624ee1bfd..08e65ca848 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.h +++ b/xfa/fwl/theme/cfwl_monthcalendartp.h @@ -12,16 +12,18 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP { public: CFWL_MonthCalendarTP(); - virtual ~CFWL_MonthCalendarTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FX_BOOL DrawText(CFWL_ThemeText* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + ~CFWL_MonthCalendarTP() override; + + FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, + uint32_t dwThemeID, + FX_BOOL bChildren = TRUE) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + FX_BOOL DrawText(CFWL_ThemeText* pParams) override; + void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity) override; + FWL_ERR Initialize() override; + FWL_ERR Finalize() override; protected: FX_BOOL DrawTotalBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp index ee83a7eb3f..69ac094be0 100644 --- a/xfa/fwl/theme/cfwl_pictureboxtp.cpp +++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp @@ -23,11 +23,11 @@ FX_BOOL CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; switch (pParams->m_iPart) { - case FWL_PART_PTB_Border: { + case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_PTB_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index 5889f30927..5662ac09c2 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -35,16 +35,16 @@ uint32_t CFWL_PushButtonTP::SetThemeID(IFWL_Widget* pWidget, } FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { switch (pParams->m_iPart) { - case FWL_PART_PSB_Border: { + case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_PSB_Edge: { + case CFWL_Part::Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } - case FWL_PART_PSB_Background: { + case CFWL_Part::Background: { CFX_RectF& rect = pParams->m_rtPart; FX_FLOAT fRight = rect.right(); FX_FLOAT fBottom = rect.bottom(); @@ -84,7 +84,7 @@ FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { CFX_Color crFill(m_pThemeData->clrFill[iColor]); pGraphics->SetFillColor(&crFill); pGraphics->FillPath(&fillPath, FXFILL_WINDING, &pParams->m_matrix); - if (pParams->m_dwStates & FWL_PARTSTATE_PSB_Focused) { + if (pParams->m_dwStates & CFWL_PartState_Focused) { rtInner.Inflate(1, 1, 0, 0); DrawFocus(pGraphics, &rtInner, &pParams->m_matrix); } @@ -96,8 +96,8 @@ FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { return TRUE; } void* CFWL_PushButtonTP::GetCapacity(CFWL_ThemePart* pThemePart, - uint32_t dwCapacity) { - if (dwCapacity == FWL_WGTCAPACITY_PSB_Margin) { + CFWL_WidgetCapacity dwCapacity) { + if (dwCapacity == CFWL_WidgetCapacity::Margin) { m_fValue = 0; return &m_fValue; } @@ -157,5 +157,16 @@ void CFWL_PushButtonTP::SetThemeData(uint32_t dwID) { } } int32_t CFWL_PushButtonTP::GetColorID(uint32_t dwStates) { - return dwStates &= FWL_PARTSTATE_PSB_Mask; + int32_t color = 0; + if (dwStates & CFWL_PartState_Disabled) + color += 4; + if (dwStates & CFWL_PartState_Default) { + color += 3; + } else { + if (dwStates & CFWL_PartState_Hovered) + color += 2; + if (dwStates & CFWL_PartState_Pressed) + color += 1; + } + return color; } diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h index b72ac86126..6329f90207 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.h +++ b/xfa/fwl/theme/cfwl_pushbuttontp.h @@ -12,15 +12,17 @@ class CFWL_PushButtonTP : public CFWL_WidgetTP { public: CFWL_PushButtonTP(); - virtual ~CFWL_PushButtonTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + ~CFWL_PushButtonTP() override; + + FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, + uint32_t dwThemeID, + FX_BOOL bChildren = TRUE) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity) override; + FWL_ERR Initialize() override; + FWL_ERR Finalize() override; protected: struct PBThemeData { diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index 5db0559195..11326edf59 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -31,8 +31,8 @@ FX_BOOL CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget->GetClassID() == FWL_CLASSHASH_ScrollBar; } void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart, - uint32_t dwCapacity) { - if (dwCapacity == FWL_CAPACITY_SCB_Size) { + CFWL_WidgetCapacity dwCapacity) { + if (dwCapacity == CFWL_WidgetCapacity::Size) { m_fValue = 5; return &m_fValue; } @@ -52,15 +52,15 @@ FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { IFWL_Widget* pWidget = pParams->m_pWidget; FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; switch (pParams->m_dwStates & 0x03) { - case FWL_PARTSTATE_SCB_Hovered: { + case CFWL_PartState_Hovered: { eState = FWLTHEME_STATE_Hover; break; } - case FWL_PARTSTATE_SCB_Pressed: { + case CFWL_PartState_Pressed: { eState = FWLTHEME_STATE_Pressed; break; } - case FWL_PARTSTATE_SCB_Disabled: { + case CFWL_PartState_Disabled: { eState = FWLTHEME_STATE_Disabale; break; } @@ -69,27 +69,27 @@ FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { CFX_RectF* pRect = &pParams->m_rtPart; FX_BOOL bVert = pWidget->GetStylesEx(); switch (pParams->m_iPart) { - case FWL_PART_SCB_ForeArrow: { + case CFWL_Part::ForeArrow: { DrawMaxMinBtn(pGraphics, pRect, bVert ? FWLTHEME_DIRECTION_Up : FWLTHEME_DIRECTION_Left, eState, &pParams->m_matrix); break; } - case FWL_PART_SCB_BackArrow: { + case CFWL_Part::BackArrow: { DrawMaxMinBtn(pGraphics, pRect, bVert ? FWLTHEME_DIRECTION_Down : FWLTHEME_DIRECTION_Right, eState, &pParams->m_matrix); break; } - case FWL_PART_SCB_Thumb: { + case CFWL_Part::Thumb: { DrawThumbBtn(pGraphics, pRect, bVert, eState, TRUE, &pParams->m_matrix); break; } - case FWL_PART_SCB_LowerTrack: { + case CFWL_Part::LowerTrack: { DrawTrack(pGraphics, pRect, bVert, eState, TRUE, &pParams->m_matrix); break; } - case FWL_PART_SCB_UpperTrack: { + case CFWL_Part::UpperTrack: { DrawTrack(pGraphics, pRect, bVert, eState, FALSE, &pParams->m_matrix); break; } diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h index 0530393043..b102ee4525 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.h +++ b/xfa/fwl/theme/cfwl_scrollbartp.h @@ -18,7 +18,8 @@ class CFWL_ScrollBarTP : public CFWL_WidgetTP { uint32_t dwThemeID, FX_BOOL bChildren = TRUE); virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity); + virtual void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity); protected: struct SBThemeData { diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index d60069b85e..1ce5d46caf 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -81,53 +81,53 @@ FX_BOOL CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { return TRUE; } void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, - uint32_t dwCapacity) { + CFWL_WidgetCapacity dwCapacity) { switch (dwCapacity) { - case FWL_WGTCAPACITY_CXBorder: { + case CFWL_WidgetCapacity::CXBorder: { m_fValue = FWLTHEME_CAPACITY_CXBorder; break; } - case FWL_WGTCAPACITY_CYBorder: { + case CFWL_WidgetCapacity::CYBorder: { m_fValue = FWLTHEME_CAPACITY_CYBorder; break; } - case FWL_WGTCAPACITY_EdgeFlat: { + case CFWL_WidgetCapacity::EdgeFlat: { m_fValue = FWLTHEME_CAPACITY_EdgeFlat; break; } - case FWL_WGTCAPACITY_EdgeRaised: { + case CFWL_WidgetCapacity::EdgeRaised: { m_fValue = FWLTHEME_CAPACITY_EdgeRaised; break; } - case FWL_WGTCAPACITY_EdgeSunken: { + case CFWL_WidgetCapacity::EdgeSunken: { m_fValue = FWLTHEME_CAPACITY_EdgeSunken; break; } - case FWL_WGTCAPACITY_FontSize: { + case CFWL_WidgetCapacity::FontSize: { m_fValue = FWLTHEME_CAPACITY_FontSize; break; } - case FWL_WGTCAPACITY_TextColor: { + case CFWL_WidgetCapacity::TextColor: { m_dwValue = FWLTHEME_CAPACITY_TextColor; return &m_dwValue; } - case FWL_WGTCAPACITY_ScrollBarWidth: { + case CFWL_WidgetCapacity::ScrollBarWidth: { m_fValue = FWLTHEME_CAPACITY_ScrollBarWidth; break; } - case FWL_WGTCAPACITY_Font: { + case CFWL_WidgetCapacity::Font: { return m_pFDEFont; } - case FWL_WGTCAPACITY_TextSelColor: { + case CFWL_WidgetCapacity::TextSelColor: { m_dwValue = (m_dwThemeID == 0) ? FWLTHEME_CAPACITY_TextSelColor : FWLTHEME_COLOR_Green_BKSelected; return &m_dwValue; } - case FWL_WGTCAPACITY_LineHeight: { + case CFWL_WidgetCapacity::LineHeight: { m_fValue = FWLTHEME_CAPACITY_LineHeight; break; } - case FWL_WGTCAPACITY_UIMargin: { + case CFWL_WidgetCapacity::UIMargin: { m_rtMargin.Set(0, 0, 0, 0); return &m_rtMargin; } diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index 771278ef31..bbb3fd7ee6 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -16,6 +16,81 @@ #include "xfa/fxgraphics/include/cfx_graphics.h" #include "xfa/fwl/theme/cfwl_utils.h" +enum class CFWL_WidgetCapacity { + None = 0, + + Today, + Mon, + Tue, + Wed, + Thu, + Fri, + Sat, + Sun, + + January, + February, + March, + April, + May, + June, + July, + August, + September, + October, + November, + December, + + BigIcon, + ComboFormHandler, + CXBorder, + CYBorder, + CYCaption, + CYNarrowCaption, + DatesCellHeight, + DatesCellWidth, + EdgeFlat, + EdgeRaised, + EdgeSunken, + Font, + FontSize, + HeaderBtnHeight, + HeaderBtnHMargin, + HeaderBtnVMargin, + HeaderBtnWidth, + HeaderHeight, + HeaderTextHeight, + HeaderTextHMargin, + HeaderTextVMargin, + HeaderTextWidth, + HeaderWidth, + Height, + HSepHeight, + HSepWidth, + LineHeight, + Margin, + ScrollBarWidth, + SepDOffset, + SepX, + SepY, + Size, + SmallIcon, + SpaceAboveBelow, + TextColor, + TextSelColor, + TodayFlagWidth, + TodayHeight, + TodayWidth, + UIMargin, + VSepHeight, + VSepWidth, + WeekHeight, + WeekNumHeight, + WeekNumWidth, + WeekWidth, + Width +}; + class IFWL_Widget; class IFDE_TextOut; class IFX_Font; @@ -41,7 +116,8 @@ class CFWL_WidgetTP { const CFX_Matrix& matrix); virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); virtual FX_BOOL DrawText(CFWL_ThemeText* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity); + virtual void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity); virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget); virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart); virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 2d1f8ace6e..82cabcc678 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -137,13 +137,13 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { m_pTextOut->SetFont(m_pCalendarFont); m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); - if ((pParams->m_iPart == FWL_PART_MCD_DatesIn) && + if ((pParams->m_iPart == CFWL_Part::DatesIn) && !(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) && (pParams->m_dwStates & - (FWL_PARTSTATE_MCD_Hovered | FWL_PARTSTATE_MCD_Selected))) { + (CFWL_PartState_Hovered | CFWL_PartState_Selected))) { m_pTextOut->SetTextColor(0xFFFFFFFF); } - if (pParams->m_iPart == FWL_PART_MCD_Caption) { + if (pParams->m_iPart == CFWL_Part::Caption) { if (m_pMonthCalendarTP->GetThemeID(pParams->m_pWidget) == 0) { m_pTextOut->SetTextColor(ArgbEncode(0xff, 0, 153, 255)); } else { @@ -191,40 +191,40 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { return TRUE; } void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, - uint32_t dwCapacity) { + CFWL_WidgetCapacity dwCapacity) { switch (dwCapacity) { - case FWL_WGTCAPACITY_Font: { + case CFWL_WidgetCapacity::Font: { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { return pWidget->GetDataAcc()->GetFDEFont(); } } break; - case FWL_WGTCAPACITY_FontSize: { + case CFWL_WidgetCapacity::FontSize: { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { m_fCapacity = pWidget->GetDataAcc()->GetFontSize(); return &m_fCapacity; } } break; - case FWL_WGTCAPACITY_TextColor: { + case CFWL_WidgetCapacity::TextColor: { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { m_dwCapacity = pWidget->GetDataAcc()->GetTextColor(); return &m_dwCapacity; } } break; - case FWL_WGTCAPACITY_LineHeight: { + case CFWL_WidgetCapacity::LineHeight: { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { m_fCapacity = pWidget->GetDataAcc()->GetLineHeight(); return &m_fCapacity; } } break; - case FWL_WGTCAPACITY_ScrollBarWidth: { + case CFWL_WidgetCapacity::ScrollBarWidth: { m_fCapacity = 9; return &m_fCapacity; } break; - case FWL_WGTCAPACITY_UIMargin: { + case CFWL_WidgetCapacity::UIMargin: { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); if (pWidget) { CXFA_LayoutItem* pItem = pWidget; @@ -249,7 +249,7 @@ void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, } return &m_Rect; } break; - case FWL_WGTCAPACITY_SpaceAboveBelow: { + case CFWL_WidgetCapacity::SpaceAboveBelow: { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); if (pWidget) { CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); @@ -263,18 +263,81 @@ void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, default: break; } + + int dwCapValue = static_cast<int>(dwCapacity); if (pThemePart->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar && - dwCapacity >= FWL_MCCAPACITY_Sun && dwCapacity <= FWL_MCCAPACITY_Today) { + dwCapValue >= static_cast<int>(CFWL_WidgetCapacity::Today) && + dwCapValue <= static_cast<int>(CFWL_WidgetCapacity::December)) { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { IXFA_AppProvider* pAppProvider = pWidget->GetAppProvider(); m_wsResource.clear(); - pAppProvider->LoadString( - XFA_IDS_StringWeekDay_Sun + dwCapacity - FWL_WGTCAPACITY_MAX - 5, - m_wsResource); - if (!m_wsResource.IsEmpty()) { - return &m_wsResource; + switch (dwCapacity) { + case CFWL_WidgetCapacity::Sun: + pAppProvider->LoadString(XFA_IDS_StringWeekDay_Sun, m_wsResource); + break; + case CFWL_WidgetCapacity::Mon: + pAppProvider->LoadString(XFA_IDS_StringWeekDay_Mon, m_wsResource); + break; + case CFWL_WidgetCapacity::Tue: + pAppProvider->LoadString(XFA_IDS_StringWeekDay_Tue, m_wsResource); + break; + case CFWL_WidgetCapacity::Wed: + pAppProvider->LoadString(XFA_IDS_StringWeekDay_Wed, m_wsResource); + break; + case CFWL_WidgetCapacity::Thu: + pAppProvider->LoadString(XFA_IDS_StringWeekDay_Thu, m_wsResource); + break; + case CFWL_WidgetCapacity::Fri: + pAppProvider->LoadString(XFA_IDS_StringWeekDay_Fri, m_wsResource); + break; + case CFWL_WidgetCapacity::Sat: + pAppProvider->LoadString(XFA_IDS_StringWeekDay_Sat, m_wsResource); + break; + case CFWL_WidgetCapacity::January: + pAppProvider->LoadString(XFA_IDS_StringMonth_Jan, m_wsResource); + break; + case CFWL_WidgetCapacity::February: + pAppProvider->LoadString(XFA_IDS_StringMonth_Feb, m_wsResource); + break; + case CFWL_WidgetCapacity::March: + pAppProvider->LoadString(XFA_IDS_StringMonth_March, m_wsResource); + break; + case CFWL_WidgetCapacity::April: + pAppProvider->LoadString(XFA_IDS_StringMonth_April, m_wsResource); + break; + case CFWL_WidgetCapacity::May: + pAppProvider->LoadString(XFA_IDS_StringMonth_May, m_wsResource); + break; + case CFWL_WidgetCapacity::June: + pAppProvider->LoadString(XFA_IDS_StringMonth_June, m_wsResource); + break; + case CFWL_WidgetCapacity::July: + pAppProvider->LoadString(XFA_IDS_StringMonth_July, m_wsResource); + break; + case CFWL_WidgetCapacity::August: + pAppProvider->LoadString(XFA_IDS_StringMonth_Aug, m_wsResource); + break; + case CFWL_WidgetCapacity::September: + pAppProvider->LoadString(XFA_IDS_StringMonth_Sept, m_wsResource); + break; + case CFWL_WidgetCapacity::October: + pAppProvider->LoadString(XFA_IDS_StringMonth_Oct, m_wsResource); + break; + case CFWL_WidgetCapacity::November: + pAppProvider->LoadString(XFA_IDS_StringMonth_Nov, m_wsResource); + break; + case CFWL_WidgetCapacity::December: + pAppProvider->LoadString(XFA_IDS_StringMonth_Dec, m_wsResource); + break; + case CFWL_WidgetCapacity::Today: + pAppProvider->LoadString(XFA_IDS_String_Today, m_wsResource); + break; + default: + break; } + if (!m_wsResource.IsEmpty()) + return &m_wsResource; } } return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity); @@ -359,13 +422,11 @@ CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { } CXFA_FWLCheckBoxTP::CXFA_FWLCheckBoxTP() {} FX_BOOL CXFA_FWLCheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (pParams->m_iPart != FWL_PART_CKB_CheckBox) { + if (pParams->m_iPart != CFWL_Part::CheckBox) { return TRUE; } - if (((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Checked) || - ((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Neutral)) { + if ((pParams->m_dwStates & CFWL_PartState_Checked) || + (pParams->m_dwStates & CFWL_PartState_Neutral)) { DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, pParams->m_dwStates, &pParams->m_matrix); } @@ -378,9 +439,9 @@ void CXFA_FWLCheckBoxTP::DrawCheckSign(IFWL_Widget* pWidget, CFX_Matrix* pMatrix) { CFX_RectF rtSign(*pRtBox); uint32_t dwColor = 0xFF000000; - if ((iState & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Neutral) { + if (iState & CFWL_PartState_Neutral) dwColor = 0xFFA9A9A9; - } + { uint32_t dwStyle = pWidget->GetStylesEx(); rtSign.Deflate(rtSign.width / 4, rtSign.height / 4); @@ -411,7 +472,7 @@ void CXFA_FWLCheckBoxTP::DrawCheckSign(IFWL_Widget* pWidget, CXFA_FWLEditTP::CXFA_FWLEditTP() {} CXFA_FWLEditTP::~CXFA_FWLEditTP() {} FX_BOOL CXFA_FWLEditTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (FWL_PART_EDT_CombTextLine == pParams->m_iPart) { + if (CFWL_Part::CombTextLine == pParams->m_iPart) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); FX_ARGB cr = 0xFF000000; FX_FLOAT fWidth = 1.0f; diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index a33dfe133e..5fda005a74 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -45,7 +45,8 @@ class CXFA_FWLTheme : public IFWL_ThemeProvider { FX_BOOL bChildren = TRUE); virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); virtual FX_BOOL DrawText(CFWL_ThemeText* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, uint32_t dwCapacity); + virtual void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity); virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget); virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart); virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, |