summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-12-14 12:54:30 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-14 12:54:30 -0800
commitbe5f0297256ba3c597dd32eb7eefef57fbd8e201 (patch)
tree8081390047955a1c97fb55680d7e633c284c3cc4 /xfa/fwl
parentf085db37c21ad2bd66e349f9307fc89b426217f5 (diff)
downloadpdfium-be5f0297256ba3c597dd32eb7eefef57fbd8e201.tar.xz
Remove unused CFWL_ListBox code
This CL removes states and settings from the CFWL_ListBox code which were never enabled. Review-Url: https://codereview.chromium.org/2576483002
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/cfwl_combobox.cpp2
-rw-r--r--xfa/fwl/cfwl_combobox.h1
-rw-r--r--xfa/fwl/cfwl_listbox.cpp122
-rw-r--r--xfa/fwl/cfwl_listbox.h9
-rw-r--r--xfa/fwl/cfwl_listitem.cpp3
-rw-r--r--xfa/fwl/cfwl_listitem.h19
6 files changed, 22 insertions, 134 deletions
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index 8567e68dff..f7b10475c1 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -50,8 +50,6 @@ CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app)
auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>();
prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
prop->m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText)
- prop->m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon;
m_pListBox =
pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp, std::move(prop), this);
diff --git a/xfa/fwl/cfwl_combobox.h b/xfa/fwl/cfwl_combobox.h
index 3faa1cc8d6..491b360752 100644
--- a/xfa/fwl/cfwl_combobox.h
+++ b/xfa/fwl/cfwl_combobox.h
@@ -44,7 +44,6 @@ class CFWL_Widget;
#define FWL_STYLEEXT_CMB_ListItemRightAlign (2L << 10)
#define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 10)
#define FWL_STYLEEXT_CMB_ListItemText (0L << 12)
-#define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12)
#define FWL_STYLEEXT_CMB_ReadOnly (1L << 13)
class CFWL_ComboBox : public CFWL_Widget {
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index e3aebcc2f2..ca000f33d0 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -136,7 +136,7 @@ int32_t CFWL_ListBox::CountSelItems() {
CFWL_ListItem* pItem = GetItem(this, i);
if (!pItem)
continue;
- if (pItem->GetStyles() & FWL_ITEMSTATE_LTB_Selected)
+ if (pItem->GetStates() & FWL_ITEMSTATE_LTB_Selected)
iRet++;
}
return iRet;
@@ -156,7 +156,7 @@ int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) {
CFWL_ListItem* pItem = GetItem(this, i);
if (!pItem)
return -1;
- if (pItem->GetStyles() & FWL_ITEMSTATE_LTB_Selected) {
+ if (pItem->GetStates() & FWL_ITEMSTATE_LTB_Selected) {
if (index == nIndex)
return i;
index++;
@@ -242,10 +242,10 @@ void CFWL_ListBox::SetSelectionDirect(CFWL_ListItem* pItem, bool bSelect) {
if (!pItem)
return;
- uint32_t dwOldStyle = pItem->GetStyles();
+ uint32_t dwOldStyle = pItem->GetStates();
bSelect ? dwOldStyle |= FWL_ITEMSTATE_LTB_Selected
: dwOldStyle &= ~FWL_ITEMSTATE_LTB_Selected;
- pItem->SetStyles(dwOldStyle);
+ pItem->SetStates(dwOldStyle);
}
bool CFWL_ListBox::IsMultiSelection() const {
@@ -253,7 +253,7 @@ bool CFWL_ListBox::IsMultiSelection() const {
}
bool CFWL_ListBox::IsItemSelected(CFWL_ListItem* pItem) {
- return pItem && (pItem->GetStyles() & FWL_ITEMSTATE_LTB_Selected) != 0;
+ return pItem && (pItem->GetStates() & FWL_ITEMSTATE_LTB_Selected) != 0;
}
void CFWL_ListBox::ClearSelection() {
@@ -263,7 +263,7 @@ void CFWL_ListBox::ClearSelection() {
CFWL_ListItem* pItem = GetItem(this, i);
if (!pItem)
continue;
- if (!(pItem->GetStyles() & FWL_ITEMSTATE_LTB_Selected))
+ if (!(pItem->GetStates() & FWL_ITEMSTATE_LTB_Selected))
continue;
SetSelectionDirect(pItem, false);
if (!bMulti)
@@ -290,7 +290,7 @@ CFWL_ListItem* CFWL_ListBox::GetFocusedItem() {
CFWL_ListItem* pItem = GetItem(this, i);
if (!pItem)
return nullptr;
- if (pItem->GetStyles() & FWL_ITEMSTATE_LTB_Focused)
+ if (pItem->GetStates() & FWL_ITEMSTATE_LTB_Focused)
return pItem;
}
return nullptr;
@@ -302,14 +302,14 @@ void CFWL_ListBox::SetFocusItem(CFWL_ListItem* pItem) {
return;
if (hFocus) {
- uint32_t dwStyle = hFocus->GetStyles();
+ uint32_t dwStyle = hFocus->GetStates();
dwStyle &= ~FWL_ITEMSTATE_LTB_Focused;
- hFocus->SetStyles(dwStyle);
+ hFocus->SetStates(dwStyle);
}
if (pItem) {
- uint32_t dwStyle = pItem->GetStyles();
+ uint32_t dwStyle = pItem->GetStates();
dwStyle |= FWL_ITEMSTATE_LTB_Focused;
- pItem->SetStyles(dwStyle);
+ pItem->SetStates(dwStyle);
}
}
@@ -337,20 +337,6 @@ CFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
return nullptr;
}
-bool CFWL_ListBox::GetItemChecked(CFWL_ListItem* pItem) {
- if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check))
- return false;
- return !!(pItem->GetCheckState() & FWL_ITEMSTATE_LTB_Checked);
-}
-
-bool CFWL_ListBox::SetItemChecked(CFWL_ListItem* pItem, bool bChecked) {
- if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check))
- return false;
-
- pItem->SetCheckState(bChecked ? FWL_ITEMSTATE_LTB_Checked : 0);
- return true;
-}
-
bool CFWL_ListBox::ScrollToVisible(CFWL_ListItem* pItem) {
if (!m_pVertScrollBar)
return false;
@@ -415,8 +401,6 @@ void CFWL_ListBox::DrawItems(CFX_Graphics* pGraphics,
if (m_pVertScrollBar)
rtView.width -= m_fScorllBarWidth;
- bool bMultiCol =
- !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn);
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
CFWL_ListItem* pItem = GetItem(this, i);
@@ -429,11 +413,7 @@ void CFWL_ListBox::DrawItems(CFX_Graphics* pGraphics,
continue;
if (rtItem.top >= m_rtConent.bottom())
break;
- if (bMultiCol && rtItem.left > m_rtConent.right())
- break;
-
- if (!(GetStylesEx() & FWL_STYLEEXT_LTB_OwnerDraw))
- DrawItem(pGraphics, pTheme, pItem, i, rtItem, pMatrix);
+ DrawItem(pGraphics, pTheme, pItem, i, rtItem, pMatrix);
}
}
@@ -443,7 +423,7 @@ void CFWL_ListBox::DrawItem(CFX_Graphics* pGraphics,
int32_t Index,
const CFX_RectF& rtItem,
const CFX_Matrix* pMatrix) {
- uint32_t dwItemStyles = pItem ? pItem->GetStyles() : 0;
+ uint32_t dwItemStyles = pItem ? pItem->GetStates() : 0;
uint32_t dwPartStates = CFWL_PartState_Normal;
if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)
dwPartStates = CFWL_PartState_Disabled;
@@ -473,45 +453,6 @@ void CFWL_ListBox::DrawItem(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&bg_param);
- bool bHasIcon = !!(GetStylesEx() & FWL_STYLEEXT_LTB_Icon);
- if (bHasIcon) {
- CFX_RectF rtDIB;
- CFX_DIBitmap* pDib = pItem->GetIcon();
- rtDIB.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height);
- if (pDib) {
- CFWL_ThemeBackground param;
- param.m_pWidget = this;
- param.m_iPart = CFWL_Part::Icon;
- param.m_pGraphics = pGraphics;
- param.m_matrix.Concat(*pMatrix);
- param.m_rtPart = rtDIB;
- param.m_bMaximize = true;
- param.m_pImage = pDib;
- pTheme->DrawBackground(&param);
- }
- }
-
- bool bHasCheck = !!(GetStylesEx() & FWL_STYLEEXT_LTB_Check);
- if (bHasCheck) {
- CFX_RectF rtCheck;
- rtCheck.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height);
- rtCheck.Deflate(2, 2, 2, 2);
- pItem->SetCheckRect(rtCheck);
-
- CFWL_ThemeBackground param;
- param.m_pWidget = this;
- param.m_iPart = CFWL_Part::Check;
- param.m_pGraphics = pGraphics;
- if (GetItemChecked(pItem))
- param.m_dwStates = CFWL_PartState_Checked;
- else
- param.m_dwStates = CFWL_PartState_Normal;
- param.m_matrix.Concat(*pMatrix);
- param.m_rtPart = rtCheck;
- param.m_bMaximize = true;
- pTheme->DrawBackground(&param);
- }
-
if (!pItem)
return;
@@ -521,8 +462,6 @@ void CFWL_ListBox::DrawItem(CFX_Graphics* pGraphics,
CFX_RectF rtText(rtItem);
rtText.Deflate(kItemTextMargin, kItemTextMargin);
- if (bHasIcon || bHasCheck)
- rtText.Deflate(rtItem.height, 0, 0, 0);
CFWL_ThemeText textParam;
textParam.m_pWidget = this;
@@ -562,10 +501,7 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) {
m_rtClient.width - rtUIMargin.left - rtUIMargin.width;
fWidth = std::max(fWidth, fActualWidth);
}
-
m_fItemHeight = CalcItemHeight();
- if ((GetStylesEx() & FWL_STYLEEXT_LTB_Icon))
- fWidth += m_fItemHeight;
int32_t iCount = CountItems(this);
CFX_SizeF fs;
@@ -578,17 +514,11 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) {
FX_FLOAT iWidth = m_rtClient.width - rtUIMargin.left - rtUIMargin.width;
FX_FLOAT iHeight = m_rtClient.height;
- bool bShowVertScr =
- (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarAlaways) &&
- (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll);
- bool bShowHorzScr =
- (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarAlaways) &&
- (m_pProperties->m_dwStyles & FWL_WGTSTYLE_HScroll);
- if (!bShowVertScr && m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll &&
- (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn) == 0) {
+ bool bShowVertScr = false;
+ bool bShowHorzScr = false;
+ if (!bShowVertScr && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll))
bShowVertScr = (fs.y > iHeight);
- }
- if (!bShowHorzScr && m_pProperties->m_dwStyles & FWL_WGTSTYLE_HScroll)
+ if (!bShowHorzScr && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_HScroll))
bShowHorzScr = (fs.x > iWidth);
CFX_SizeF szRange;
@@ -669,9 +599,6 @@ void CFWL_ListBox::UpdateItemSize(CFWL_ListItem* pItem,
FX_FLOAT fWidth,
FX_FLOAT fItemHeight,
bool bAutoSize) const {
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn)
- return;
-
if (!bAutoSize && pItem) {
CFX_RectF rtItem;
rtItem.Set(0, size.y, fWidth, fItemHeight);
@@ -859,18 +786,7 @@ void CFWL_ListBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
} else {
SetSelection(pItem, pItem, true);
}
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check) {
- CFWL_ListItem* hSelectedItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
- CFX_RectF rtCheck;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)
- rtCheck = hSelectedItem->GetCheckRect();
-
- bool bChecked = GetItemChecked(pItem);
- if (rtCheck.Contains(pMsg->m_fx, pMsg->m_fy)) {
- SetItemChecked(pItem, !bChecked);
- Update();
- }
- }
+
SetFocusItem(pItem);
ScrollToVisible(pItem);
SetGrab(true);
@@ -1036,7 +952,7 @@ void CFWL_ListBox::DeleteString(CFWL_ListItem* pItem) {
iSel = nIndex - 1;
if (iSel >= 0) {
if (CFWL_ListItem* item = GetItem(this, iSel))
- item->SetStyles(item->GetStyles() | FWL_ITEMSTATE_LTB_Selected);
+ item->SetStates(item->GetStates() | FWL_ITEMSTATE_LTB_Selected);
}
m_ItemArray.erase(m_ItemArray.begin() + nIndex);
diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h
index 8ef1579859..c46108b9d6 100644
--- a/xfa/fwl/cfwl_listbox.h
+++ b/xfa/fwl/cfwl_listbox.h
@@ -18,20 +18,13 @@
#include "xfa/fwl/cfwl_widgetproperties.h"
#define FWL_STYLEEXT_LTB_MultiSelection (1L << 0)
-#define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2)
-#define FWL_STYLEEXT_LTB_MultiColumn (1L << 3)
#define FWL_STYLEEXT_LTB_LeftAlign (0L << 4)
#define FWL_STYLEEXT_LTB_CenterAlign (1L << 4)
#define FWL_STYLEEXT_LTB_RightAlign (2L << 4)
-#define FWL_STYLEEXT_LTB_MultiLine (1L << 6)
-#define FWL_STYLEEXT_LTB_OwnerDraw (1L << 7)
-#define FWL_STYLEEXT_LTB_Icon (1L << 8)
-#define FWL_STYLEEXT_LTB_Check (1L << 9)
#define FWL_STYLEEXT_LTB_AlignMask (3L << 4)
#define FWL_STYLEEXT_LTB_ShowScrollBarFocus (1L << 10)
#define FWL_ITEMSTATE_LTB_Selected (1L << 0)
#define FWL_ITEMSTATE_LTB_Focused (1L << 1)
-#define FWL_ITEMSTATE_LTB_Checked (1L << 2)
class CFWL_MessageKillFocus;
class CFWL_MessageMouse;
@@ -93,8 +86,6 @@ class CFWL_ListBox : public CFWL_Widget {
void SelectAll();
CFWL_ListItem* GetFocusedItem();
void SetFocusItem(CFWL_ListItem* hItem);
- bool SetItemChecked(CFWL_ListItem* hItem, bool bChecked);
- bool GetItemChecked(CFWL_ListItem* hItem);
void DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
diff --git a/xfa/fwl/cfwl_listitem.cpp b/xfa/fwl/cfwl_listitem.cpp
index 049548a1f5..a8ea8a6452 100644
--- a/xfa/fwl/cfwl_listitem.cpp
+++ b/xfa/fwl/cfwl_listitem.cpp
@@ -7,8 +7,7 @@
#include "xfa/fwl/cfwl_listitem.h"
CFWL_ListItem::CFWL_ListItem(const CFX_WideString& text)
- : m_dwStates(0), m_wsText(text), m_pDIB(nullptr), m_dwCheckState(0) {
- m_rtCheckBox.Reset();
+ : m_dwStates(0), m_wsText(text) {
m_rtItem.Reset();
}
diff --git a/xfa/fwl/cfwl_listitem.h b/xfa/fwl/cfwl_listitem.h
index c4af1d89b5..aac67fcb51 100644
--- a/xfa/fwl/cfwl_listitem.h
+++ b/xfa/fwl/cfwl_listitem.h
@@ -10,8 +10,6 @@
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
-class CFX_DIBitmap;
-
class CFWL_ListItem {
public:
explicit CFWL_ListItem(const CFX_WideString& text);
@@ -20,18 +18,8 @@ class CFWL_ListItem {
CFX_RectF GetRect() const { return m_rtItem; }
void SetRect(const CFX_RectF& rect) { m_rtItem = rect; }
- uint32_t GetStyles() const { return m_dwStates; }
- void SetStyles(uint32_t dwStyle) { m_dwStates = dwStyle; }
-
- CFX_RectF GetCheckRect() const { return m_rtCheckBox; }
- void SetCheckRect(const CFX_RectF& rtCheck) { m_rtCheckBox = rtCheck; }
-
- uint32_t GetStates() const { return GetStyles() | GetCheckState(); }
-
- uint32_t GetCheckState() const { return m_dwCheckState; }
- void SetCheckState(uint32_t dwCheckState) { m_dwCheckState = dwCheckState; }
-
- CFX_DIBitmap* GetIcon() const { return m_pDIB; }
+ uint32_t GetStates() const { return m_dwStates; }
+ void SetStates(uint32_t dwStates) { m_dwStates = dwStates; }
CFX_WideString GetText() const { return m_wsText; }
@@ -39,9 +27,6 @@ class CFWL_ListItem {
CFX_RectF m_rtItem;
uint32_t m_dwStates;
CFX_WideString m_wsText;
- CFX_DIBitmap* m_pDIB;
- uint32_t m_dwCheckState;
- CFX_RectF m_rtCheckBox;
};
#endif // XFA_FWL_CFWL_LISTITEM_H_