summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/cfwl_combobox.cpp2
-rw-r--r--xfa/fwl/cfwl_form.cpp4
-rw-r--r--xfa/fwl/cfwl_widget.cpp35
-rw-r--r--xfa/fwl/cfwl_widget.h9
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp2
-rw-r--r--xfa/fwl/cfwl_widgetmgr.h2
6 files changed, 28 insertions, 26 deletions
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index 41541c8774..1bd1799d58 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -242,7 +242,7 @@ void CFWL_ComboBox::ShowDropList(bool bActivate) {
pComboList->ChangeSelected(m_iCurSel);
float fItemHeight = pComboList->CalcItemHeight();
- float fBorder = GetBorderSize(true);
+ float fBorder = GetCXBorderSize();
float fPopupMin = 0.0f;
if (iItems > 3)
fPopupMin = fItemHeight * 3 + fBorder * 2;
diff --git a/xfa/fwl/cfwl_form.cpp b/xfa/fwl/cfwl_form.cpp
index f779c43468..616167b308 100644
--- a/xfa/fwl/cfwl_form.cpp
+++ b/xfa/fwl/cfwl_form.cpp
@@ -158,8 +158,8 @@ void CFWL_Form::DrawBackground(CXFA_Graphics* pGraphics,
CFX_RectF CFWL_Form::GetEdgeRect() {
CFX_RectF rtEdge = m_rtRelative;
if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) {
- float fCX = GetBorderSize(true);
- float fCY = GetBorderSize(false);
+ float fCX = GetCXBorderSize();
+ float fCY = GetCYBorderSize();
rtEdge.Deflate(fCX, fCY, fCX, fCY);
}
return rtEdge;
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 309793c690..0aab86019d 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -75,10 +75,11 @@ CFX_RectF CFWL_Widget::GetWidgetRect() {
}
void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) {
- if (HasBorder()) {
- float fBorder = GetBorderSize(true);
- rect.Inflate(fBorder, fBorder);
- }
+ if (!HasBorder())
+ return;
+
+ float fBorder = GetCXBorderSize();
+ rect.Inflate(fBorder, fBorder);
}
void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
@@ -230,34 +231,34 @@ bool CFWL_Widget::IsChild() const {
return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child);
}
-CFX_RectF CFWL_Widget::GetEdgeRect() {
+CFX_RectF CFWL_Widget::GetEdgeRect() const {
CFX_RectF rtEdge(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
- if (HasBorder()) {
- float fCX = GetBorderSize(true);
- float fCY = GetBorderSize(false);
- rtEdge.Deflate(fCX, fCY);
- }
+ if (HasBorder())
+ rtEdge.Deflate(GetCXBorderSize(), GetCYBorderSize());
return rtEdge;
}
-float CFWL_Widget::GetBorderSize(bool bCX) {
+float CFWL_Widget::GetCXBorderSize() const {
+ IFWL_ThemeProvider* theme = GetAvailableTheme();
+ return theme ? theme->GetCXBorderSize() : 0.0f;
+}
+
+float CFWL_Widget::GetCYBorderSize() const {
IFWL_ThemeProvider* theme = GetAvailableTheme();
- if (!theme)
- return 0.0f;
- return bCX ? theme->GetCXBorderSize() : theme->GetCYBorderSize();
+ return theme ? theme->GetCYBorderSize() : 0.0f;
}
-CFX_RectF CFWL_Widget::GetRelativeRect() {
+CFX_RectF CFWL_Widget::GetRelativeRect() const {
return CFX_RectF(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
}
-IFWL_ThemeProvider* CFWL_Widget::GetAvailableTheme() {
+IFWL_ThemeProvider* CFWL_Widget::GetAvailableTheme() const {
if (m_pProperties->m_pThemeProvider)
return m_pProperties->m_pThemeProvider.Get();
- CFWL_Widget* pUp = this;
+ const CFWL_Widget* pUp = this;
do {
pUp = (pUp->GetStyles() & FWL_WGTSTYLE_Popup)
? m_pWidgetMgr->GetOwnerWidget(pUp)
diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h
index 13b06a9b49..7760b58a2f 100644
--- a/xfa/fwl/cfwl_widget.h
+++ b/xfa/fwl/cfwl_widget.h
@@ -124,10 +124,11 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
bool IsEnabled() const;
bool IsLocked() const { return m_iLock > 0; }
bool HasBorder() const;
- CFX_RectF GetEdgeRect();
- float GetBorderSize(bool bCX);
- CFX_RectF GetRelativeRect();
- IFWL_ThemeProvider* GetAvailableTheme();
+ CFX_RectF GetEdgeRect() const;
+ float GetCXBorderSize() const;
+ float GetCYBorderSize() const;
+ CFX_RectF GetRelativeRect() const;
+ IFWL_ThemeProvider* GetAvailableTheme() const;
CFX_SizeF CalcTextSize(const WideString& wsText,
IFWL_ThemeProvider* pTheme,
bool bMultiLine);
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index 4f9170fadd..1e17b7bdf4 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -27,7 +27,7 @@ CFWL_Widget* CFWL_WidgetMgr::GetParentWidget(const CFWL_Widget* pWidget) const {
return pItem && pItem->pParent ? pItem->pParent->pWidget : nullptr;
}
-CFWL_Widget* CFWL_WidgetMgr::GetOwnerWidget(CFWL_Widget* pWidget) const {
+CFWL_Widget* CFWL_WidgetMgr::GetOwnerWidget(const CFWL_Widget* pWidget) const {
Item* pItem = GetWidgetMgrItem(pWidget);
return pItem && pItem->pOwner ? pItem->pOwner->pWidget : nullptr;
}
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index 68c02bef7b..f3bb734646 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -32,7 +32,7 @@ class CFWL_WidgetMgr {
const CFX_Matrix& matrix);
CFWL_Widget* GetParentWidget(const CFWL_Widget* pWidget) const;
- CFWL_Widget* GetOwnerWidget(CFWL_Widget* pWidget) const;
+ CFWL_Widget* GetOwnerWidget(const CFWL_Widget* pWidget) const;
CFWL_Widget* GetNextSiblingWidget(CFWL_Widget* pWidget) const;
CFWL_Widget* GetFirstChildWidget(CFWL_Widget* pWidget) const;
CFWL_Widget* GetSystemFormWidget(CFWL_Widget* pWidget) const;