PoDoFo  1.0.0-dev
PdfChoiceField.h
1 
7 #ifndef PDF_CHOICE_FIELD_H
8 #define PDF_CHOICE_FIELD_H
9 
10 #include "PdfField.h"
11 
12 namespace PoDoFo
13 {
14  // TODO: Multiselect
22  class PODOFO_API PdChoiceField : public PdfField
23  {
24  friend class PdfListBox;
25  friend class PdfComboBox;
26 
27  private:
28  PdChoiceField(PdfAcroForm& acroform, PdfFieldType fieldType,
29  const std::shared_ptr<PdfField>& parent);
30 
31  PdChoiceField(PdfAnnotationWidget& widget, PdfFieldType fieldType,
32  const std::shared_ptr<PdfField>& parent);
33 
34  PdChoiceField(PdfObject& obj, PdfAcroForm* acroform, PdfFieldType fieldType);
35 
36  public:
44  void InsertItem(const PdfString& value, nullable<const PdfString&> displayName = { });
45 
51  void RemoveItem(unsigned index);
52 
57  PdfString GetItem(unsigned index) const;
58 
67  nullable<const PdfString&> GetItemDisplayText(int index) const;
68 
72  unsigned GetItemCount() const;
73 
77  void SetSelectedIndex(int index);
78 
83  int GetSelectedIndex() const;
84 
89  bool IsComboBox() const;
90 
98  void SetSpellCheckingEnabled(bool spellCheck);
99 
103  bool IsSpellCheckingEnabled() const;
104 
113  void SetSorted(bool sorted);
114 
118  bool IsSorted() const;
119 
128  void SetMultiSelect(bool multi);
129 
134  bool IsMultiSelect() const;
135 
136  void SetCommitOnSelectionChange(bool commit);
137  bool IsCommitOnSelectionChange() const;
138  };
139 }
140 
141 #endif // PDF_CHOICE_FIELD_H
A list of items in a PDF file.
Definition: PdfChoiceField.h:23
A combo box with a drop down list of items.
Definition: PdfComboBox.h:17
A list box.
Definition: PdfListBox.h:17
This class represents a PDF indirect Object in memory.
Definition: PdfObject.h:35
A string that can be written to a PDF document.
Definition: PdfString.h:24
Alternative to std::optional that supports reference (but not pointer) types.
Definition: nullable.h:29
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16
PdfFieldType
The type of PDF field.
Definition: PdfDeclarations.h:614