7#include "xfa/fwl/cfwl_combolist.h"
9#include "core/fxcrt/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"
20CFWL_ComboList::CFWL_ComboList(CFWL_App* app,
30 if (wsMatch.IsEmpty())
34 for (int32_t i = 0; i < iCount; i++) {
37 auto pos = wsText.Find(wsMatch);
38 if (pos.has_value() && pos.value() == 0)
73 bool backDefault =
true;
78 CFWL_MessageMouse* pMsg =
static_cast<CFWL_MessageMouse*>(pMessage);
82 if (rect.Contains(pMsg->m_pos)) {
83 pMsg->m_pos -= rect.TopLeft();
84 vertSB->GetDelegate()->OnProcessMessage(pMsg);
91 OnDropListMouseMove(pMsg);
95 OnDropListLButtonDown(pMsg);
99 OnDropListLButtonUp(pMsg);
105 backDefault = !OnDropListKey(
static_cast<CFWL_MessageKey*>(pMessage));
111void CFWL_ComboList::OnDropListFocusChanged(
CFWL_Message* pMsg,
bool bSet) {
115 CFWL_MessageKillFocus* pKill =
static_cast<CFWL_MessageKillFocus*>(pMsg);
116 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
123void CFWL_ComboList::OnDropListMouseMove(CFWL_MessageMouse* pMsg) {
126 m_bNotifyOwner =
false;
131 if (rect.Contains(pMsg->m_pos))
140 }
else if (m_bNotifyOwner) {
141 pMsg->m_pos = ClientToOuter(pMsg->m_pos);
143 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
144 pOuter->GetDelegate()->OnProcessMessage(pMsg);
148void CFWL_ComboList::OnDropListLButtonDown(CFWL_MessageMouse* pMsg) {
152 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
156void CFWL_ComboList::OnDropListLButtonUp(CFWL_MessageMouse* pMsg) {
157 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
158 if (m_bNotifyOwner) {
159 pMsg->m_pos = ClientToOuter(pMsg->m_pos);
160 pOuter->GetDelegate()->OnProcessMessage(pMsg);
167 if (rect.Contains(pMsg->m_pos))
177bool CFWL_ComboList::OnDropListKey(CFWL_MessageKey* pKey) {
178 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
179 bool bPropagate =
false;
190 OnDropListKeyDown(pKey);
204 pOuter->GetDelegate()->OnProcessMessage(pKey);
210void CFWL_ComboList::OnDropListKeyDown(CFWL_MessageKey* pKey) {
217 CFWL_ComboBox* pOuter =
static_cast<CFWL_ComboBox*>(
GetOuter());
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)
void ProcessSelChanged(bool bLButtonUp)
int32_t GetCurrentSelection() const
CFWL_ComboEdit * GetComboEdit() const
int32_t MatchItem(WideStringView wsMatch)
~CFWL_ComboList() override
void ChangeSelected(int32_t iSel)
void OnProcessMessage(CFWL_Message *pMessage) override
WideString GetText() const
CFX_RectF GetRect() const
Item * GetItemAtPoint(const CFX_PointF &point)
Item * GetItem(const CFWL_Widget *pWidget, int32_t nIndex) const
bool ScrollToVisible(Item *hItem)
void SetSelItem(Item *hItem, bool bSelect)
Item * GetListItem(Item *hItem, XFA_FWL_VKEYCODE dwKeyCode)
CFWL_ListBox(CFWL_App *pApp, const Properties &properties, CFWL_Widget *pOuter)
const CFX_RectF & GetRTClient() const
Item * GetSelItem(int32_t nIndexSel)
void OnProcessMessage(CFWL_Message *pMessage) override
int32_t CountItems(const CFWL_Widget *pWidget) const
void SetSelection(Item *hStart, Item *hEnd, bool bSelected)
CFWL_ScrollBar * GetVertScrollBar() const
bool IsShowVertScrollBar() const
int32_t GetItemIndex(CFWL_Widget *pWidget, Item *pItem)
const uint32_t m_dwKeyCodeOrChar
bool IsFocusedOnWidget(const CFWL_Widget *pWidget) const
const MouseCommand m_dwCmd
void SetDstTarget(CFWL_Widget *pWidget)
CFX_PTemplate< float > CFX_PointF
fxcrt::WideStringView WideStringView
fxcrt::WideString WideString