diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-21 06:22:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-21 06:22:11 -0700 |
commit | f87058d19a3448face48202c7040ee4d95ba39c1 (patch) | |
tree | dca273099a27add24bcfbc6a2ce5e46cf262dbc5 /xfa/fwl/theme | |
parent | b4e8708ce506be308fefc3eb85a427206ef320d8 (diff) | |
download | pdfium-f87058d19a3448face48202c7040ee4d95ba39c1.tar.xz |
Convert some FWL defines to enums.
This CL converts FWL_WGTCAPACITY_* defines to the CFWL_WidgetCapacity enum
class. The FWL_PART_* defines to the FWL_Part enum class and the
FWL_PartState_* defines to an enum.
Review URL: https://codereview.chromium.org/1898713003
Diffstat (limited to 'xfa/fwl/theme')
-rw-r--r-- | xfa/fwl/theme/cfwl_barcodetp.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_carettp.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_checkboxtp.cpp | 78 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_comboboxtp.cpp | 26 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_comboboxtp.h | 3 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_datetimepickedtp.cpp | 14 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_edittp.cpp | 17 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_formtp.cpp | 54 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_formtp.h | 23 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_listboxtp.cpp | 20 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_monthcalendartp.cpp | 143 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_monthcalendartp.h | 22 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_pictureboxtp.cpp | 4 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_pushbuttontp.cpp | 25 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_pushbuttontp.h | 20 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_scrollbartp.cpp | 20 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_scrollbartp.h | 3 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_widgettp.cpp | 26 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_widgettp.h | 78 |
19 files changed, 331 insertions, 257 deletions
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, |