Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryContributionManager.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 #ifndef BERRYCONTRIBUTIONMANAGER_H
19 #define BERRYCONTRIBUTIONMANAGER_H
20 
22 
23 namespace berry {
24 
25 struct IContributionManagerOverrides;
26 
47 {
48 
49 protected:
50 
51  // Internal debug flag.
52  // static final boolean DEBUG = false;
53 
54 public:
55 
57 
59 
60  /*
61  * Method declared on IContributionManager.
62  */
63  void Add(QAction* action, const QString& id) override;
64 
65  /*
66  * Method declared on IContributionManager.
67  */
68  void Add(const SmartPointer<IContributionItem>& item) override;
69 
70  /*
71  * Method declared on IContributionManager.
72  */
73  void AppendToGroup(const QString& groupName, QAction* action, const QString& id) override;
74 
75  /*
76  * Method declared on IContributionManager.
77  */
78  void AppendToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item) override;
79 
80  /*
81  * Method declared on IContributionManager.
82  */
83  SmartPointer<IContributionItem> Find(const QString& id) const override;
84 
85  /*
86  * Method declared on IContributionManager.
87  */
88  QList<SmartPointer<IContributionItem> > GetItems() const override;
89 
95  int GetSize();
96 
104 
113  int IndexOf(const QString& id);
114 
123  void Insert(int index, const SmartPointer<IContributionItem>& item);
124 
125  /*
126  * (non-Javadoc) Method declared on IContributionManager.
127  */
128  //void InsertAfter(const QString& ID, Action* action);
129 
130  /*
131  * (non-Javadoc) Method declared on IContributionManager.
132  */
133  void InsertAfter(const QString& ID, const SmartPointer<IContributionItem>& item) override;
134 
135  /*
136  * (non-Javadoc) Method declared on IContributionManager.
137  */
138  //void InsertBefore(const QString& ID, Action* action);
139 
140  /*
141  * Method declared on IContributionManager.
142  */
143  void InsertBefore(const QString& ID, const SmartPointer<IContributionItem>& item) override;
144 
145  /*
146  * Method declared on IContributionManager.
147  */
148  bool IsDirty() const override;
149 
150  /*
151  * Method declared on IContributionManager.
152  */
153  bool IsEmpty() const override;
154 
155  /*
156  * Method declared on IContributionManager.
157  */
158  void MarkDirty() override;
159 
160  /*
161  * Method declared on IContributionManager.
162  */
163  //void PrependToGroup(const QString& groupName, Action* action);
164 
165  /*
166  * Method declared on IContributionManager.
167  */
168  void PrependToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item) override;
169 
170  /*
171  * Method declared on IContributionManager.
172  */
173  SmartPointer<IContributionItem> Remove(const QString& ID) override;
174 
175  /*
176  * Method declared on IContributionManager.
177  */
179 
180  /*
181  * (non-Javadoc) Method declared on IContributionManager.
182  */
183  void RemoveAll() override;
184 
203  bool ReplaceItem(const QString &identifier,
204  const SmartPointer<IContributionItem>& replacementItem);
205 
213 
214 protected:
215 
220 
234  virtual bool AllowItem(IContributionItem* itemToAdd);
235 
240  void DumpStatistics();
241 
250  bool HasDynamicItems() const;
251 
261  int IndexOf(const SmartPointer<IContributionItem>& item) const;
262 
271  void ItemAdded(const SmartPointer<IContributionItem>& item);
272 
281 
290  void SetDirty(bool dirty);
291 
298  void InternalSetItems(const QList<SmartPointer<IContributionItem> >& items);
299 
300 private:
301 
305  QList<SmartPointer<IContributionItem> > contributions;
306 
310  bool isDirty;
311 
315  int dynamicItems;
316 
321 
336  void AddToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item,
337  bool append);
338 
339 };
340 
341 }
342 
343 #endif // BERRYCONTRIBUTIONMANAGER_H
berryObjectMacro(berry::ContributionManager)~ContributionManager()
SmartPointer< IContributionManagerOverrides > GetOverrides() override
QList< SmartPointer< IContributionItem > > GetItems() const override
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
void AppendToGroup(const QString &groupName, QAction *action, const QString &id) override
SmartPointer< IContributionItem > Find(const QString &id) const override
bool ReplaceItem(const QString &identifier, const SmartPointer< IContributionItem > &replacementItem)
const std::string ID
void InsertAfter(const QString &ID, const SmartPointer< IContributionItem > &item) override
virtual bool AllowItem(IContributionItem *itemToAdd)
void ItemAdded(const SmartPointer< IContributionItem > &item)
void SetOverrides(const SmartPointer< IContributionManagerOverrides > &newOverrides)
void InsertBefore(const QString &ID, const SmartPointer< IContributionItem > &item) override
void Insert(int index, const SmartPointer< IContributionItem > &item)
SmartPointer< IContributionItem > Remove(const QString &ID) override
void PrependToGroup(const QString &groupName, const SmartPointer< IContributionItem > &item) override