Medical Imaging Interaction Toolkit  2023.04.00
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
berry::ContributionManager::GetItems
QList< SmartPointer< IContributionItem > > GetItems() const override
berry::ContributionManager::Add
void Add(QAction *action, const QString &id) override
berry::ContributionManager::ItemRemoved
void ItemRemoved(const SmartPointer< IContributionItem > &item)
berry::ContributionManager::~ContributionManager
~ContributionManager() override
berryIContributionManager.h
berry::ContributionManager::InsertAfter
void InsertAfter(const QString &ID, const SmartPointer< IContributionItem > &item) override
berry::ContributionManager::AppendToGroup
void AppendToGroup(const QString &groupName, QAction *action, const QString &id) override
berry::ContributionManager::PrependToGroup
void PrependToGroup(const QString &groupName, const SmartPointer< IContributionItem > &item) override
berry::SmartPointer
Implements transparent reference counting.
Definition: berryICommandCategoryListener.h:21
berry::ContributionManager::berryObjectMacro
berryObjectMacro(berry::ContributionManager)
berry::ContributionManager::Remove
SmartPointer< IContributionItem > Remove(const QString &ID) override
berry::ContributionManager::HasDynamicItems
bool HasDynamicItems() const
berry::ContributionManager::IsDirty
bool IsDirty() const override
berry::ContributionManager::InsertBefore
void InsertBefore(const QString &ID, const SmartPointer< IContributionItem > &item) override
berry::ContributionManager::SetDirty
void SetDirty(bool dirty)
berry::ContributionManager::ContributionManager
ContributionManager()
berry::ContributionManager::SetOverrides
void SetOverrides(const SmartPointer< IContributionManagerOverrides > &newOverrides)
berry::ContributionManager::IndexOf
int IndexOf(const QString &id)
berry::ContributionManager::AllowItem
virtual bool AllowItem(IContributionItem *itemToAdd)
berry::ContributionManager::Find
SmartPointer< IContributionItem > Find(const QString &id) const override
berry::ContributionManager::Insert
void Insert(int index, const SmartPointer< IContributionItem > &item)
berry::ContributionManager::GetOverrides
SmartPointer< IContributionManagerOverrides > GetOverrides() override
berry::IContributionManager
Definition: berryIContributionManager.h:45
mitk::SemanticTypes::ID
std::string ID
Definition: mitkSemanticTypes.h:33
berry::IContributionItem
Definition: berryIContributionItem.h:50
berry::ContributionManager::GetSize
int GetSize()
berry::ContributionManager::InternalSetItems
void InternalSetItems(const QList< SmartPointer< IContributionItem > > &items)
berry::ContributionManager::MarkDirty
void MarkDirty() override
berry::ContributionManager
Definition: berryContributionManager.h:42
berry::ContributionManager::DumpStatistics
void DumpStatistics()
berry::ContributionManager::RemoveAll
void RemoveAll() override
berry::ContributionManager::ReplaceItem
bool ReplaceItem(const QString &identifier, const SmartPointer< IContributionItem > &replacementItem)
berry::ContributionManager::IsEmpty
bool IsEmpty() const override
berry::ContributionManager::ItemAdded
void ItemAdded(const SmartPointer< IContributionItem > &item)
berry
Definition: QmitkPropertyItemModel.h:24