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 "xfa/fxfa/cxfa_fffield.h" 11 12 class CXFA_FFComboBox : public CXFA_FFField { 13 public: 14 explicit CXFA_FFComboBox(CXFA_Node* pNode); 15 ~CXFA_FFComboBox() override; 16 17 // CXFA_FFField 18 CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override; 19 bool LoadWidget() override; 20 void UpdateWidgetProperty() override; 21 bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; 22 bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; 23 bool CanUndo() override; 24 bool CanRedo() override; 25 bool Undo() override; 26 bool Redo() override; 27 28 bool CanCopy() override; 29 bool CanCut() override; 30 bool CanPaste() override; 31 bool CanSelectAll() override; 32 Optional<WideString> Copy() override; 33 Optional<WideString> Cut() override; 34 bool Paste(const WideString& wsPaste) override; 35 void SelectAll() override; 36 void Delete() override; 37 void DeSelect() override; 38 FormFieldType GetFormFieldType() override; 39 40 // IFWL_WidgetDelegate 41 void OnProcessMessage(CFWL_Message* pMessage) override; 42 void OnProcessEvent(CFWL_Event* pEvent) override; 43 void OnDrawWidget(CXFA_Graphics* pGraphics, 44 const CFX_Matrix& matrix) override; 45 46 virtual void OpenDropDownList(); 47 48 void OnTextChanged(CFWL_Widget* pWidget, const WideString& wsChanged); 49 void OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp); 50 void OnPreOpen(CFWL_Widget* pWidget); 51 void OnPostOpen(CFWL_Widget* pWidget); 52 void SetItemState(int32_t nIndex, bool bSelected); 53 void InsertItem(const WideStringView& wsLabel, int32_t nIndex); 54 void DeleteItem(int32_t nIndex); 55 56 private: 57 // CXFA_FFField 58 bool PtInActiveRect(const CFX_PointF& point) override; 59 bool CommitData() override; 60 bool UpdateFWLData() override; 61 bool IsDataChanged() override; 62 63 uint32_t GetAlignment(); 64 void FWLEventSelChange(CXFA_EventParam* pParam); 65 66 WideString m_wsNewValue; 67 IFWL_WidgetDelegate* m_pOldDelegate; 68 }; 69 70 #endif // XFA_FXFA_CXFA_FFCOMBOBOX_H_ 71