7#ifndef FPDFSDK_PWL_CPWL_LIST_CTRL_H_
8#define FPDFSDK_PWL_CPWL_LIST_CTRL_H_
14#include "core/fxcrt/fx_coordinates.h"
15#include "core/fxcrt/unowned_ptr.h"
16#include "core/fxcrt/widestring.h"
17#include "fpdfsdk/pwl/cpwl_edit_impl.h"
43 void OnMouseDown(
const CFX_PointF& point,
bool bShift,
bool bCtrl);
44 void OnMouseMove(
const CFX_PointF& point,
bool bShift,
bool bCtrl);
45 void OnVK_UP(
bool bShift,
bool bCtrl);
50 void OnVK_END(
bool bShift,
bool bCtrl);
51 bool OnChar(uint16_t nChar,
bool bShift,
bool bCtrl);
56 int32_t
GetCaret()
const {
return m_nCaretIndex; }
64 void Select(int32_t nItemIndex);
70 void SetFontSize(
float fFontSize) { m_fFontSize = fFontSize; }
81 int32_t
FindNext(int32_t nIndex,
wchar_t nChar)
const;
94 void SetSelect(
bool bSelected) { m_bSelected = bSelected; }
95 void SetText(
const WideString& text);
96 void SetFontSize(
float fFontSize);
97 WideString GetText()
const;
100 bool IsSelected()
const {
return m_bSelected; }
101 float GetItemHeight()
const;
102 uint16_t GetFirstChar()
const;
107 bool m_bSelected =
false;
109 std::unique_ptr<CPWL_EditImpl>
const m_pEdit;
114 enum State { DESELECTING = -1, NORMAL = 0, SELECTING = 1 };
115 using const_iterator = std::map<int32_t, State>::const_iterator;
120 void Add(int32_t nItemIndex);
121 void Add(int32_t nBeginIndex, int32_t nEndIndex);
122 void Sub(int32_t nItemIndex);
123 void Sub(int32_t nBeginIndex, int32_t nEndIndex);
127 const_iterator begin()
const {
return m_Items.begin(); }
128 const_iterator end()
const {
return m_Items.end(); }
131 std::map<int32_t, State> m_Items;
134 CFX_PointF InToOut(
const CFX_PointF& point)
const;
135 CFX_PointF OutToIn(
const CFX_PointF& point)
const;
139 CFX_PointF InnerToOuter(
const CFX_PointF& point)
const;
140 CFX_PointF OuterToInner(
const CFX_PointF& point)
const;
144 void OnVK(int32_t nItemIndex,
bool bShift,
bool bCtrl);
145 bool IsValid(int32_t nItemIndex)
const;
147 void ReArrange(int32_t nItemIndex);
150 void SetMultipleSelect(int32_t nItemIndex,
bool bSelected);
151 void SetSingleSelect(int32_t nItemIndex);
152 void InvalidateItem(int32_t nItemIndex);
154 bool IsItemVisible(int32_t nItemIndex)
const;
155 void SetScrollInfo();
156 void SetScrollPosY(
float fy);
157 void AddItem(
const WideString& str);
158 WideString GetItemText(int32_t nIndex)
const;
159 void SetItemSelect(int32_t nIndex,
bool bSelected);
160 int32_t GetLastSelected()
const;
161 CFX_PointF GetBTPoint()
const {
162 return CFX_PointF(m_rcPlate
.left, m_rcPlate
.top);
167 CFX_PointF m_ptScrollPos;
168 float m_fFontSize = 0.0f;
171 int32_t m_nSelItem = -1;
174 SelectState m_SelectState;
175 int32_t m_nFootIndex = -1;
176 int32_t m_nCaretIndex = -1;
177 bool m_bCtrlSel =
false;
179 bool m_bMultiple =
false;
180 bool m_bNotifyFlag =
false;
182 std::vector<std::unique_ptr<Item>> m_ListItems;
bool IsDataChanged(const CPDFSDK_PageView *pPageView) override
CFFL_ListBox(CFFL_InteractiveFormFiller *pFormFiller, CPDFSDK_Widget *pWidget)
void GetActionData(const CPDFSDK_PageView *pPageView, CPDF_AAction::AActionType type, CFFL_FieldAction &fa) override
bool SetIndexSelected(int index, bool selected) override
void SavePWLWindowState(const CPDFSDK_PageView *pPageView) override
std::unique_ptr< CPWL_Wnd > NewPWLWindow(const CPWL_Wnd::CreateParams &cp, std::unique_ptr< IPWL_FillerNotify::PerWindowData > pAttachedData) override
void SaveData(const CPDFSDK_PageView *pPageView) override
bool IsIndexSelected(int index) override
bool OnChar(CPDFSDK_Widget *pWidget, uint32_t nChar, Mask< FWL_EVENTFLAG > nFlags) override
void RecreatePWLWindowFromSavedState(const CPDFSDK_PageView *pPageView) override
CPWL_Wnd::CreateParams GetCreateParam() override
void SetFormField(CFFL_FormField *pFormField)
CPDF_BAFontMap * GetOrCreateFontMap()
CFFL_TextObject(CFFL_InteractiveFormFiller *pFormFiller, CPDFSDK_Widget *pWidget)
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
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
std::unique_ptr< CPWL_ListCtrl > m_pListCtrl
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
virtual void OnSetScrollPosY(float fy)=0
virtual void OnSetScrollInfoY(float fPlateMin, float fPlateMax, float fContentMin, float fContentMax, float fSmallStep, float fBigStep)=0
virtual bool OnInvalidateRect(const CFX_FloatRect &rect)=0
void SetFontSize(float fFontSize)
void SetNotify(NotifyIface *pNotify)
void OnVK_LEFT(bool bShift, bool bCtrl)
void SetMultipleSel(bool bMultiple)
bool OnChar(uint16_t nChar, bool bShift, bool bCtrl)
float GetFontSize() const
void SetCaret(int32_t nItemIndex)
void OnVK_UP(bool bShift, bool bCtrl)
void Select(int32_t nItemIndex)
CPWL_EditImpl * GetItemEdit(int32_t nIndex) const
void AddString(const WideString &str)
CFX_FloatRect GetContentRect() const
void Deselect(int32_t nItemIndex)
WideString GetText() const
void SetFontMap(IPVT_FontMap *pFontMap)
void SetScrollPos(const CFX_PointF &point)
int32_t FindNext(int32_t nIndex, wchar_t nChar) const
bool IsItemSelected(int32_t nIndex) const
void OnVK_END(bool bShift, bool bCtrl)
void OnVK_DOWN(bool bShift, bool bCtrl)
void ScrollToListItem(int32_t nItemIndex)
CFX_FloatRect GetItemRect(int32_t nIndex) const
void SetTopItem(int32_t nIndex)
bool IsMultipleSel() const
int32_t GetItemIndex(const CFX_PointF &point) const
CFX_FloatRect GetPlateRect() const
float GetFirstHeight() const
void OnVK_RIGHT(bool bShift, bool bCtrl)
int32_t GetSelect() const
int32_t GetTopItem() const
int32_t GetFirstSelected() const
void OnVK_HOME(bool bShift, bool bCtrl)
void OnMouseMove(const CFX_PointF &point, bool bShift, bool bCtrl)
void SetPlateRect(const CFX_FloatRect &rect)
void OnMouseDown(const CFX_PointF &point, bool bShift, bool bCtrl)