7#include "xfa/fwl/cfwl_combolist.h"
9#include "third_party/base/check.h"
10#include "xfa/fwl/cfwl_combobox.h"
11#include "xfa/fwl/cfwl_comboedit.h"
12#include "xfa/fwl/cfwl_listbox.h"
13#include "xfa/fwl/cfwl_messagekey.h"
14#include "xfa/fwl/cfwl_messagekillfocus.h"
15#include "xfa/fwl/cfwl_messagemouse.h"
16#include "xfa/fwl/fwl_widgetdef.h"
18CFWL_ComboList::CFWL_ComboList(CFWL_App* app,
27int32_t CFWL_ComboList::
MatchItem(WideStringView wsMatch) {
28 if (wsMatch.IsEmpty())
32 for (int32_t i = 0; i < iCount; i++) {
35 auto pos = wsText.Find(wsMatch);
36 if (pos.has_value() && pos.value() == 0)
65CFX_PointF CFWL_ComboList::ClientToOuter(
const CFX_PointF& point) {
71 bool backDefault =
true;
76 CFWL_MessageMouse* pMsg =
static_cast<CFWL_MessageMouse*>(pMessage);
80 if (rect.Contains(pMsg->m_pos)) {
81 pMsg->m_pos -= rect.TopLeft();
82 vertSB->GetDelegate()->OnProcessMessage(pMsg);
89 OnDropListMouseMove(pMsg);
93 OnDropListLButtonDown(pMsg);
97 OnDropListLButtonUp(pMsg);
103 backDefault = !OnDropListKey(
static_cast<CFWL_MessageKey*>(pMessage));
109void CFWL_ComboList::OnDropListFocusChanged(
CFWL_Message* pMsg,
bool bSet) {
113 CFWL_MessageKillFocus* pKill =
static_cast<CFWL_MessageKillFocus*>(pMsg);
114 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
121void CFWL_ComboList::OnDropListMouseMove(CFWL_MessageMouse* pMsg) {
124 m_bNotifyOwner =
false;
129 if (rect.Contains(pMsg->m_pos))
138 }
else if (m_bNotifyOwner) {
139 pMsg->m_pos = ClientToOuter(pMsg->m_pos);
141 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
142 pOuter->GetDelegate()->OnProcessMessage(pMsg);
146void CFWL_ComboList::OnDropListLButtonDown(CFWL_MessageMouse* pMsg) {
150 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
154void CFWL_ComboList::OnDropListLButtonUp(CFWL_MessageMouse* pMsg) {
155 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
156 if (m_bNotifyOwner) {
157 pMsg->m_pos = ClientToOuter(pMsg->m_pos);
158 pOuter->GetDelegate()->OnProcessMessage(pMsg);
165 if (rect.Contains(pMsg->m_pos))
175bool CFWL_ComboList::OnDropListKey(CFWL_MessageKey* pKey) {
176 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
177 bool bPropagate =
false;
188 OnDropListKeyDown(pKey);
202 pOuter->GetDelegate()->OnProcessMessage(pKey);
208void CFWL_ComboList::OnDropListKeyDown(CFWL_MessageKey* pKey) {
215 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
void ProcessSelChanged(bool bLButtonUp)
CFWL_ComboEdit * GetComboEdit() const
int32_t GetCurrentSelection() const
~CFWL_ComboList() override
void ChangeSelected(int32_t iSel)
void OnProcessMessage(CFWL_Message *pMessage) override
int32_t MatchItem(WideStringView wsMatch)
CFX_RectF GetRect() const
WideString GetText() const
void SetSelItem(Item *hItem, bool bSelect)
Item * GetSelItem(int32_t nIndexSel)
int32_t CountItems(const CFWL_Widget *pWidget) const
bool ScrollToVisible(Item *hItem)
int32_t GetItemIndex(CFWL_Widget *pWidget, Item *pItem)
void SetSelection(Item *hStart, Item *hEnd, bool bSelected)
bool IsShowVertScrollBar() const
Item * GetItem(const CFWL_Widget *pWidget, int32_t nIndex) const
Item * GetListItem(Item *hItem, XFA_FWL_VKEYCODE dwKeyCode)
void OnProcessMessage(CFWL_Message *pMessage) override
Item * GetItemAtPoint(const CFX_PointF &point)
CFWL_ScrollBar * GetVertScrollBar() const
CFWL_ListBox(CFWL_App *pApp, const Properties &properties, CFWL_Widget *pOuter)
const CFX_RectF & GetRTClient() const
const uint32_t m_dwKeyCodeOrChar
bool IsFocusedOnWidget(const CFWL_Widget *pWidget) const
const MouseCommand m_dwCmd
void SetDstTarget(CFWL_Widget *pWidget)
CFX_RectF & operator=(const CFX_RectF &other)=default
constexpr CFX_RectF(float dst_left, float dst_top, float dst_width, float dst_height)
void Union(const CFX_RectF &rt)