diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fwl/basewidget/fwl_comboboximp.cpp | 21 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_listboximp.cpp | 20 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_scrollbarimp.cpp | 51 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_formimp.cpp | 38 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetimp.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_themeprovider.h | 14 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_checkboxtp.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_checkboxtp.h | 4 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_monthcalendartp.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_monthcalendartp.h | 4 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_pushbuttontp.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_pushbuttontp.h | 4 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_scrollbartp.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_scrollbartp.h | 4 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_widgettp.cpp | 38 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_widgettp.h | 10 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fwltheme.cpp | 48 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fwltheme.h | 23 |
18 files changed, 61 insertions, 242 deletions
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index ded0da51f5..17c5bf80d4 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -695,12 +695,10 @@ FWL_Error CFWL_ComboBoxImp::SetThemeProvider( if (!pThemeProvider) return FWL_Error::Indefinite; m_pProperties->m_pThemeProvider = pThemeProvider; - if (m_pListBox && pThemeProvider->IsValidWidget(m_pListBox.get())) { + if (m_pListBox) m_pListBox->SetThemeProvider(pThemeProvider); - } - if (m_pEdit && pThemeProvider->IsValidWidget(m_pEdit.get())) { + if (m_pEdit) m_pEdit->SetThemeProvider(pThemeProvider); - } return FWL_Error::Succeeded; } int32_t CFWL_ComboBoxImp::GetCurSel() { @@ -1042,17 +1040,10 @@ void CFWL_ComboBoxImp::ReSetTheme() { pTheme = GetAvailableTheme(); m_pProperties->m_pThemeProvider = pTheme; } - if (m_pListBox) { - if (!m_pListBox->GetThemeProvider() && - pTheme->IsValidWidget(m_pListBox.get())) { - m_pListBox->SetThemeProvider(pTheme); - } - } - if (m_pEdit) { - if (!m_pEdit->GetThemeProvider() && pTheme->IsValidWidget(m_pEdit.get())) { - m_pEdit->SetThemeProvider(pTheme); - } - } + if (m_pListBox && !m_pListBox->GetThemeProvider()) + m_pListBox->SetThemeProvider(pTheme); + if (m_pEdit && !m_pEdit->GetThemeProvider()) + m_pEdit->SetThemeProvider(pTheme); } void CFWL_ComboBoxImp::ReSetEditAlignment() { if (!m_pEdit) diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index 3f65837883..33a0a8d1ee 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -202,10 +202,6 @@ FWL_Error CFWL_ListBoxImp::SetThemeProvider( IFWL_ThemeProvider* pThemeProvider) { if (!pThemeProvider) return FWL_Error::Indefinite; - if (!pThemeProvider->IsValidWidget(m_pInterface)) { - m_pScrollBarTP = pThemeProvider; - return FWL_Error::Succeeded; - } m_pProperties->m_pThemeProvider = pThemeProvider; return FWL_Error::Succeeded; } @@ -733,24 +729,16 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { int32_t iCount = pData->CountItems(m_pInterface); for (int32_t i = 0; i < iCount; i++) { IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i); - CFWL_ThemePart itemPart; - itemPart.m_pWidget = m_pInterface; - itemPart.m_iPart = CFWL_Part::ListItem; - itemPart.m_pData = m_pProperties->m_pDataProvider; - itemPart.m_bMaximize = i > 0; - CFX_RectF r; - m_pProperties->m_pThemeProvider->GetPartRect(&itemPart, r); if (!bAutoSize) { CFX_RectF rtItem; - rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, r.width, r.height); + rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, 0, 0); IFWL_ListBoxDP* pBox = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); pBox->SetItemRect(m_pInterface, pItem, rtItem); } - fs.y += r.height; - if (fs.x < r.width) { - fs.x = r.width; - fWidth = r.width; + if (fs.x < 0) { + fs.x = 0; + fWidth = 0; } } } else { diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp index 15b1d911b5..7e68ea2272 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp @@ -318,43 +318,26 @@ void CFWL_ScrollBarImp::CalcButtonLen() { } } void CFWL_ScrollBarImp::CalcMinButtonRect(CFX_RectF& rect) { - if (m_bCustomLayout) { - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - CFWL_ThemePart pPart; - pPart.m_rtPart = m_rtMinBtn; - pPart.m_pWidget = m_pInterface; - pPart.m_iPart = CFWL_Part::ForeArrow; - pPart.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) - ? CFWL_PartState_Disabled - : m_iMinButtonState; - pTheme->GetPartRect(&pPart, rect); - } else { - rect.left = m_rtClient.left; - rect.top = m_rtClient.top; - rect.width = IsVertical() ? m_rtClient.width : m_fButtonLen; - rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height; - } + if (m_bCustomLayout) + return; + + rect.left = m_rtClient.left; + rect.top = m_rtClient.top; + rect.width = IsVertical() ? m_rtClient.width : m_fButtonLen; + rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height; } + void CFWL_ScrollBarImp::CalcMaxButtonRect(CFX_RectF& rect) { - if (m_bCustomLayout) { - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - CFWL_ThemePart pPart; - pPart.m_rtPart = m_rtMaxBtn; - pPart.m_pWidget = m_pInterface; - pPart.m_iPart = CFWL_Part::BackArrow; - pPart.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) - ? CFWL_PartState_Disabled - : m_iMaxButtonState; - pTheme->GetPartRect(&pPart, rect); - } else { - rect.left = - IsVertical() ? m_rtClient.left : m_rtClient.right() - m_fButtonLen; - rect.top = - IsVertical() ? m_rtClient.bottom() - m_fButtonLen : m_rtClient.top; - rect.width = IsVertical() ? m_rtClient.width : m_fButtonLen; - rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height; - } + if (m_bCustomLayout) + return; + + rect.left = + IsVertical() ? m_rtClient.left : m_rtClient.right() - m_fButtonLen; + rect.top = IsVertical() ? m_rtClient.bottom() - m_fButtonLen : m_rtClient.top; + rect.width = IsVertical() ? m_rtClient.width : m_fButtonLen; + rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height; } + void CFWL_ScrollBarImp::CalcThumbButtonRect(CFX_RectF& rect) { if (!IsEnabled()) { m_rtThumb.Reset(); diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 1b82ff59f8..4dcedf67f9 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -652,12 +652,7 @@ void CFWL_FormImp::ReSetSysBtn() { m_iSysBox = 0; if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_CloseBox) { m_pCloseBox = new CFWL_SysBtn; - if (m_bCustomizeLayout) { - CFWL_ThemeBackground param; - param.m_pWidget = m_pInterface; - param.m_iPart = CFWL_Part::CloseBox; - pTheme->GetPartRect(¶m, m_pCloseBox->m_rtBtn); - } else { + if (!m_bCustomizeLayout) { m_pCloseBox->m_rtBtn.Set( m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); @@ -666,12 +661,7 @@ void CFWL_FormImp::ReSetSysBtn() { } if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_MaximizeBox) { m_pMaxBox = new CFWL_SysBtn; - if (m_bCustomizeLayout) { - CFWL_ThemeBackground param; - param.m_pWidget = m_pInterface; - param.m_iPart = CFWL_Part::MaximizeBox; - pTheme->GetPartRect(¶m, m_pMaxBox->m_rtBtn); - } else { + if (!m_bCustomizeLayout) { if (m_pCloseBox) { m_pMaxBox->m_rtBtn.Set( m_pCloseBox->m_rtBtn.left - kSystemButtonSpan - kSystemButtonSize, @@ -686,12 +676,7 @@ void CFWL_FormImp::ReSetSysBtn() { } if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_MinimizeBox) { m_pMinBox = new CFWL_SysBtn; - if (m_bCustomizeLayout) { - CFWL_ThemeBackground param; - param.m_pWidget = m_pInterface; - param.m_iPart = CFWL_Part::MinimizeBox; - pTheme->GetPartRect(¶m, m_pMinBox->m_rtBtn); - } else { + if (!m_bCustomizeLayout) { if (m_pMaxBox) { m_pMinBox->m_rtBtn.Set( m_pMaxBox->m_rtBtn.left - kSystemButtonSpan - kSystemButtonSize, @@ -712,26 +697,11 @@ void CFWL_FormImp::ReSetSysBtn() { static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon && pData->GetIcon(m_pInterface, FALSE)) { - if (m_bCustomizeLayout) { - CFWL_ThemeBackground param; - param.m_pWidget = m_pInterface; - param.m_iPart = CFWL_Part::Icon; - CFX_WideString wsText; - m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsText); - param.m_pData = &wsText; - pTheme->GetPartRect(¶m, m_rtIcon); - } else { + if (!m_bCustomizeLayout) { m_rtIcon.Set(5, (m_rtCaption.height - m_fSmallIconSz) / 2, m_fSmallIconSz, m_fSmallIconSz); } } - if (m_bCustomizeLayout) { - CFWL_ThemeText parma; - parma.m_pWidget = m_pInterface; - parma.m_iPart = CFWL_Part::HeadText; - m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText); - pTheme->GetPartRect(&parma, m_rtCaptionText); - } } void CFWL_FormImp::RegisterForm() { IFWL_App* pApp = GetOwnerApp(); diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index a7338b18a6..6e8ec09243 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -638,7 +638,7 @@ IFWL_ThemeProvider* CFWL_WidgetImp::GetAvailableTheme() { : m_pWidgetMgr->GetParentWidget(pUp); if (pUp) { IFWL_ThemeProvider* pRet = pUp->GetThemeProvider(); - if (pRet && pRet->IsValidWidget(m_pInterface)) + if (pRet) return pRet; } } while (pUp); diff --git a/xfa/fwl/core/ifwl_themeprovider.h b/xfa/fwl/core/ifwl_themeprovider.h index 06f64ba302..275f649574 100644 --- a/xfa/fwl/core/ifwl_themeprovider.h +++ b/xfa/fwl/core/ifwl_themeprovider.h @@ -20,25 +20,11 @@ class IFWL_Widget; class IFWL_ThemeProvider { public: virtual ~IFWL_ThemeProvider() {} - virtual bool IsValidWidget(IFWL_Widget* pWidget) = 0; - virtual uint32_t GetThemeID(IFWL_Widget* pWidget) = 0; - virtual uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE) = 0; - virtual FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, - CFX_Matrix& matrix) = 0; - virtual FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) = 0; virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) = 0; virtual FX_BOOL DrawText(CFWL_ThemeText* pParams) = 0; virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) = 0; virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) = 0; - virtual FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rtPart) = 0; - virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, - FX_FLOAT fx, - FX_FLOAT fy) = 0; virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) = 0; }; diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 033ee14ef3..9a96eedb04 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -41,12 +41,10 @@ bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox; } -uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren) { +uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) { if (m_pThemeData) SetThemeData(FWL_GetThemeColor(dwThemeID)); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); + return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); } FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h index 42d86d180f..d6beae8573 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.h +++ b/xfa/fwl/theme/cfwl_checkboxtp.h @@ -19,9 +19,7 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP { // CFWL_WidgeTP bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; FX_BOOL DrawText(CFWL_ThemeText* pParams) override; FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; FWL_Error Initialize() override; diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index eee199ee6d..3cbe007b5f 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -60,12 +60,10 @@ bool CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) { } uint32_t CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren) { + uint32_t dwThemeID) { if (m_pThemeData) SetThemeData(FWL_GetThemeColor(dwThemeID)); - - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); + return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); } FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h index b10258a7f9..b69b32c613 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.h +++ b/xfa/fwl/theme/cfwl_monthcalendartp.h @@ -18,9 +18,7 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; FX_BOOL DrawText(CFWL_ThemeText* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index cf9991e0f4..982a6f4b6d 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -25,10 +25,9 @@ bool CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::PushButton; } uint32_t CFWL_PushButtonTP::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren) { + uint32_t dwThemeID) { SetThemeData(FWL_GetThemeColor(dwThemeID)); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); + return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); } FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { switch (pParams->m_iPart) { diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h index 6c091f7ffd..053ca28831 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.h +++ b/xfa/fwl/theme/cfwl_pushbuttontp.h @@ -18,9 +18,7 @@ class CFWL_PushButtonTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index 6583f0e030..40d55786fe 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -37,11 +37,10 @@ void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart, return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); } uint32_t CFWL_ScrollBarTP::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren) { + uint32_t dwThemeID) { if (m_pThemeData) SetThemeData(FWL_GetThemeColor(dwThemeID)); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); + return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); } FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h index e9c6222cd3..6643bb700b 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.h +++ b/xfa/fwl/theme/cfwl_scrollbartp.h @@ -18,9 +18,7 @@ class CFWL_ScrollBarTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index a1b458cb41..5c54afd8fc 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -36,19 +36,6 @@ const float kCYBorder = 1.0f; } // namespace -static void FWL_SetChildThemeID(IFWL_Widget* pParent, uint32_t dwThemeID) { - CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); - IFWL_Widget* pChild = pWidgetMgr->GetFirstChildWidget(pParent); - while (pChild) { - IFWL_ThemeProvider* pTheme = pChild->GetThemeProvider(); - if (pTheme) { - pTheme->SetThemeID(pChild, dwThemeID, FALSE); - } - FWL_SetChildThemeID(pChild, dwThemeID); - pChild = pWidgetMgr->GetNextSiblingWidget(pChild); - } -} - bool CFWL_WidgetTP::IsValidWidget(IFWL_Widget* pWidget) { return FALSE; } @@ -57,17 +44,11 @@ uint32_t CFWL_WidgetTP::GetThemeID(IFWL_Widget* pWidget) { return m_dwThemeID; } -uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren) { +uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) { uint32_t dwOld = m_dwThemeID; m_dwThemeID = dwThemeID; - if (CFWL_ArrowData::HasInstance()) { + if (CFWL_ArrowData::HasInstance()) CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(dwThemeID)); - } - if (bChildren) { - FWL_SetChildThemeID(pWidget, dwThemeID); - } return dwOld; } @@ -165,17 +146,6 @@ FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { return FWL_GetThemeLayout(m_dwThemeID); } -FWL_Error CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rect) { - return FWL_Error::Succeeded; -} - -FX_BOOL CFWL_WidgetTP::IsInPart(CFWL_ThemePart* pThemePart, - FX_FLOAT fx, - FX_FLOAT fy) { - return TRUE; -} - FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { if (!pParams) return FALSE; @@ -757,10 +727,6 @@ CFGAS_GEFont* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily, return m_FontsArray.back()->GetFont(); } -FX_BOOL FWLTHEME_Init() { - return TRUE; -} - void FWLTHEME_Release() { CFWL_ArrowData::DestroyInstance(); CFWL_FontManager::DestroyInstance(); diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index a6fc4d65fb..ddd504b050 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -112,9 +112,7 @@ class CFWL_WidgetTP { virtual bool IsValidWidget(IFWL_Widget* pWidget); virtual uint32_t GetThemeID(IFWL_Widget* pWidget); - virtual uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE); + virtual uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID); virtual FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix); virtual FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, const CFX_Matrix& matrix); @@ -123,10 +121,6 @@ class CFWL_WidgetTP { virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity); virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget); - virtual FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart); - virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, - FX_FLOAT fx, - FX_FLOAT fy); virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect); FWL_Error SetFont(IFWL_Widget* pWidget, @@ -227,7 +221,7 @@ class CFWL_WidgetTP { uint32_t m_dwThemeID; CFX_Matrix _ctm; }; -FX_BOOL FWLTHEME_Init(); + void FWLTHEME_Release(); uint32_t FWL_GetThemeLayout(uint32_t dwThemeID); uint32_t FWL_GetThemeColor(uint32_t dwThemeID); diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 14222dcbd1..abc1f74fa4 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -85,7 +85,6 @@ FWL_Error CXFA_FWLTheme::Initialize() { } ASSERT(m_pCalendarFont); - FWLTHEME_Init(); return FWL_Error::Succeeded; } @@ -99,33 +98,10 @@ FWL_Error CXFA_FWLTheme::Finalize() { return FWL_Error::Succeeded; } -bool CXFA_FWLTheme::IsValidWidget(IFWL_Widget* pWidget) { - return TRUE; -} - -uint32_t CXFA_FWLTheme::GetThemeID(IFWL_Widget* pWidget) { - return 0; -} - -uint32_t CXFA_FWLTheme::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren) { - return 0; -} - -FWL_Error CXFA_FWLTheme::GetThemeMatrix(IFWL_Widget* pWidget, - CFX_Matrix& matrix) { - return FWL_Error::Succeeded; -} - -FWL_Error CXFA_FWLTheme::SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) { - return FWL_Error::Succeeded; -} - FX_BOOL CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); } + FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { if (pParams->m_wsText.IsEmpty()) return FALSE; @@ -193,6 +169,7 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { pParams->m_wsText.GetLength(), pParams->m_rtPart); return TRUE; } + void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) { switch (dwCapacity) { @@ -345,23 +322,11 @@ void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, } return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity); } + FX_BOOL CXFA_FWLTheme::IsCustomizedLayout(IFWL_Widget* pWidget) { return GetTheme(pWidget)->IsCustomizedLayout(pWidget); } -FWL_Error CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rtPart) { - return FWL_Error::Succeeded; -} -FWL_Error CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart) { - CFX_RectF rect; - return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rect); -} -FX_BOOL CXFA_FWLTheme::IsInPart(CFWL_ThemePart* pThemePart, - FX_FLOAT fx, - FX_FLOAT fy) { - return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy); -} FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); @@ -396,6 +361,7 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { pParams->m_wsText.GetLength(), rect); return TRUE; } + CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { switch (pWidget->GetClassID()) { case FWL_Type::CheckBox: @@ -424,7 +390,9 @@ CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { return nullptr; } } + CXFA_FWLCheckBoxTP::CXFA_FWLCheckBoxTP() {} + FX_BOOL CXFA_FWLCheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (pParams->m_iPart != CFWL_Part::CheckBox) { return TRUE; @@ -436,6 +404,7 @@ FX_BOOL CXFA_FWLCheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { } return TRUE; } + void CXFA_FWLCheckBoxTP::DrawCheckSign(IFWL_Widget* pWidget, CFX_Graphics* pGraphics, const CFX_RectF* pRtBox, @@ -473,8 +442,11 @@ void CXFA_FWLCheckBoxTP::DrawCheckSign(IFWL_Widget* pWidget, } } } + CXFA_FWLEditTP::CXFA_FWLEditTP() {} + CXFA_FWLEditTP::~CXFA_FWLEditTP() {} + FX_BOOL CXFA_FWLEditTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (CFWL_Part::CombTextLine == pParams->m_iPart) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index 77659236ee..8c045de791 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -29,34 +29,17 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { CXFA_FWLTheme(CXFA_FFApp* pApp); ~CXFA_FWLTheme() override; + FWL_Error Initialize(); + FWL_Error Finalize(); + // IFWL_ThemeProvider: - bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t GetThemeID(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE) override; - FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override; - FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) override; FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; FX_BOOL DrawText(CFWL_ThemeText* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) override; - FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; - FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, - FX_FLOAT fx, - FX_FLOAT fy) override; FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) override; - FWL_Error GetClassName(CFX_WideString& wsClass) const { - return FWL_Error::Succeeded; - } - uint32_t GetHashCode() const { return 0; } - FWL_Error Initialize(); - FWL_Error Finalize(); - FWL_Error GetPartRect(CFWL_ThemePart* pThemePart); - protected: CFWL_WidgetTP* GetTheme(IFWL_Widget* pWidget); std::unique_ptr<CFWL_CheckBoxTP> m_pCheckBoxTP; |