summaryrefslogtreecommitdiff
path: root/xfa/fwl/core
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-10 14:22:06 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-10 14:22:06 -0800
commita0d3231037816d3f0e377e9c57a2bfaa1372e151 (patch)
tree444a472a55b389902eaffe8b1ef1f2d02f134b2a /xfa/fwl/core
parent522c3d414e26a8a6b14407d664cee38fa3f52c07 (diff)
downloadpdfium-a0d3231037816d3f0e377e9c57a2bfaa1372e151.tar.xz
Remove IFWL methods proxied from CFWL classeschromium/2916
This CL removes a few methods from IFWL that are around just to proxy from CFWL methods which are, in turn, never called. Review-Url: https://codereview.chromium.org/2486333004
Diffstat (limited to 'xfa/fwl/core')
-rw-r--r--xfa/fwl/core/cfwl_listbox.cpp80
-rw-r--r--xfa/fwl/core/cfwl_listbox.h42
-rw-r--r--xfa/fwl/core/cfwl_widget.cpp10
-rw-r--r--xfa/fwl/core/cfwl_widget.h2
-rw-r--r--xfa/fwl/core/ifwl_widget.cpp13
-rw-r--r--xfa/fwl/core/ifwl_widget.h1
6 files changed, 20 insertions, 128 deletions
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index 69d2f0ea9a..9267f59e6f 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -32,11 +32,6 @@ void CFWL_ListBox::Initialize() {
CFWL_Widget::Initialize();
}
-FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, CFWL_ListItem* pItem) {
- static_cast<CFWL_ListItem*>(pItem)->m_pDIB = pDIB;
- return FWL_Error::Succeeded;
-}
-
CFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd,
bool bSelect) {
std::unique_ptr<CFWL_ListItem> pItem(new CFWL_ListItem);
@@ -106,25 +101,6 @@ void CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) {
ToListBox(GetWidget())->GetScrollPos(fPos, bVert);
}
-FWL_Error CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
- m_fItemHeight = fItemHeight;
- return FWL_Error::Succeeded;
-}
-
-CFWL_ListItem* CFWL_ListBox::GetFocusItem() {
- for (const auto& pItem : m_ItemArray) {
- if (pItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused)
- return pItem.get();
- }
- return nullptr;
-}
-
-FWL_Error CFWL_ListBox::SetFocusItem(CFWL_ListItem* pItem) {
- int32_t nIndex = GetItemIndex(GetWidget(), pItem);
- m_ItemArray[nIndex]->m_dwStates |= FWL_ITEMSTATE_LTB_Focused;
- return FWL_Error::Succeeded;
-}
-
int32_t CFWL_ListBox::CountItems() {
return pdfium::CollectionSize<int32_t>(m_ItemArray);
}
@@ -136,58 +112,6 @@ CFWL_ListItem* CFWL_ListBox::GetItem(int32_t nIndex) {
return m_ItemArray[nIndex].get();
}
-FWL_Error CFWL_ListBox::SetItemString(CFWL_ListItem* pItem,
- const CFX_WideStringC& wsText) {
- if (!pItem)
- return FWL_Error::Indefinite;
- static_cast<CFWL_ListItem*>(pItem)->m_wsText = wsText;
- return FWL_Error::Succeeded;
-}
-
-FWL_Error CFWL_ListBox::GetItemString(CFWL_ListItem* pItem,
- CFX_WideString& wsText) {
- if (!pItem)
- return FWL_Error::Indefinite;
- wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
- return FWL_Error::Succeeded;
-}
-
-FWL_Error CFWL_ListBox::SetItemData(CFWL_ListItem* pItem, void* pData) {
- if (!pItem)
- return FWL_Error::Indefinite;
- static_cast<CFWL_ListItem*>(pItem)->m_pData = pData;
- return FWL_Error::Succeeded;
-}
-
-void* CFWL_ListBox::GetItemData(CFWL_ListItem* pItem) {
- return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr;
-}
-
-CFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtClient;
- GetWidget()->GetClientRect(rtClient);
- fx -= rtClient.left;
- fy -= rtClient.top;
- FX_FLOAT fPosX = 0;
- FX_FLOAT fPosY = 0;
- ToListBox(GetWidget())->GetScrollPos(fx);
- ToListBox(GetWidget())->GetScrollPos(fy, false);
- int32_t nCount = CountItems(nullptr);
- for (int32_t i = 0; i < nCount; i++) {
- CFWL_ListItem* pItem = GetItem(nullptr, i);
- if (!pItem) {
- continue;
- }
- CFX_RectF rtItem;
- GetItemRect(nullptr, pItem, rtItem);
- rtItem.Offset(-fPosX, -fPosY);
- if (rtItem.Contains(fx, fy)) {
- return pItem;
- }
- }
- return nullptr;
-}
-
uint32_t CFWL_ListBox::GetItemStates(CFWL_ListItem* pItem) {
if (!pItem)
return 0;
@@ -197,7 +121,7 @@ uint32_t CFWL_ListBox::GetItemStates(CFWL_ListItem* pItem) {
FWL_Error CFWL_ListBox::GetCaption(IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
- wsCaption = m_wsData;
+ wsCaption = L"";
return FWL_Error::Succeeded;
}
@@ -278,7 +202,7 @@ void CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget,
}
FX_FLOAT CFWL_ListBox::GetItemHeight(IFWL_Widget* pWidget) {
- return m_fItemHeight;
+ return 20;
}
CFX_DIBitmap* CFWL_ListBox::GetItemIcon(IFWL_Widget* pWidget,
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index ff24e5a308..901f77e894 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -22,28 +22,6 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP {
void Initialize();
- FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, CFWL_ListItem* pItem);
- CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, bool bSelect = false);
- bool DeleteString(CFWL_ListItem* pItem);
- void DeleteAll();
- int32_t CountSelItems();
- CFWL_ListItem* GetSelItem(int32_t nIndexSel);
- int32_t GetSelIndex(int32_t nIndex);
- 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);
- int32_t CountItems();
- CFWL_ListItem* GetItem(int32_t nIndex);
- FWL_Error SetItemString(CFWL_ListItem* pItem, const CFX_WideStringC& wsText);
- FWL_Error GetItemString(CFWL_ListItem* pItem, CFX_WideString& wsText);
- FWL_Error SetItemData(CFWL_ListItem* pItem, void* pData);
- void* GetItemData(CFWL_ListItem* pItem);
- CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
- uint32_t GetItemStates(CFWL_ListItem* pItem);
-
// IFWL_DataProvider:
FWL_Error GetCaption(IFWL_Widget* pWidget,
CFX_WideString& wsCaption) override;
@@ -87,10 +65,26 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP {
CFWL_ListItem* pItem,
uint32_t dwCheckState) override;
+ CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, bool bSelect = false);
+ bool DeleteString(CFWL_ListItem* pItem);
+ void DeleteAll();
+
+ int32_t CountSelItems();
+
+ void SetSelItem(CFWL_ListItem* pItem, bool bSelect = true);
+ CFWL_ListItem* GetSelItem(int32_t nIndexSel);
+ int32_t GetSelIndex(int32_t nIndex);
+
+ void GetScrollPos(FX_FLOAT& fPos, bool bVert = true);
+
+ CFWL_ListItem* GetItem(int32_t nIndex);
+ void GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText);
+ uint32_t GetItemStates(CFWL_ListItem* pItem);
+
private:
+ int32_t CountItems();
+
std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
- CFX_WideString m_wsData;
- FX_FLOAT m_fItemHeight;
};
#endif // XFA_FWL_CORE_CFWL_LISTBOX_H_
diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp
index 1dbe4451c7..5ea5aebead 100644
--- a/xfa/fwl/core/cfwl_widget.cpp
+++ b/xfa/fwl/core/cfwl_widget.cpp
@@ -43,21 +43,11 @@ void CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
m_pIface->GetWidgetRect(rect, bAutoSize);
}
-void CFWL_Widget::GetGlobalRect(CFX_RectF& rect) {
- if (m_pIface)
- m_pIface->GetGlobalRect(rect);
-}
-
void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
if (m_pIface)
m_pIface->SetWidgetRect(rect);
}
-void CFWL_Widget::GetClientRect(CFX_RectF& rect) {
- if (m_pIface)
- m_pIface->GetClientRect(rect);
-}
-
void CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded,
uint32_t dwStylesRemoved) {
if (m_pIface)
diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h
index d41de2694d..a4a0e94c1d 100644
--- a/xfa/fwl/core/cfwl_widget.h
+++ b/xfa/fwl/core/cfwl_widget.h
@@ -28,8 +28,6 @@ class CFWL_Widget {
void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false);
void SetWidgetRect(const CFX_RectF& rect);
- void GetGlobalRect(CFX_RectF& rect);
- void GetClientRect(CFX_RectF& rtClient);
void ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved);
uint32_t GetStylesEx();
diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp
index 1399799668..0768f38915 100644
--- a/xfa/fwl/core/ifwl_widget.cpp
+++ b/xfa/fwl/core/ifwl_widget.cpp
@@ -75,19 +75,6 @@ void IFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
}
}
-void IFWL_Widget::GetGlobalRect(CFX_RectF& rect) {
- IFWL_Widget* pForm = m_pWidgetMgr->GetSystemFormWidget(this);
- if (!pForm)
- return;
-
- rect.Set(0, 0, m_pProperties->m_rtWidget.width,
- m_pProperties->m_rtWidget.height);
- if (pForm == this)
- return;
-
- TransformTo(pForm, rect.left, rect.top);
-}
-
void IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
CFX_RectF rtOld = m_pProperties->m_rtWidget;
m_pProperties->m_rtWidget = rect;
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index 2792951b36..d1284b1c92 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -88,7 +88,6 @@ class IFWL_Widget : public IFWL_WidgetDelegate {
const CFX_Matrix* pMatrix = nullptr) override;
void SetWidgetRect(const CFX_RectF& rect);
- void GetGlobalRect(CFX_RectF& rect);
void SetParent(IFWL_Widget* pParent);