7#include "fpdfsdk/pwl/cpwl_list_box.h"
12#include "core/fxge/cfx_renderdevice.h"
13#include "fpdfsdk/pwl/cpwl_edit.h"
14#include "fpdfsdk/pwl/cpwl_edit_impl.h"
15#include "fpdfsdk/pwl/cpwl_scroll_bar.h"
16#include "fpdfsdk/pwl/ipwl_fillernotify.h"
17#include "public/fpdf_fwlevent.h"
18#include "third_party/base/numerics/safe_conversions.h"
22 std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData)
29 m_pListCtrl->SetFontMap(GetFontMap());
30 m_pListCtrl->SetNotify(
this);
34 m_pListCtrl->SetFontSize(GetCreationParams()->fFontSize);
42 m_pListCtrl->SetNotify(
nullptr);
53 for (int32_t i = 0, sz = m_pListCtrl->GetCount(); i < sz; i++) {
58 CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
66 if (m_pListCtrl->IsItemSelected(i)) {
68 m_pListCtrl->GetItemEdit(i)->DrawEdit(
69 pDevice, mtUser2Device, GetTextColor().ToFXColor(255), rcList,
70 ptOffset,
nullptr, pSysHandler, GetAttachedData());
75 m_pListCtrl->GetItemEdit(i)->DrawEdit(
76 pDevice, mtUser2Device, ArgbEncode(255, 255, 255, 255), rcList,
77 ptOffset,
nullptr, pSysHandler, GetAttachedData());
80 m_pListCtrl->GetItemEdit(i)->DrawEdit(
81 pDevice, mtUser2Device, GetTextColor().ToFXColor(255), rcList,
82 ptOffset,
nullptr, pSysHandler,
nullptr);
104 m_pListCtrl->OnVK_UP(IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag));
107 m_pListCtrl->OnVK_DOWN(IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag));
110 m_pListCtrl->OnVK_HOME(IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag));
113 m_pListCtrl->OnVK_LEFT(IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag));
116 m_pListCtrl->OnVK_END(IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag));
119 m_pListCtrl->OnVK_RIGHT(IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag));
131 if (!m_pListCtrl->OnChar(nChar, IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag)))
139 const CFX_PointF& point) {
147 m_pListCtrl->OnMouseDown(point, IsSHIFTKeyDown(nFlag),
148 IsCTRLKeyDown(nFlag));
155 const CFX_PointF& point) {
171 const CFX_PointF& point) {
174 if (m_bHoverSel && !IsCaptureMouse() && ClientHitTest(point))
175 m_pListCtrl->Select(m_pListCtrl->GetItemIndex(point));
177 m_pListCtrl->OnMouseMove(point, IsSHIFTKeyDown(nFlag),
178 IsCTRLKeyDown(nFlag));
194 m_pListCtrl->SetScrollPos(CFX_PointF(0, pos));
202 m_pListCtrl->SetPlateRect(GetListRect());
207 Mask<FWL_EVENTFLAG> nFlag) {
208 ObservedPtr<
CPWL_Wnd> this_observed(
this);
211 WideString strChangeEx;
213 int nSelEnd = pdfium::base::checked_cast<
int>(swChange.GetLength());
216 strChangeEx, nSelStart, nSelEnd,
219 if (!this_observed) {
226 if (m_pListCtrl->IsMultipleSel()) {
227 CFX_FloatRect rcCaret = m_pListCtrl->GetItemRect(m_pListCtrl->GetCaret());
236 m_pListCtrl->AddString(str);
240 return m_pListCtrl->GetText();
244 m_pListCtrl->SetFontSize(fFontSize);
248 return m_pListCtrl->GetFontSize();
292 m_pListCtrl->Select(nItemIndex);
296 m_pListCtrl->Deselect(nItemIndex);
300 m_pListCtrl->SetCaret(nItemIndex);
304 m_pListCtrl->SetTopItem(nItemIndex);
308 m_pListCtrl->ScrollToListItem(nItemIndex);
312 return m_pListCtrl->IsMultipleSel();
316 return m_pListCtrl->GetCaret();
320 return m_pListCtrl->GetSelect();
324 return m_pListCtrl->IsItemSelected(nItemIndex);
328 m_pListCtrl->ScrollToListItem(m_pListCtrl->GetFirstSelected());
329 return m_pListCtrl->GetTopItem();
333 return m_pListCtrl->GetCount();
337 return m_pListCtrl->GetContentRect();
341 return m_pListCtrl->GetFirstHeight();
350 const CFX_PointF& point,
351 const CFX_Vector& delta) {
353 m_pListCtrl->OnVK_DOWN(IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag));
355 m_pListCtrl->OnVK_UP(IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag));
void Intersect(const CFX_FloatRect &other_rect)
void DrawFillRect(const CFX_Matrix *pUser2Device, const CFX_FloatRect &rect, const FX_COLORREF &color)
CFX_FloatRect GetContentRect() const
void SetScrollPosition(float pos) override
void AddString(const WideString &str)
void SetTopVisibleIndex(int32_t nItemIndex)
void SetScrollInfo(const PWL_SCROLL_INFO &info) override
void SetHoverSel(bool bHoverSel)
void SetFontSize(float fFontSize) override
void ScrollToListItem(int32_t nItemIndex)
bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask< FWL_EVENTFLAG > nFlag) override
void OnDestroy() override
void ScrollWindowVertically(float pos) override
int32_t GetCurSel() const
float GetFirstHeight() const
bool OnNotifySelectionChanged(bool bKeyDown, Mask< FWL_EVENTFLAG > nFlag)
CFX_FloatRect GetListRect() const
bool OnMouseWheel(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point, const CFX_Vector &delta) override
void DrawThisAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device) override
void Deselect(int32_t nItemIndex)
bool OnLButtonUp(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point) override
CFX_FloatRect GetContentRect() const
WideString GetText() override
CPWL_ListBox(const CreateParams &cp, std::unique_ptr< IPWL_FillerNotify::PerWindowData > pAttachedData)
void Select(int32_t nItemIndex)
void OnCreated() override
int32_t GetTopVisibleIndex() const
CFX_FloatRect GetFocusRect() const override
bool OnLButtonDown(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point) override
void OnSetScrollPosY(float fy) override
float GetFontSize() const override
bool OnInvalidateRect(const CFX_FloatRect &pRect) override
void SetCaret(int32_t nItemIndex)
void OnSetScrollInfoY(float fPlateMin, float fPlateMax, float fContentMin, float fContentMax, float fSmallStep, float fBigStep) override
bool OnMouseMove(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point) override
int32_t GetCaretIndex() const
bool IsMultipleSel() const
bool IsItemSelected(int32_t nItemIndex) const
bool RepositionChildWnd() override
bool OnChar(uint16_t nChar, Mask< FWL_EVENTFLAG > nFlag) override
bool ClientHitTest(const CFX_PointF &point) const
virtual bool OnChar(uint16_t nChar, Mask< FWL_EVENTFLAG > nFlag)
IPWL_FillerNotify * GetFillerNotify() const
bool HasFlag(uint32_t dwFlags) const
virtual CFX_FloatRect GetClientRect() const
CFX_FloatRect GetWindowRect() const
virtual bool OnLButtonUp(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
virtual bool OnMouseMove(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
virtual bool RepositionChildWnd()
virtual bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask< FWL_EVENTFLAG > nFlag)
int32_t GetBorderWidth() const
virtual void SetScrollInfo(const PWL_SCROLL_INFO &info)
virtual bool InvalidateRect(const CFX_FloatRect *pRect)
virtual CFX_FloatRect GetFocusRect() const
virtual bool SetVisible(bool bVisible)
IPWL_FillerNotify::PerWindowData * GetAttachedData() const
int32_t GetInnerBorderWidth() const
virtual void SetScrollPosition(float pos)
virtual void DrawThisAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device)
CPWL_ScrollBar * GetVScrollBar() const
virtual bool OnLButtonDown(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
virtual bool IsSelectionImplemented() const =0
virtual void OutputSelectedRect(PerWindowData *pWidgetData, const CFX_FloatRect &rect)=0
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
#define FXSYS_IsFloatBigger(fa, fb)
#define FXSYS_IsFloatEqual(fa, fb)