1 // Copyright 2014 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_APP_XFA_FFCHOICELIST_H_ 8 #define XFA_FXFA_APP_XFA_FFCHOICELIST_H_ 9 10 #include "xfa/fxfa/app/xfa_fffield.h" 11 #include "xfa/fxfa/xfa_ffpageview.h" 12 13 class CXFA_FFListBox : public CXFA_FFField { 14 public: 15 explicit CXFA_FFListBox(CXFA_WidgetAcc* pDataAcc); 16 ~CXFA_FFListBox() override; 17 18 // CXFA_FFField 19 bool LoadWidget() override; 20 bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; 21 void OnProcessMessage(CFWL_Message* pMessage) override; 22 void OnProcessEvent(CFWL_Event* pEvent) override; 23 void OnDrawWidget(CFX_Graphics* pGraphics, 24 const CFX_Matrix* pMatrix = nullptr) override; 25 26 void OnSelectChanged(CFWL_Widget* pWidget, 27 const CFX_ArrayTemplate<int32_t>& arrSels); 28 void SetItemState(int32_t nIndex, bool bSelected); 29 void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1); 30 void DeleteItem(int32_t nIndex); 31 32 protected: 33 bool CommitData() override; 34 bool UpdateFWLData() override; 35 bool IsDataChanged() override; 36 37 uint32_t GetAlignment(); 38 39 IFWL_WidgetDelegate* m_pOldDelegate; 40 }; 41 42 class CXFA_FFComboBox : public CXFA_FFField { 43 public: 44 explicit CXFA_FFComboBox(CXFA_WidgetAcc* pDataAcc); 45 ~CXFA_FFComboBox() override; 46 47 // CXFA_FFField 48 CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override; 49 bool LoadWidget() override; 50 void UpdateWidgetProperty() override; 51 bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; 52 bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; 53 bool CanUndo() override; 54 bool CanRedo() override; 55 bool Undo() override; 56 bool Redo() override; 57 58 bool CanCopy() override; 59 bool CanCut() override; 60 bool CanPaste() override; 61 bool CanSelectAll() override; 62 bool Copy(CFX_WideString& wsCopy) override; 63 bool Cut(CFX_WideString& wsCut) override; 64 bool Paste(const CFX_WideString& wsPaste) override; 65 void SelectAll() override; 66 void Delete() override; 67 void DeSelect() override; 68 69 // IFWL_WidgetDelegate 70 void OnProcessMessage(CFWL_Message* pMessage) override; 71 void OnProcessEvent(CFWL_Event* pEvent) override; 72 void OnDrawWidget(CFX_Graphics* pGraphics, 73 const CFX_Matrix* pMatrix = nullptr) override; 74 75 virtual void OpenDropDownList(); 76 77 void OnTextChanged(CFWL_Widget* pWidget, const CFX_WideString& wsChanged); 78 void OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp); 79 void OnPreOpen(CFWL_Widget* pWidget); 80 void OnPostOpen(CFWL_Widget* pWidget); 81 void SetItemState(int32_t nIndex, bool bSelected); 82 void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1); 83 void DeleteItem(int32_t nIndex); 84 85 protected: 86 // CXFA_FFField 87 bool PtInActiveRect(const CFX_PointF& point) override; 88 bool CommitData() override; 89 bool UpdateFWLData() override; 90 bool IsDataChanged() override; 91 92 uint32_t GetAlignment(); 93 void FWLEventSelChange(CXFA_EventParam* pParam); 94 95 CFX_WideString m_wsNewValue; 96 IFWL_WidgetDelegate* m_pOldDelegate; 97 }; 98 99 #endif // XFA_FXFA_APP_XFA_FFCHOICELIST_H_ 100