xref: /aosp_15_r20/external/pdfium/xfa/fxfa/cxfa_fflistbox.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
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 "v8/include/cppgc/member.h"
11 #include "v8/include/cppgc/prefinalizer.h"
12 #include "xfa/fxfa/cxfa_ffdropdown.h"
13 
14 class CXFA_FFListBox final : public CXFA_FFDropDown {
15   CPPGC_USING_PRE_FINALIZER(CXFA_FFListBox, PreFinalize);
16 
17  public:
18   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
19   ~CXFA_FFListBox() override;
20 
21   void PreFinalize();
22 
23   // CXFA_FFField:
24   void Trace(cppgc::Visitor* visitor) const override;
25   bool LoadWidget() override;
26   [[nodiscard]] bool OnKillFocus(CXFA_FFWidget* pNewWidget) override;
27   void OnProcessMessage(CFWL_Message* pMessage) override;
28   void OnProcessEvent(CFWL_Event* pEvent) override;
29   void OnDrawWidget(CFGAS_GEGraphics* pGraphics,
30                     const CFX_Matrix& matrix) override;
31   FormFieldType GetFormFieldType() override;
32 
33   // CXFA_FFDropDown:
34   void InsertItem(const WideString& wsLabel, int32_t nIndex) override;
35   void DeleteItem(int32_t nIndex) override;
36 
37   void OnSelectChanged(CFWL_Widget* pWidget);
38   void SetItemState(int32_t nIndex, bool bSelected);
39 
40  private:
41   explicit CXFA_FFListBox(CXFA_Node* pNode);
42 
43   bool CommitData() override;
44   bool UpdateFWLData() override;
45   bool IsDataChanged() override;
46 
47   uint32_t GetAlignment();
48 
49   cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
50 };
51 
52 #endif  // XFA_FXFA_CXFA_FFLISTBOX_H_
53