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_FFLISTBOX_H_
8 #define XFA_FXFA_CXFA_FFLISTBOX_H_
9 
10 #include "core/fxcrt/unowned_ptr.h"
11 #include "xfa/fxfa/cxfa_ffdropdown.h"
12 
13 class CXFA_FFListBox final : public CXFA_FFDropDown {
14  public:
15   explicit CXFA_FFListBox(CXFA_Node* pNode);
16   ~CXFA_FFListBox() override;
17 
18   // CXFA_FFField:
19   bool LoadWidget() override;
20   bool OnKillFocus(CXFA_FFWidget* pNewWidget) override WARN_UNUSED_RESULT;
21   void OnProcessMessage(CFWL_Message* pMessage) override;
22   void OnProcessEvent(CFWL_Event* pEvent) override;
23   void OnDrawWidget(CXFA_Graphics* pGraphics,
24                     const CFX_Matrix& matrix) override;
25   FormFieldType GetFormFieldType() override;
26 
27   // CXFA_FFDropDown
28   void InsertItem(const WideString& wsLabel, int32_t nIndex) override;
29   void DeleteItem(int32_t nIndex) override;
30 
31   void OnSelectChanged(CFWL_Widget* pWidget);
32   void SetItemState(int32_t nIndex, bool bSelected);
33 
34  private:
35   bool CommitData() override;
36   bool UpdateFWLData() override;
37   bool IsDataChanged() override;
38 
39   uint32_t GetAlignment();
40 
41   UnownedPtr<IFWL_WidgetDelegate> m_pOldDelegate;
42 };
43 
44 #endif  // XFA_FXFA_CXFA_FFLISTBOX_H_
45