diff options
Diffstat (limited to 'xfa/fwl')
-rw-r--r-- | xfa/fwl/core/ifwl_form.cpp | 56 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_form.h | 1 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_listbox.cpp | 56 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_scrollbar.cpp | 140 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_scrollbar.h | 1 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_themeprovider.h | 1 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_widgettp.cpp | 4 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_widgettp.h | 1 |
8 files changed, 59 insertions, 201 deletions
diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp index f89261d422..115aca04a9 100644 --- a/xfa/fwl/core/ifwl_form.cpp +++ b/xfa/fwl/core/ifwl_form.cpp @@ -55,7 +55,6 @@ IFWL_Form::IFWL_Form(const IFWL_App* app, m_bLButtonDown(false), m_bMaximized(false), m_bSetMaximize(false), - m_bCustomizeLayout(false), m_bDoModalFlag(false) { m_rtRelative.Reset(); m_rtRestore.Reset(); @@ -416,50 +415,41 @@ void IFWL_Form::ResetSysBtn() { *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::CYBorder)); RemoveSysButtons(); - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - m_bCustomizeLayout = pTheme->IsCustomizedLayout(this); - m_iSysBox = 0; if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_CloseBox) { m_pCloseBox = new CFWL_SysBtn; - if (!m_bCustomizeLayout) { - m_pCloseBox->m_rtBtn.Set( - m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, - kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); - } + m_pCloseBox->m_rtBtn.Set( + m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, + kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); m_iSysBox++; } if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_MaximizeBox) { m_pMaxBox = new CFWL_SysBtn; - if (!m_bCustomizeLayout) { - if (m_pCloseBox) { - m_pMaxBox->m_rtBtn.Set( - m_pCloseBox->m_rtBtn.left - kSystemButtonSpan - kSystemButtonSize, - m_pCloseBox->m_rtBtn.top, kSystemButtonSize, kSystemButtonSize); - } else { - m_pMaxBox->m_rtBtn.Set( - m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, - kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); - } + if (m_pCloseBox) { + m_pMaxBox->m_rtBtn.Set( + m_pCloseBox->m_rtBtn.left - kSystemButtonSpan - kSystemButtonSize, + m_pCloseBox->m_rtBtn.top, kSystemButtonSize, kSystemButtonSize); + } else { + m_pMaxBox->m_rtBtn.Set( + m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, + kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); } m_iSysBox++; } if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_MinimizeBox) { m_pMinBox = new CFWL_SysBtn; - if (!m_bCustomizeLayout) { - if (m_pMaxBox) { - m_pMinBox->m_rtBtn.Set( - m_pMaxBox->m_rtBtn.left - kSystemButtonSpan - kSystemButtonSize, - m_pMaxBox->m_rtBtn.top, kSystemButtonSize, kSystemButtonSize); - } else if (m_pCloseBox) { - m_pMinBox->m_rtBtn.Set( - m_pCloseBox->m_rtBtn.left - kSystemButtonSpan - kSystemButtonSize, - m_pCloseBox->m_rtBtn.top, kSystemButtonSize, kSystemButtonSize); - } else { - m_pMinBox->m_rtBtn.Set( - m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, - kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); - } + if (m_pMaxBox) { + m_pMinBox->m_rtBtn.Set( + m_pMaxBox->m_rtBtn.left - kSystemButtonSpan - kSystemButtonSize, + m_pMaxBox->m_rtBtn.top, kSystemButtonSize, kSystemButtonSize); + } else if (m_pCloseBox) { + m_pMinBox->m_rtBtn.Set( + m_pCloseBox->m_rtBtn.left - kSystemButtonSpan - kSystemButtonSize, + m_pCloseBox->m_rtBtn.top, kSystemButtonSize, kSystemButtonSize); + } else { + m_pMinBox->m_rtBtn.Set( + m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, + kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); } m_iSysBox++; } diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index dfd9930236..3b7fe4f698 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -97,7 +97,6 @@ class IFWL_Form : public IFWL_Widget { bool m_bLButtonDown; bool m_bMaximized; bool m_bSetMaximize; - bool m_bCustomizeLayout; bool m_bDoModalFlag; }; diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp index a1646e2c92..aa17355b77 100644 --- a/xfa/fwl/core/ifwl_listbox.cpp +++ b/xfa/fwl/core/ifwl_listbox.cpp @@ -638,48 +638,24 @@ CFX_SizeF IFWL_ListBox::CalcSize(bool bAutoSize) { } } - FX_FLOAT fWidth = 0; - if (m_pProperties->m_pThemeProvider->IsCustomizedLayout(this)) { - IFWL_ListBox::DataProvider* pData = - static_cast<IFWL_ListBox::DataProvider*>( - m_pProperties->m_pDataProvider); - int32_t iCount = pData->CountItems(this); - for (int32_t i = 0; i < iCount; i++) { - CFWL_ListItem* pItem = pData->GetItem(this, i); - if (!bAutoSize) { - CFX_RectF rtItem; - rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, 0, 0); - IFWL_ListBox::DataProvider* pBox = - static_cast<IFWL_ListBox::DataProvider*>( - m_pProperties->m_pDataProvider); - pBox->SetItemRect(this, pItem, rtItem); - } - if (fs.x < 0) { - fs.x = 0; - fWidth = 0; - } - } - } else { - fWidth = GetMaxTextWidth(); - fWidth += 2 * kItemTextMargin; - if (!bAutoSize) { - FX_FLOAT fActualWidth = - m_rtClient.width - rtUIMargin.left - rtUIMargin.width; - fWidth = std::max(fWidth, fActualWidth); - } + FX_FLOAT fWidth = GetMaxTextWidth(); + fWidth += 2 * kItemTextMargin; + if (!bAutoSize) { + FX_FLOAT fActualWidth = + m_rtClient.width - rtUIMargin.left - rtUIMargin.width; + fWidth = std::max(fWidth, fActualWidth); + } - IFWL_ListBox::DataProvider* pData = - static_cast<IFWL_ListBox::DataProvider*>( - m_pProperties->m_pDataProvider); - m_fItemHeight = CalcItemHeight(); - if ((GetStylesEx() & FWL_STYLEEXT_LTB_Icon)) - fWidth += m_fItemHeight; + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); + m_fItemHeight = CalcItemHeight(); + if ((GetStylesEx() & FWL_STYLEEXT_LTB_Icon)) + fWidth += m_fItemHeight; - int32_t iCount = pData->CountItems(this); - for (int32_t i = 0; i < iCount; i++) { - CFWL_ListItem* htem = pData->GetItem(this, i); - GetItemSize(fs, htem, fWidth, m_fItemHeight, bAutoSize); - } + int32_t iCount = pData->CountItems(this); + for (int32_t i = 0; i < iCount; i++) { + CFWL_ListItem* htem = pData->GetItem(this, i); + GetItemSize(fs, htem, fWidth, m_fItemHeight, bAutoSize); } if (bAutoSize) return fs; diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp index 9d5f7a685e..0de791fa2d 100644 --- a/xfa/fwl/core/ifwl_scrollbar.cpp +++ b/xfa/fwl/core/ifwl_scrollbar.cpp @@ -46,7 +46,6 @@ IFWL_ScrollBar::IFWL_ScrollBar( m_bMouseDown(false), m_fButtonLen(0), m_bMinSize(false), - m_bCustomLayout(false), m_fMinThumb(FWL_SCROLLBAR_MinThumb), m_Timer(this) { m_rtClient.Reset(); @@ -176,7 +175,6 @@ void IFWL_ScrollBar::Layout() { part.m_pWidget = this; m_fMinThumb = *static_cast<FX_FLOAT*>( pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Size)); - m_bCustomLayout = pTheme->IsCustomizedLayout(this); GetClientRect(m_rtClient); CalcButtonLen(); CalcMinButtonRect(m_rtMinBtn); @@ -198,9 +196,6 @@ void IFWL_ScrollBar::CalcButtonLen() { } void IFWL_ScrollBar::CalcMinButtonRect(CFX_RectF& rect) { - if (m_bCustomLayout) - return; - rect.left = m_rtClient.left; rect.top = m_rtClient.top; rect.width = IsVertical() ? m_rtClient.width : m_fButtonLen; @@ -208,9 +203,6 @@ void IFWL_ScrollBar::CalcMinButtonRect(CFX_RectF& rect) { } void IFWL_ScrollBar::CalcMaxButtonRect(CFX_RectF& rect) { - 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; @@ -241,21 +233,9 @@ void IFWL_ScrollBar::CalcThumbButtonRect(CFX_RectF& rect) { CFX_RectF rtClient = m_rtClient; FX_FLOAT fLength = IsVertical() ? rtClient.height : rtClient.width; FX_FLOAT fSize = m_fButtonLen; - if (m_bCustomLayout) { - if (IsVertical()) { - fLength = fLength - m_rtMinBtn.height - m_rtMaxBtn.height; - if (fLength < m_rtMinBtn.height || fLength < m_rtMaxBtn.height) - fLength = 0.0f; - } else { - fLength = fLength - m_rtMinBtn.width - m_rtMaxBtn.width; - if (fLength < m_rtMinBtn.width || fLength < m_rtMaxBtn.width) - fLength = 0.0f; - } - } else { - fLength -= fSize * 2.0f; - if (fLength < fSize) - fLength = 0.0f; - } + fLength -= fSize * 2.0f; + if (fLength < fSize) + fLength = 0.0f; FX_FLOAT fThumbSize = fLength * fLength / (fRange + fLength); fThumbSize = std::max(fThumbSize, m_fMinThumb); @@ -266,43 +246,17 @@ void IFWL_ScrollBar::CalcThumbButtonRect(CFX_RectF& rect) { if (!fRange) return; - if (m_bCustomLayout) { - FX_FLOAT iPos = fDiff * (fTrackPos - m_fRangeMin) / fRange; - rect.left = rtClient.left; - if (!IsVertical()) { - if ((m_rtMinBtn.right() == m_rtMaxBtn.left && m_rtMinBtn.width > 0 && - m_rtMaxBtn.width > 0) || - (0 == m_rtMinBtn.width && 0 == m_rtMaxBtn.width)) { - rect.left += iPos; - } else { - rect.left += m_rtMinBtn.right() + iPos; - } - } - rect.top = rtClient.top; - if (IsVertical()) { - if ((m_rtMinBtn.bottom() == m_rtMaxBtn.top && m_rtMinBtn.height > 0 && - m_rtMaxBtn.height > 0) || - (0 == m_rtMinBtn.height && 0 == m_rtMaxBtn.height)) { - rect.top += iPos; - } else { - rect.top += m_rtMinBtn.bottom() + iPos; - } - } - rect.width = IsVertical() ? rtClient.width : fThumbSize; - rect.height = IsVertical() ? fThumbSize : rtClient.height; - } else { - FX_FLOAT iPos = fSize + fDiff * (fTrackPos - m_fRangeMin) / fRange; - rect.left = rtClient.left; - if (!IsVertical()) - rect.left += iPos; + FX_FLOAT iPos = fSize + fDiff * (fTrackPos - m_fRangeMin) / fRange; + rect.left = rtClient.left; + if (!IsVertical()) + rect.left += iPos; - rect.top = rtClient.top; - if (IsVertical()) - rect.top += iPos; + rect.top = rtClient.top; + if (IsVertical()) + rect.top += iPos; - rect.width = IsVertical() ? rtClient.width : fThumbSize; - rect.height = IsVertical() ? fThumbSize : rtClient.height; - } + rect.width = IsVertical() ? rtClient.width : fThumbSize; + rect.height = IsVertical() ? fThumbSize : rtClient.height; } void IFWL_ScrollBar::CalcMinTrackRect(CFX_RectF& rect) { @@ -320,22 +274,6 @@ void IFWL_ScrollBar::CalcMinTrackRect(CFX_RectF& rect) { bool bVertical = IsVertical(); rect.width = bVertical ? m_rtClient.width : ix; rect.height = bVertical ? iy : m_rtClient.height; - if (!m_bCustomLayout) - return; - - if (bVertical) { - if (m_rtMinBtn.height == 0 && m_rtMaxBtn.height == 0) { - rect.top = m_rtClient.top; - } else if (m_rtMinBtn.top < m_rtThumb.top) { - rect.top = m_rtMinBtn.bottom(); - rect.height -= (m_rtMinBtn.bottom() - m_rtClient.top); - } - } else if (m_rtMinBtn.width == 0 && m_rtMaxBtn.width == 0) { - rect.left = m_rtClient.left; - } else if (m_rtMinBtn.left < m_rtThumb.left) { - rect.left = m_rtMinBtn.right(); - rect.width -= (m_rtMinBtn.right() - m_rtClient.left); - } } void IFWL_ScrollBar::CalcMaxTrackRect(CFX_RectF& rect) { @@ -351,22 +289,6 @@ void IFWL_ScrollBar::CalcMaxTrackRect(CFX_RectF& rect) { rect.top = bVertical ? iy : m_rtClient.top; rect.width = bVertical ? m_rtClient.width : m_rtClient.right() - ix; rect.height = bVertical ? m_rtClient.bottom() - iy : m_rtClient.height; - if (!m_bCustomLayout) - return; - - if (bVertical) { - if (m_rtMinBtn.top > m_rtThumb.top && m_rtMinBtn.height > 0 && - m_rtMaxBtn.height > 0) { - rect.height -= (m_rtClient.bottom() - m_rtMinBtn.top); - } else if (m_rtMinBtn.height > 0 && m_rtMaxBtn.height > 0) { - rect.height -= (m_rtClient.bottom() - m_rtMaxBtn.top); - } - } else if (m_rtMinBtn.left > m_rtThumb.left && m_rtMinBtn.width > 0 && - m_rtMaxBtn.width > 0) { - rect.width -= (m_rtClient.right() - m_rtMinBtn.left); - } else if (m_rtMinBtn.width > 0 && m_rtMaxBtn.width > 0) { - rect.width -= (m_rtClient.right() - m_rtMaxBtn.left); - } } FX_FLOAT IFWL_ScrollBar::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) { @@ -374,44 +296,22 @@ FX_FLOAT IFWL_ScrollBar::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) { FX_FLOAT fDiffY = fy - m_cpTrackPointY; FX_FLOAT fRange = m_fRangeMax - m_fRangeMin; FX_FLOAT fPos; - if (m_bCustomLayout) { - if (IsVertical()) { - if (m_rtMinBtn.height == 0 && m_rtMaxBtn.height == 0) { - fPos = fRange * fDiffY / (m_rtClient.height - m_rtThumb.height); - } else if (m_rtMinBtn.bottom() == m_rtMaxBtn.top) { - fPos = fRange * fDiffY / - (m_rtMinBtn.top - m_rtClient.top - m_rtThumb.height); - } else { - fPos = fRange * fDiffY / - (m_rtMaxBtn.top - m_rtMinBtn.bottom() - m_rtThumb.height); - } - } else { - if (m_rtMinBtn.width == 0 && m_rtMaxBtn.width == 0) { - fPos = fRange * fDiffX / (m_rtClient.width - m_rtThumb.width); - } else if (m_rtMinBtn.right() == m_rtMaxBtn.left) { - fPos = fRange * fDiffX / - (m_rtMinBtn.left - m_rtClient.left - m_rtThumb.width); - } else { - fPos = fRange * fDiffX / - (m_rtMaxBtn.left - m_rtMinBtn.right() - m_rtThumb.width); - } - } + + if (IsVertical()) { + fPos = fRange * fDiffY / + (m_rtMaxBtn.top - m_rtMinBtn.bottom() - m_rtThumb.height); } else { - if (IsVertical()) { - fPos = fRange * fDiffY / - (m_rtMaxBtn.top - m_rtMinBtn.bottom() - m_rtThumb.height); - } else { - fPos = fRange * fDiffX / - (m_rtMaxBtn.left - m_rtMinBtn.right() - m_rtThumb.width); - } + fPos = fRange * fDiffX / + (m_rtMaxBtn.left - m_rtMinBtn.right() - m_rtThumb.width); } + fPos += m_fLastTrackPos; return std::min(std::max(fPos, m_fRangeMin), m_fRangeMax); } void IFWL_ScrollBar::GetTrackRect(CFX_RectF& rect, bool bLower) { bool bDisabled = !!(m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled); - if (bDisabled || m_bCustomLayout) { + if (bDisabled) { rect = bLower ? m_rtMinTrack : m_rtMaxTrack; return; } diff --git a/xfa/fwl/core/ifwl_scrollbar.h b/xfa/fwl/core/ifwl_scrollbar.h index 148abf982b..06306c3c74 100644 --- a/xfa/fwl/core/ifwl_scrollbar.h +++ b/xfa/fwl/core/ifwl_scrollbar.h @@ -143,7 +143,6 @@ class IFWL_ScrollBar : public IFWL_Widget { CFX_RectF m_rtMaxBtn; CFX_RectF m_rtMinTrack; CFX_RectF m_rtMaxTrack; - bool m_bCustomLayout; FX_FLOAT m_fMinThumb; IFWL_ScrollBar::Timer m_Timer; }; diff --git a/xfa/fwl/core/ifwl_themeprovider.h b/xfa/fwl/core/ifwl_themeprovider.h index 855b967ec3..cc55fa30ee 100644 --- a/xfa/fwl/core/ifwl_themeprovider.h +++ b/xfa/fwl/core/ifwl_themeprovider.h @@ -23,7 +23,6 @@ class IFWL_ThemeProvider { virtual void DrawText(CFWL_ThemeText* pParams) = 0; virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) = 0; - virtual bool IsCustomizedLayout(IFWL_Widget* pWidget) = 0; virtual void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) = 0; }; diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index d6273696ce..1b05be72dd 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -117,10 +117,6 @@ void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, return &m_fValue; } -bool CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { - return false; -} - void CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { if (!pParams || !m_pTextOut) return; diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index f96a7666b3..6093dd2465 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -116,7 +116,6 @@ class CFWL_WidgetTP { virtual void DrawText(CFWL_ThemeText* pParams); virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity); - virtual bool IsCustomizedLayout(IFWL_Widget* pWidget); virtual void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect); void SetFont(IFWL_Widget* pWidget, |