1 // Copyright 2017 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef XFA_FXFA_CXFA_FFCOMBOBOX_H_ 8 #define XFA_FXFA_CXFA_FFCOMBOBOX_H_ 9 10 #include "v8/include/cppgc/member.h" 11 #include "xfa/fxfa/cxfa_ffdropdown.h" 12 13 class CXFA_EventParam; 14 15 class CXFA_FFComboBox final : public CXFA_FFDropDown { 16 public: 17 CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED; 18 ~CXFA_FFComboBox() override; 19 20 void Trace(cppgc::Visitor* visitor) const override; 21 22 // CXFA_FFDropDown: 23 CXFA_FFComboBox* AsComboBox() override; 24 25 // CXFA_FFField 26 CFX_RectF GetBBox(FocusOption focus) override; 27 bool LoadWidget() override; 28 void UpdateWidgetProperty() override; 29 bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; 30 bool OnKillFocus(CXFA_FFWidget* pNewWidget) override WARN_UNUSED_RESULT; 31 bool CanUndo() override; 32 bool CanRedo() override; 33 bool CanCopy() override; 34 bool CanCut() override; 35 bool CanPaste() override; 36 bool CanSelectAll() override; 37 bool Undo() override; 38 bool Redo() override; 39 Optional<WideString> Copy() override; 40 Optional<WideString> Cut() override; 41 bool Paste(const WideString& wsPaste) override; 42 void SelectAll() override; 43 void Delete() override; 44 void DeSelect() override; 45 WideString GetText() override; 46 FormFieldType GetFormFieldType() override; 47 48 // IFWL_WidgetDelegate 49 void OnProcessMessage(CFWL_Message* pMessage) override; 50 void OnProcessEvent(CFWL_Event* pEvent) override; 51 void OnDrawWidget(CFGAS_GEGraphics* pGraphics, 52 const CFX_Matrix& matrix) override; 53 54 // CXFA_FFDropDown 55 void InsertItem(const WideString& wsLabel, int32_t nIndex) override; 56 void DeleteItem(int32_t nIndex) override; 57 58 void OpenDropDownList(); 59 60 void OnTextChanged(CFWL_Widget* pWidget, const WideString& wsChanged); 61 void OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp); 62 void OnPreOpen(CFWL_Widget* pWidget); 63 void OnPostOpen(CFWL_Widget* pWidget); 64 void SetItemState(int32_t nIndex, bool bSelected); 65 66 private: 67 explicit CXFA_FFComboBox(CXFA_Node* pNode); 68 69 // CXFA_FFField: 70 bool PtInActiveRect(const CFX_PointF& point) override; 71 bool CommitData() override; 72 bool UpdateFWLData() override; 73 bool IsDataChanged() override; 74 75 uint32_t GetAlignment(); 76 void FWLEventSelChange(CXFA_EventParam* pParam); 77 WideString GetCurrentText() const; 78 79 WideString m_wsNewValue; 80 cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate; 81 }; 82 83 #endif // XFA_FXFA_CXFA_FFCOMBOBOX_H_ 84