1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkTextPropertyCollection.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 // .NAME vtkTextPropertyCollection - a list of vtkTextProperty objects.
16 // .SECTION Description
17 // vtkTextPropertyCollection represents and provides methods to manipulate a
18 // list of TextProperty objects. The list is unsorted and
19 // duplicate entries are not prevented.
20 // .SECTION see also
21 // vtkTextProperty vtkCollection
22 
23 #ifndef __vtkTextPropertyCollection_h
24 #define __vtkTextPropertyCollection_h
25 
26 #include "vtkRenderingCoreModule.h" // For export macro
27 #include "vtkCollection.h"
28 #include "vtkTextProperty.h" // for inline functions
29 
30 class VTKRENDERINGCORE_EXPORT vtkTextPropertyCollection : public vtkCollection
31 {
32  public:
33   static vtkTextPropertyCollection *New();
34   vtkTypeMacro(vtkTextPropertyCollection, vtkCollection)
35   virtual void PrintSelf(ostream& os, vtkIndent indent);
36 
37   // Description:
38   // Add a vtkTextProperty to the list.
39   void AddItem(vtkTextProperty *a);
40 
41   // Description:
42   // Get the next vtkTextProperty in the list.
43   vtkTextProperty *GetNextItem();
44 
45   // Description:
46   // Get the vtkTextProperty at the specified index.
47   vtkTextProperty *GetItem(int idx);
48 
49   // Description:
50   // Get the last TextProperty in the list.
51   vtkTextProperty *GetLastItem();
52 
53   // Description:
54   // Reentrant safe way to get an object in a collection. Just pass the
55   // same cookie back and forth.
56   vtkTextProperty *GetNextTextProperty(vtkCollectionSimpleIterator &cookie);
57 
58 protected:
59   vtkTextPropertyCollection();
60   ~vtkTextPropertyCollection();
61 
62 private:
63   // hide the standard AddItem from the user and the compiler.
64   void AddItem(vtkObject *o);
65 
66 private:
67   vtkTextPropertyCollection(const vtkTextPropertyCollection&);  // Not implemented.
68   void operator=(const vtkTextPropertyCollection&);  // Not implemented.
69 };
70 
AddItem(vtkTextProperty * a)71 inline void vtkTextPropertyCollection::AddItem(vtkTextProperty *a)
72 {
73   this->vtkCollection::AddItem(a);
74 }
75 
GetNextItem()76 inline vtkTextProperty *vtkTextPropertyCollection::GetNextItem()
77 {
78   return static_cast<vtkTextProperty *>(this->GetNextItemAsObject());
79 }
80 
GetItem(int idx)81 inline vtkTextProperty *vtkTextPropertyCollection::GetItem(int idx)
82 {
83   return static_cast<vtkTextProperty *>(this->GetItemAsObject(idx));
84 }
85 
GetLastItem()86 inline vtkTextProperty *vtkTextPropertyCollection::GetLastItem()
87 {
88   if ( this->Bottom == NULL )
89     {
90     return NULL;
91     }
92   else
93     {
94     return static_cast<vtkTextProperty *>(this->Bottom->Item);
95     }
96 }
97 
98 inline vtkTextProperty *
GetNextTextProperty(vtkCollectionSimpleIterator & it)99 vtkTextPropertyCollection::GetNextTextProperty(vtkCollectionSimpleIterator &it)
100 {
101   return static_cast<vtkTextProperty *>(this->GetNextItemAsObject(it));
102 }
103 
AddItem(vtkObject * o)104 inline void vtkTextPropertyCollection::AddItem(vtkObject *o)
105 {
106   this->vtkCollection::AddItem(o);
107 }
108 
109 #endif
110