7#include "fpdfsdk/pwl/cpwl_list_box.h"
12#include "core/fxcrt/numerics/safe_conversions.h"
13#include "core/fxge/cfx_renderdevice.h"
14#include "fpdfsdk/pwl/cpwl_edit.h"
15#include "fpdfsdk/pwl/cpwl_edit_impl.h"
16#include "fpdfsdk/pwl/cpwl_scroll_bar.h"
17#include "fpdfsdk/pwl/ipwl_fillernotify.h"
18#include "public/fpdf_fwlevent.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)))
147 m_pListCtrl->OnMouseDown(point, IsSHIFTKeyDown(nFlag),
148 IsCTRLKeyDown(nFlag));
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) {
209 WideString swChange = this_observed->GetText();
212 int nSelEnd =
pdfium::checked_cast<
int>(swChange.GetLength());
214 this_observed->GetFillerNotify()->OnBeforeKeyStroke(
215 this_observed->GetAttachedData(), swChange, strChangeEx, nSelStart,
216 nSelEnd, bKeyDown, nFlag);
217 if (!this_observed) {
224 if (m_pListCtrl->IsMultipleSel()) {
225 CFX_FloatRect rcCaret = m_pListCtrl->GetItemRect(m_pListCtrl->GetCaret());
234 m_pListCtrl->AddString(str);
238 return m_pListCtrl->GetText();
242 m_pListCtrl->SetFontSize(fFontSize);
246 return m_pListCtrl->GetFontSize();
290 m_pListCtrl->Select(nItemIndex);
294 m_pListCtrl->Deselect(nItemIndex);
298 m_pListCtrl->SetCaret(nItemIndex);
302 m_pListCtrl->SetTopItem(nItemIndex);
306 m_pListCtrl->ScrollToListItem(nItemIndex);
310 return m_pListCtrl->IsMultipleSel();
314 return m_pListCtrl->GetCaret();
318 return m_pListCtrl->GetSelect();
322 return m_pListCtrl->IsItemSelected(nItemIndex);
326 m_pListCtrl->ScrollToListItem(m_pListCtrl->GetFirstSelected());
327 return m_pListCtrl->GetTopItem();
331 return m_pListCtrl->GetCount();
335 return m_pListCtrl->GetContentRect();
339 return m_pListCtrl->GetFirstHeight();
351 m_pListCtrl->OnVK_DOWN(IsSHIFTKeyDown(nFlag), IsCTRLKeyDown(nFlag));
353 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
CFX_VTemplate< int32_t > CFX_Vector
CFX_PTemplate< float > CFX_PointF
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)
fxcrt::WideString WideString