VTK  9.7.1
vtkTextPropertyCollection.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
17 #ifndef vtkTextPropertyCollection_h
18 #define vtkTextPropertyCollection_h
19 
20 #include "vtkCollection.h"
21 #include "vtkRenderingCoreModule.h" // For export macro
22 #include "vtkTextProperty.h" // for inline functions
23 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkTextPropertyCollection : public vtkCollection
27 {
28 public:
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
36  void AddItem(vtkTextProperty* a);
37 
41  vtkTextProperty* GetNextItem();
42 
46  vtkTextProperty* GetItem(int idx);
47 
51  vtkTextProperty* GetLastItem();
52 
57  vtkTextProperty* GetNextTextProperty(vtkCollectionSimpleIterator& cookie);
58 
59 protected:
61  ~vtkTextPropertyCollection() override;
62 
63 private:
64  // hide the standard AddItem from the user and the compiler.
65  void AddItem(vtkObject* o);
66 
68  void operator=(const vtkTextPropertyCollection&) = delete;
69 };
70 
72 {
73  this->vtkCollection::AddItem(a);
74 }
75 
77 {
78  return static_cast<vtkTextProperty*>(this->GetNextItemAsObject());
79 }
80 
82 {
83  return static_cast<vtkTextProperty*>(this->GetItemAsObject(idx));
84 }
85 
87 {
88  int numItems = this->GetNumberOfItems();
89  if (numItems == 0)
90  {
91  return nullptr;
92  }
93  else
94  {
95  return static_cast<vtkTextProperty*>(this->GetItemAsObject(numItems - 1));
96  }
97 }
98 
101 {
102  return static_cast<vtkTextProperty*>(this->GetNextItemAsObject(it));
103 }
104 
106 {
107  this->vtkCollection::AddItem(o);
108 }
109 
110 VTK_ABI_NAMESPACE_END
111 #endif
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:35
vtkTextProperty * GetNextTextProperty(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
vtkTextProperty * GetItem(int idx)
Get the vtkTextProperty at the specified index.
abstract base class for most VTK objects
Definition: vtkObject.h:52
int GetNumberOfItems() VTK_FUTURE_CONST
Return the number of items in the collection.
vtkTextProperty * GetLastItem()
Get the last TextProperty in the list.
void AddItem(vtkTextProperty *a)
Add a vtkTextProperty to the bottom of the list.
vtkTextProperty * GetNextItem()
Get the next vtkTextProperty in the list.
an ordered list of vtkTextProperty objects.
a simple class to control print indentation
Definition: vtkIndent.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkCollection * New()
Construct an empty collection.
vtkObject * GetItemAsObject(int i) VTK_FUTURE_CONST
Get the i'th item in the collection.
represent text properties.
void AddItem(vtkObject *)
Add given item to the bottom (end) of the collection.
create and manipulate ordered lists of objects
Definition: vtkCollection.h:39
#define VTK_MARSHALAUTO
vtkObject * GetNextItemAsObject()
Get the next item in the collection.