Medical Imaging Interaction Toolkit  2018.4.99-663e373e
Medical Imaging Interaction Toolkit
berryContributionManager.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef BERRYCONTRIBUTIONMANAGER_H
15 #define BERRYCONTRIBUTIONMANAGER_H
16 
18 
19 namespace berry {
20 
21 struct IContributionManagerOverrides;
22 
43 {
44 
45 protected:
46 
47  // Internal debug flag.
48  // static final boolean DEBUG = false;
49 
50 public:
51 
53 
54  ~ContributionManager() override;
55 
56  /*
57  * Method declared on IContributionManager.
58  */
59  void Add(QAction* action, const QString& id) override;
60 
61  /*
62  * Method declared on IContributionManager.
63  */
64  void Add(const SmartPointer<IContributionItem>& item) override;
65 
66  /*
67  * Method declared on IContributionManager.
68  */
69  void AppendToGroup(const QString& groupName, QAction* action, const QString& id) override;
70 
71  /*
72  * Method declared on IContributionManager.
73  */
74  void AppendToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item) override;
75 
76  /*
77  * Method declared on IContributionManager.
78  */
79  SmartPointer<IContributionItem> Find(const QString& id) const override;
80 
81  /*
82  * Method declared on IContributionManager.
83  */
84  QList<SmartPointer<IContributionItem> > GetItems() const override;
85 
91  int GetSize();
92 
100 
109  int IndexOf(const QString& id);
110 
119  void Insert(int index, const SmartPointer<IContributionItem>& item);
120 
121  /*
122  * (non-Javadoc) Method declared on IContributionManager.
123  */
124  //void InsertAfter(const QString& ID, Action* action);
125 
126  /*
127  * (non-Javadoc) Method declared on IContributionManager.
128  */
129  void InsertAfter(const QString& ID, const SmartPointer<IContributionItem>& item) override;
130 
131  /*
132  * (non-Javadoc) Method declared on IContributionManager.
133  */
134  //void InsertBefore(const QString& ID, Action* action);
135 
136  /*
137  * Method declared on IContributionManager.
138  */
139  void InsertBefore(const QString& ID, const SmartPointer<IContributionItem>& item) override;
140 
141  /*
142  * Method declared on IContributionManager.
143  */
144  bool IsDirty() const override;
145 
146  /*
147  * Method declared on IContributionManager.
148  */
149  bool IsEmpty() const override;
150 
151  /*
152  * Method declared on IContributionManager.
153  */
154  void MarkDirty() override;
155 
156  /*
157  * Method declared on IContributionManager.
158  */
159  //void PrependToGroup(const QString& groupName, Action* action);
160 
161  /*
162  * Method declared on IContributionManager.
163  */
164  void PrependToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item) override;
165 
166  /*
167  * Method declared on IContributionManager.
168  */
169  SmartPointer<IContributionItem> Remove(const QString& ID) override;
170 
171  /*
172  * Method declared on IContributionManager.
173  */
175 
176  /*
177  * (non-Javadoc) Method declared on IContributionManager.
178  */
179  void RemoveAll() override;
180 
199  bool ReplaceItem(const QString &identifier,
200  const SmartPointer<IContributionItem>& replacementItem);
201 
209 
210 protected:
211 
216 
230  virtual bool AllowItem(IContributionItem* itemToAdd);
231 
236  void DumpStatistics();
237 
246  bool HasDynamicItems() const;
247 
257  int IndexOf(const SmartPointer<IContributionItem>& item) const;
258 
267  void ItemAdded(const SmartPointer<IContributionItem>& item);
268 
277 
286  void SetDirty(bool dirty);
287 
294  void InternalSetItems(const QList<SmartPointer<IContributionItem> >& items);
295 
296 private:
297 
301  QList<SmartPointer<IContributionItem> > contributions;
302 
306  bool isDirty;
307 
311  int dynamicItems;
312 
317 
332  void AddToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item,
333  bool append);
334 
335 };
336 
337 }
338 
339 #endif // BERRYCONTRIBUTIONMANAGER_H
void RemoveAll() override
void SetDirty(bool dirty)
void ItemRemoved(const SmartPointer< IContributionItem > &item)
Implements transparent reference counting.
void InternalSetItems(const QList< SmartPointer< IContributionItem > > &items)
void Add(QAction *action, const QString &id) override
QList< SmartPointer< IContributionItem > > GetItems() const override
void AppendToGroup(const QString &groupName, QAction *action, const QString &id) override
void MarkDirty() override
bool ReplaceItem(const QString &identifier, const SmartPointer< IContributionItem > &replacementItem)
bool IsDirty() const override
bool IsEmpty() const override
void InsertAfter(const QString &ID, const SmartPointer< IContributionItem > &item) override
SmartPointer< IContributionManagerOverrides > GetOverrides() override
void ItemAdded(const SmartPointer< IContributionItem > &item)
void SetOverrides(const SmartPointer< IContributionManagerOverrides > &newOverrides)
SmartPointer< IContributionItem > Find(const QString &id) const override
int IndexOf(const QString &id)
void InsertBefore(const QString &ID, const SmartPointer< IContributionItem > &item) override
SmartPointer< IContributionItem > Remove(const QString &ID) override
berryObjectMacro(berry::ContributionManager)
void Insert(int index, const SmartPointer< IContributionItem > &item)
virtual bool AllowItem(IContributionItem *itemToAdd)
void PrependToGroup(const QString &groupName, const SmartPointer< IContributionItem > &item) override