summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/core/cfwl_combobox.cpp78
-rw-r--r--xfa/fwl/core/cfwl_combobox.h48
-rw-r--r--xfa/fwl/core/cfwl_listbox.cpp103
-rw-r--r--xfa/fwl/core/cfwl_listbox.h54
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp7
-rw-r--r--xfa/fwl/core/ifwl_combolist.cpp21
-rw-r--r--xfa/fwl/core/ifwl_formproxy.h3
-rw-r--r--xfa/fwl/core/ifwl_listbox.cpp30
-rw-r--r--xfa/fwl/core/ifwl_listbox.h96
-rw-r--r--xfa/fwl/core/ifwl_picturebox.cpp20
-rw-r--r--xfa/fwl/core/ifwl_picturebox.h7
-rw-r--r--xfa/fwl/core/ifwl_pushbutton.cpp3
-rw-r--r--xfa/fwl/core/ifwl_pushbutton.h16
13 files changed, 213 insertions, 273 deletions
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp
index 825d66382e..bd045f4e71 100644
--- a/xfa/fwl/core/cfwl_combobox.cpp
+++ b/xfa/fwl/core/cfwl_combobox.cpp
@@ -281,55 +281,46 @@ uint32_t CFWL_ComboBox::GetItemStyles(IFWL_Widget* pWidget,
return static_cast<CFWL_ListItem*>(pItem)->m_dwStyles;
}
-FWL_Error CFWL_ComboBox::GetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_WideString& wsText) {
- if (!pItem)
- return FWL_Error::Indefinite;
- wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
- return FWL_Error::Succeeded;
+void CFWL_ComboBox::GetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_WideString& wsText) {
+ if (pItem)
+ wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
}
-FWL_Error CFWL_ComboBox::GetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtItem) {
+void CFWL_ComboBox::GetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtItem) {
if (!pItem)
- return FWL_Error::Indefinite;
+ return;
CFWL_ListItem* pComboItem = static_cast<CFWL_ListItem*>(pItem);
rtItem.Set(pComboItem->m_rtItem.left, pComboItem->m_rtItem.top,
pComboItem->m_rtItem.width, pComboItem->m_rtItem.height);
- return FWL_Error::Succeeded;
}
void* CFWL_ComboBox::GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) {
return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr;
}
-FWL_Error CFWL_ComboBox::SetItemStyles(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwStyle) {
- if (!pItem)
- return FWL_Error::Indefinite;
- static_cast<CFWL_ListItem*>(pItem)->m_dwStyles = dwStyle;
- return FWL_Error::Succeeded;
+void CFWL_ComboBox::SetItemStyles(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwStyle) {
+ if (pItem)
+ static_cast<CFWL_ListItem*>(pItem)->m_dwStyles = dwStyle;
}
-FWL_Error CFWL_ComboBox::SetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const FX_WCHAR* pszText) {
- if (!pItem)
- return FWL_Error::Indefinite;
- static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText;
- return FWL_Error::Succeeded;
+void CFWL_ComboBox::SetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) {
+ if (pItem)
+ static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText;
}
-FWL_Error CFWL_ComboBox::SetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtItem) {
- if (!pItem)
- return FWL_Error::Indefinite;
- static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem;
- return FWL_Error::Succeeded;
+void CFWL_ComboBox::SetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) {
+ if (pItem)
+ static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem;
}
FX_FLOAT CFWL_ComboBox::GetItemHeight(IFWL_Widget* pWidget) {
@@ -341,18 +332,16 @@ CFX_DIBitmap* CFWL_ComboBox::GetItemIcon(IFWL_Widget* pWidget,
return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pDIB : nullptr;
}
-FWL_Error CFWL_ComboBox::GetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtCheck) {
+void CFWL_ComboBox::GetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) {
rtCheck = static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox;
- return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBox::SetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) {
+void CFWL_ComboBox::SetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) {
static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox = rtCheck;
- return FWL_Error::Succeeded;
}
uint32_t CFWL_ComboBox::GetItemCheckState(IFWL_Widget* pWidget,
@@ -360,11 +349,10 @@ uint32_t CFWL_ComboBox::GetItemCheckState(IFWL_Widget* pWidget,
return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState;
}
-FWL_Error CFWL_ComboBox::SetItemCheckState(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwCheckState) {
+void CFWL_ComboBox::SetItemCheckState(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwCheckState) {
static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState;
- return FWL_Error::Succeeded;
}
FX_FLOAT CFWL_ComboBox::GetListHeight(IFWL_Widget* pWidget) {
diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h
index e2d35d24b5..84864714a5 100644
--- a/xfa/fwl/core/cfwl_combobox.h
+++ b/xfa/fwl/core/cfwl_combobox.h
@@ -76,36 +76,36 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP {
int32_t nIndex) override;
uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override;
- FWL_Error GetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_WideString& wsText) override;
- FWL_Error GetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtItem) override;
+ void GetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_WideString& wsText) override;
+ void GetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtItem) override;
void* GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override;
- FWL_Error SetItemStyles(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwStyle) override;
- FWL_Error SetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const FX_WCHAR* pszText) override;
- FWL_Error SetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtItem) override;
+ void SetItemStyles(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwStyle) override;
+ void SetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) override;
+ void SetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) override;
FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
CFWL_ListItem* pItem) override;
- FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtCheck) override;
- FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) override;
+ void GetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) override;
+ void SetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) override;
uint32_t GetItemCheckState(IFWL_Widget* pWidget,
CFWL_ListItem* pItem) override;
- FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwCheckState) override;
+ void SetItemCheckState(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwCheckState) override;
// IFWL_ComboBoxDP
FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override;
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index a569ad056e..69d2f0ea9a 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -91,23 +91,19 @@ int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) {
return ToListBox(GetWidget())->GetSelIndex(nIndex);
}
-FWL_Error CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
- if (!GetWidget())
- return FWL_Error::Indefinite;
- return ToListBox(GetWidget())->SetSelItem(pItem, bSelect);
+void CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
+ if (GetWidget())
+ ToListBox(GetWidget())->SetSelItem(pItem, bSelect);
}
-FWL_Error CFWL_ListBox::GetItemText(CFWL_ListItem* pItem,
- CFX_WideString& wsText) {
- if (!GetWidget())
- return FWL_Error::Indefinite;
- return ToListBox(GetWidget())->GetItemText(pItem, wsText);
+void CFWL_ListBox::GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText) {
+ if (GetWidget())
+ ToListBox(GetWidget())->GetItemText(pItem, wsText);
}
-FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) {
- if (!GetWidget())
- return FWL_Error::Indefinite;
- return ToListBox(GetWidget())->GetScrollPos(fPos, bVert);
+void CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) {
+ if (GetWidget())
+ ToListBox(GetWidget())->GetScrollPos(fPos, bVert);
}
FWL_Error CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
@@ -242,53 +238,43 @@ uint32_t CFWL_ListBox::GetItemStyles(IFWL_Widget* pWidget,
return static_cast<CFWL_ListItem*>(pItem)->m_dwStates;
}
-FWL_Error CFWL_ListBox::GetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_WideString& wsText) {
- if (!pItem)
- return FWL_Error::Indefinite;
- wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
- return FWL_Error::Succeeded;
+void CFWL_ListBox::GetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_WideString& wsText) {
+ if (pItem)
+ wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
}
-FWL_Error CFWL_ListBox::GetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtItem) {
- if (!pItem)
- return FWL_Error::Indefinite;
- rtItem = static_cast<CFWL_ListItem*>(pItem)->m_rtItem;
- return FWL_Error::Succeeded;
+void CFWL_ListBox::GetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtItem) {
+ if (pItem)
+ rtItem = static_cast<CFWL_ListItem*>(pItem)->m_rtItem;
}
void* CFWL_ListBox::GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) {
return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr;
}
-FWL_Error CFWL_ListBox::SetItemStyles(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwStyle) {
- if (!pItem)
- return FWL_Error::Indefinite;
- static_cast<CFWL_ListItem*>(pItem)->m_dwStates = dwStyle;
- return FWL_Error::Succeeded;
+void CFWL_ListBox::SetItemStyles(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwStyle) {
+ if (pItem)
+ static_cast<CFWL_ListItem*>(pItem)->m_dwStates = dwStyle;
}
-FWL_Error CFWL_ListBox::SetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const FX_WCHAR* pszText) {
- if (!pItem)
- return FWL_Error::Indefinite;
- static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText;
- return FWL_Error::Succeeded;
+void CFWL_ListBox::SetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) {
+ if (pItem)
+ static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText;
}
-FWL_Error CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtItem) {
- if (!pItem)
- return FWL_Error::Indefinite;
- static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem;
- return FWL_Error::Succeeded;
+void CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) {
+ if (pItem)
+ static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem;
}
FX_FLOAT CFWL_ListBox::GetItemHeight(IFWL_Widget* pWidget) {
@@ -300,18 +286,16 @@ CFX_DIBitmap* CFWL_ListBox::GetItemIcon(IFWL_Widget* pWidget,
return static_cast<CFWL_ListItem*>(pItem)->m_pDIB;
}
-FWL_Error CFWL_ListBox::GetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtCheck) {
+void CFWL_ListBox::GetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) {
rtCheck = static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox;
- return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBox::SetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) {
+void CFWL_ListBox::SetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) {
static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox = rtCheck;
- return FWL_Error::Succeeded;
}
uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget,
@@ -319,9 +303,8 @@ uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget,
return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState;
}
-FWL_Error CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwCheckState) {
+void CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwCheckState) {
static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState;
- return FWL_Error::Succeeded;
}
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index e28f8df7bb..ff24e5a308 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -29,9 +29,9 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP {
int32_t CountSelItems();
CFWL_ListItem* GetSelItem(int32_t nIndexSel);
int32_t GetSelIndex(int32_t nIndex);
- FWL_Error SetSelItem(CFWL_ListItem* pItem, bool bSelect = true);
- FWL_Error GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText);
- FWL_Error GetScrollPos(FX_FLOAT& fPos, bool bVert = true);
+ void SetSelItem(CFWL_ListItem* pItem, bool bSelect = true);
+ void GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText);
+ void GetScrollPos(FX_FLOAT& fPos, bool bVert = true);
FWL_Error SetItemHeight(FX_FLOAT fItemHeight);
CFWL_ListItem* GetFocusItem();
FWL_Error SetFocusItem(CFWL_ListItem* pItem);
@@ -56,36 +56,36 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP {
CFWL_ListItem* pItem,
int32_t nIndex) override;
uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override;
- FWL_Error GetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_WideString& wsText) override;
- FWL_Error GetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtItem) override;
+ void GetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_WideString& wsText) override;
+ void GetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtItem) override;
void* GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override;
- FWL_Error SetItemStyles(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwStyle) override;
- FWL_Error SetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const FX_WCHAR* pszText) override;
- FWL_Error SetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtItem) override;
+ void SetItemStyles(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwStyle) override;
+ void SetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) override;
+ void SetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) override;
FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
CFWL_ListItem* pItem) override;
- FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtCheck) override;
- FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) override;
+ void GetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) override;
+ void SetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) override;
uint32_t GetItemCheckState(IFWL_Widget* pWidget,
CFWL_ListItem* pItem) override;
- FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwCheckState) override;
+ void SetItemCheckState(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwCheckState) override;
private:
std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index 1c1f826e92..b0fc9a3a98 100644
--- a/xfa/fwl/core/ifwl_combobox.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -291,7 +291,8 @@ FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText,
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
- return m_pListBox->GetItemText(hItem, wsText);
+ m_pListBox->GetItemText(hItem, wsText);
+ return FWL_Error::Succeeded;
}
return FWL_Error::Indefinite;
}
@@ -508,7 +509,7 @@ void IFWL_ComboBox::ShowDropList(bool bActivate) {
CFWL_EvtCmbPreDropDown ev;
ev.m_pSrcTarget = this;
DispatchEvent(&ev);
- m_fItemHeight = m_pListBox->m_fItemHeight;
+ m_fItemHeight = m_pListBox->GetItemHeight();
m_pListBox->SetFocus(true);
m_pComboBoxProxy->DoModal();
m_pListBox->SetFocus(false);
@@ -741,7 +742,7 @@ void IFWL_ComboBox::DisForm_ShowDropList(bool bActivate) {
}
ReSetListItemAlignment();
pComboList->ChangeSelected(m_iCurSel);
- FX_FLOAT fItemHeight = pComboList->GetItemHeigt();
+ FX_FLOAT fItemHeight = pComboList->CalcItemHeight();
FX_FLOAT fBorder = GetBorderSize();
FX_FLOAT fPopupMin = 0.0f;
if (iItems > 3) {
diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp
index 535ed68d62..d021088ebb 100644
--- a/xfa/fwl/core/ifwl_combolist.cpp
+++ b/xfa/fwl/core/ifwl_combolist.cpp
@@ -103,13 +103,14 @@ void IFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) {
OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus);
} else if (dwHashCode == CFWL_MessageType::Mouse) {
CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
- if (IsShowScrollBar(true) && m_pVertScrollBar) {
+ IFWL_ScrollBar* vertSB = GetVertScrollBar();
+ if (IsShowScrollBar(true) && vertSB) {
CFX_RectF rect;
- m_pVertScrollBar->GetWidgetRect(rect);
+ vertSB->GetWidgetRect(rect);
if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
pMsg->m_fx -= rect.left;
pMsg->m_fy -= rect.top;
- m_pVertScrollBar->GetDelegate()->OnProcessMessage(pMsg);
+ vertSB->GetDelegate()->OnProcessMessage(pMsg);
return;
}
}
@@ -152,13 +153,14 @@ void IFWL_ComboList::OnDropListFocusChanged(CFWL_Message* pMsg, bool bSet) {
}
int32_t IFWL_ComboList::OnDropListMouseMove(CFWL_MsgMouse* pMsg) {
- if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (GetRTClient().Contains(pMsg->m_fx, pMsg->m_fy)) {
if (m_bNotifyOwner) {
m_bNotifyOwner = false;
}
- if (IsShowScrollBar(true) && m_pVertScrollBar) {
+ IFWL_ScrollBar* vertSB = GetVertScrollBar();
+ if (IsShowScrollBar(true) && vertSB) {
CFX_RectF rect;
- m_pVertScrollBar->GetWidgetRect(rect);
+ vertSB->GetWidgetRect(rect);
if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
return 1;
}
@@ -185,7 +187,7 @@ int32_t IFWL_ComboList::OnDropListMouseMove(CFWL_MsgMouse* pMsg) {
}
int32_t IFWL_ComboList::OnDropListLButtonDown(CFWL_MsgMouse* pMsg) {
- if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (GetRTClient().Contains(pMsg->m_fx, pMsg->m_fy))
return 0;
IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter);
@@ -199,9 +201,10 @@ int32_t IFWL_ComboList::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) {
ClientToOuter(pMsg->m_fx, pMsg->m_fy);
pOuter->GetDelegate()->OnProcessMessage(pMsg);
} else {
- if (IsShowScrollBar(true) && m_pVertScrollBar) {
+ IFWL_ScrollBar* vertSB = GetVertScrollBar();
+ if (IsShowScrollBar(true) && vertSB) {
CFX_RectF rect;
- m_pVertScrollBar->GetWidgetRect(rect);
+ vertSB->GetWidgetRect(rect);
if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
return 1;
}
diff --git a/xfa/fwl/core/ifwl_formproxy.h b/xfa/fwl/core/ifwl_formproxy.h
index 3a981df127..b86d609a72 100644
--- a/xfa/fwl/core/ifwl_formproxy.h
+++ b/xfa/fwl/core/ifwl_formproxy.h
@@ -25,9 +25,6 @@ class IFWL_FormProxy : public IFWL_Form {
void DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
-
- protected:
- friend class CFWL_FormProxyImpDelegate;
};
#endif // XFA_FWL_CORE_IFWL_FORMPROXY_H_
diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp
index 9a713c09cd..e468602cdf 100644
--- a/xfa/fwl/core/ifwl_listbox.cpp
+++ b/xfa/fwl/core/ifwl_listbox.cpp
@@ -206,9 +206,9 @@ int32_t IFWL_ListBox::GetSelIndex(int32_t nIndex) {
return -1;
}
-FWL_Error IFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
+void IFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
if (!m_pProperties->m_pDataProvider)
- return FWL_Error::Indefinite;
+ return;
if (!pItem) {
if (bSelect) {
SelectAll();
@@ -216,36 +216,31 @@ FWL_Error IFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
ClearSelection();
SetFocusItem(nullptr);
}
- return FWL_Error::Indefinite;
+ return;
}
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) {
SetSelectionDirect(pItem, bSelect);
} else {
SetSelection(pItem, pItem, bSelect);
}
- return FWL_Error::Succeeded;
}
-FWL_Error IFWL_ListBox::GetItemText(CFWL_ListItem* pItem,
- CFX_WideString& wsText) {
+void IFWL_ListBox::GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText) {
if (!m_pProperties->m_pDataProvider)
- return FWL_Error::Indefinite;
+ return;
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
if (!pItem)
- return FWL_Error::Indefinite;
+ return;
pData->GetItemText(this, pItem, wsText);
- return FWL_Error::Succeeded;
}
-FWL_Error IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) {
+void IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) {
if ((bVert && IsShowScrollBar(true)) || (!bVert && IsShowScrollBar(false))) {
IFWL_ScrollBar* pScrollBar =
bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get();
fPos = pScrollBar->GetPos();
- return FWL_Error::Succeeded;
}
- return FWL_Error::Indefinite;
}
CFWL_ListItem* IFWL_ListBox::GetItem(CFWL_ListItem* pItem, uint32_t dwKeyCode) {
@@ -699,7 +694,7 @@ CFX_SizeF IFWL_ListBox::CalcSize(bool bAutoSize) {
}
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- m_fItemHeight = GetItemHeigt();
+ m_fItemHeight = CalcItemHeight();
if ((GetStylesEx() & FWL_STYLEEXT_LTB_Icon))
fWidth += m_fItemHeight;
@@ -856,7 +851,7 @@ FX_FLOAT IFWL_ListBox::GetScrollWidth() {
return *pfWidth;
}
-FX_FLOAT IFWL_ListBox::GetItemHeigt() {
+FX_FLOAT IFWL_ListBox::CalcItemHeight() {
FX_FLOAT* pfFont =
static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::FontSize));
if (!pfFont)
@@ -873,8 +868,11 @@ void IFWL_ListBox::InitScrollBar(bool bVert) {
prop->m_dwStates = FWL_WGTSTATE_Invisible;
prop->m_pParent = this;
prop->m_pThemeProvider = m_pScrollBarTP;
- (bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)
- ->reset(new IFWL_ScrollBar(m_pOwnerApp, std::move(prop), this));
+ IFWL_ScrollBar* sb = new IFWL_ScrollBar(m_pOwnerApp, std::move(prop), this);
+ if (bVert)
+ m_pVertScrollBar.reset(sb);
+ else
+ m_pHorzScrollBar.reset(sb);
}
bool IFWL_ListBox::IsShowScrollBar(bool bVert) {
diff --git a/xfa/fwl/core/ifwl_listbox.h b/xfa/fwl/core/ifwl_listbox.h
index 195b710ec2..608a7d9372 100644
--- a/xfa/fwl/core/ifwl_listbox.h
+++ b/xfa/fwl/core/ifwl_listbox.h
@@ -60,42 +60,36 @@ class IFWL_ListBoxDP : public IFWL_DataProvider {
int32_t nIndex) = 0;
virtual uint32_t GetItemStyles(IFWL_Widget* pWidget,
CFWL_ListItem* pItem) = 0;
- virtual FWL_Error GetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_WideString& wsText) = 0;
- virtual FWL_Error GetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtItem) = 0;
+ virtual void GetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_WideString& wsText) = 0;
+ virtual void GetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtItem) = 0;
virtual void* GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0;
- virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwStyle) = 0;
- virtual FWL_Error SetItemText(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const FX_WCHAR* pszText) = 0;
- virtual FWL_Error SetItemRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtItem) = 0;
+ virtual void SetItemStyles(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwStyle) = 0;
+ virtual void SetItemText(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) = 0;
+ virtual void SetItemRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) = 0;
virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0;
virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
CFWL_ListItem* pItem) = 0;
- virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_RectF& rtCheck) = 0;
- virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) = 0;
+ virtual void GetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) = 0;
+ virtual void SetItemCheckRect(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) = 0;
virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget,
CFWL_ListItem* pItem) = 0;
- virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- uint32_t dwCheckState) = 0;
-};
-
-class IFWL_ListBoxCompare {
- public:
- virtual ~IFWL_ListBoxCompare() {}
- virtual int32_t Compare(CFWL_ListItem* hLeft, CFWL_ListItem* hRight) = 0;
+ virtual void SetItemCheckState(IFWL_Widget* pWidget,
+ CFWL_ListItem* pItem,
+ uint32_t dwCheckState) = 0;
};
class IFWL_ListBox : public IFWL_Widget {
@@ -121,27 +115,32 @@ class IFWL_ListBox : public IFWL_Widget {
int32_t CountSelItems();
CFWL_ListItem* GetSelItem(int32_t nIndexSel);
int32_t GetSelIndex(int32_t nIndex);
- FWL_Error SetSelItem(CFWL_ListItem* hItem, bool bSelect = true);
- FWL_Error GetItemText(CFWL_ListItem* hItem, CFX_WideString& wsText);
- FWL_Error GetScrollPos(FX_FLOAT& fPos, bool bVert = true);
- FWL_Error* Sort(IFWL_ListBoxCompare* pCom);
+ void SetSelItem(CFWL_ListItem* hItem, bool bSelect = true);
+ void GetItemText(CFWL_ListItem* hItem, CFX_WideString& wsText);
+ void GetScrollPos(FX_FLOAT& fPos, bool bVert = true);
protected:
- friend class CFWL_ListBoxImpDelegate;
-
CFWL_ListItem* GetItem(CFWL_ListItem* hItem, uint32_t dwKeyCode);
void SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected);
+ CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
+ bool ScrollToVisible(CFWL_ListItem* hItem);
+ FX_FLOAT CalcItemHeight();
+ void InitScrollBar(bool bVert = true);
+ bool IsShowScrollBar(bool bVert);
+ FX_FLOAT GetItemHeight() const { return m_fItemHeight; }
+ IFWL_ScrollBar* GetVertScrollBar() const { return m_pVertScrollBar.get(); }
+ const CFX_RectF& GetRTClient() const { return m_rtClient; }
+
+ private:
void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect);
bool IsItemSelected(CFWL_ListItem* hItem);
void ClearSelection();
void SelectAll();
CFWL_ListItem* GetFocusedItem();
void SetFocusItem(CFWL_ListItem* hItem);
- CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
bool GetItemCheckRect(CFWL_ListItem* hItem, CFX_RectF& rtCheck);
bool SetItemChecked(CFWL_ListItem* hItem, bool bChecked);
bool GetItemChecked(CFWL_ListItem* hItem);
- bool ScrollToVisible(CFWL_ListItem* hItem);
void DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix = nullptr);
@@ -163,10 +162,15 @@ class IFWL_ListBox : public IFWL_Widget {
bool bAutoSize = false);
FX_FLOAT GetMaxTextWidth();
FX_FLOAT GetScrollWidth();
- FX_FLOAT GetItemHeigt();
- void InitScrollBar(bool bVert = true);
- bool IsShowScrollBar(bool bVert);
void ProcessSelChanged();
+ void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true);
+ void OnLButtonDown(CFWL_MsgMouse* pMsg);
+ void OnLButtonUp(CFWL_MsgMouse* pMsg);
+ void OnMouseWheel(CFWL_MsgMouseWheel* pMsg);
+ void OnKeyDown(CFWL_MsgKey* pMsg);
+ void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl);
+ bool OnScroll(IFWL_ScrollBar* pScrollBar, FWL_SCBCODE dwCode, FX_FLOAT fPos);
+ void DispatchSelChangedEv();
CFX_RectF m_rtClient;
CFX_RectF m_rtStatic;
@@ -180,16 +184,6 @@ class IFWL_ListBox : public IFWL_Widget {
FX_FLOAT m_fScorllBarWidth;
bool m_bLButtonDown;
IFWL_ThemeProvider* m_pScrollBarTP;
-
- private:
- void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true);
- void OnLButtonDown(CFWL_MsgMouse* pMsg);
- void OnLButtonUp(CFWL_MsgMouse* pMsg);
- void OnMouseWheel(CFWL_MsgMouseWheel* pMsg);
- void OnKeyDown(CFWL_MsgKey* pMsg);
- void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl);
- bool OnScroll(IFWL_ScrollBar* pScrollBar, FWL_SCBCODE dwCode, FX_FLOAT fPos);
- void DispatchSelChangedEv();
};
#endif // XFA_FWL_CORE_IFWL_LISTBOX_H_
diff --git a/xfa/fwl/core/ifwl_picturebox.cpp b/xfa/fwl/core/ifwl_picturebox.cpp
index 17a87ed835..b7a4c61118 100644
--- a/xfa/fwl/core/ifwl_picturebox.cpp
+++ b/xfa/fwl/core/ifwl_picturebox.cpp
@@ -13,10 +13,7 @@
IFWL_PictureBox::IFWL_PictureBox(
const IFWL_App* app,
std::unique_ptr<CFWL_WidgetProperties> properties)
- : IFWL_Widget(app, std::move(properties), nullptr),
- m_bTop(false),
- m_bVCenter(false),
- m_bButton(false) {
+ : IFWL_Widget(app, std::move(properties), nullptr) {
m_rtClient.Reset();
m_rtImage.Reset();
m_matrix.SetIdentity();
@@ -100,21 +97,6 @@ void IFWL_PictureBox::DrawBkground(CFX_Graphics* pGraphics,
&matrix);
}
-bool IFWL_PictureBox::VStyle(uint32_t dwStyle) {
- switch (dwStyle & FWL_STYLEEXT_PTB_VAlignMask) {
- case FWL_STYLEEXT_PTB_Top:
- m_bTop = true;
- return true;
- case FWL_STYLEEXT_PTB_Vcenter:
- m_bVCenter = true;
- return true;
- case FWL_STYLEEXT_PTB_Bottom:
- m_bButton = true;
- return true;
- }
- return false;
-}
-
void IFWL_PictureBox::OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
DrawWidget(pGraphics, pMatrix);
diff --git a/xfa/fwl/core/ifwl_picturebox.h b/xfa/fwl/core/ifwl_picturebox.h
index 3aab27d02a..55eabcb523 100644
--- a/xfa/fwl/core/ifwl_picturebox.h
+++ b/xfa/fwl/core/ifwl_picturebox.h
@@ -8,7 +8,6 @@
#define XFA_FWL_CORE_IFWL_PICTUREBOX_H_
#include "xfa/fwl/core/cfwl_widgetproperties.h"
-#include "xfa/fwl/core/fwl_error.h"
#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/ifwl_widget.h"
@@ -55,18 +54,14 @@ class IFWL_PictureBox : public IFWL_Widget {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) override;
- protected:
+ private:
void DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix = nullptr);
- bool VStyle(uint32_t dwStyle);
CFX_RectF m_rtClient;
CFX_RectF m_rtImage;
CFX_Matrix m_matrix;
- bool m_bTop;
- bool m_bVCenter;
- bool m_bButton;
};
#endif // XFA_FWL_CORE_IFWL_PICTUREBOX_H_
diff --git a/xfa/fwl/core/ifwl_pushbutton.cpp b/xfa/fwl/core/ifwl_pushbutton.cpp
index da36e71b01..0b3b574743 100644
--- a/xfa/fwl/core/ifwl_pushbutton.cpp
+++ b/xfa/fwl/core/ifwl_pushbutton.cpp
@@ -369,7 +369,8 @@ void IFWL_PushButton::UpdateTextOutStyles() {
m_iTTOAlign = FDE_TTOALIGNMENT_BottomRight;
break;
}
- default: {}
+ default:
+ break;
}
m_dwTTOStyles = FDE_TTOSTYLE_SingleLine;
if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) {
diff --git a/xfa/fwl/core/ifwl_pushbutton.h b/xfa/fwl/core/ifwl_pushbutton.h
index 6fb81f0811..d717997c18 100644
--- a/xfa/fwl/core/ifwl_pushbutton.h
+++ b/xfa/fwl/core/ifwl_pushbutton.h
@@ -53,7 +53,7 @@ class IFWL_PushButton : public IFWL_Widget {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) override;
- protected:
+ private:
void DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
@@ -62,20 +62,18 @@ class IFWL_PushButton : public IFWL_Widget {
const CFX_Matrix* pMatrix);
uint32_t GetPartStates();
void UpdateTextOutStyles();
-
- CFX_RectF m_rtClient;
- CFX_RectF m_rtCaption;
- bool m_bBtnDown;
- uint32_t m_dwTTOStyles;
- int32_t m_iTTOAlign;
-
- private:
void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
void OnLButtonDown(CFWL_MsgMouse* pMsg);
void OnLButtonUp(CFWL_MsgMouse* pMsg);
void OnMouseMove(CFWL_MsgMouse* pMsg);
void OnMouseLeave(CFWL_MsgMouse* pMsg);
void OnKeyDown(CFWL_MsgKey* pMsg);
+
+ CFX_RectF m_rtClient;
+ CFX_RectF m_rtCaption;
+ bool m_bBtnDown;
+ uint32_t m_dwTTOStyles;
+ int32_t m_iTTOAlign;
};
#endif // XFA_FWL_CORE_IFWL_PUSHBUTTON_H_