Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
#include <berryContributionManager.h>
Public Member Functions | |
berryObjectMacro (berry::ContributionManager)~ContributionManager() | |
void | Add (QAction *action, const QString &id) override |
void | Add (const SmartPointer< IContributionItem > &item) override |
void | AppendToGroup (const QString &groupName, QAction *action, const QString &id) override |
void | AppendToGroup (const QString &groupName, const SmartPointer< IContributionItem > &item) override |
SmartPointer< IContributionItem > | Find (const QString &id) const override |
QList< SmartPointer< IContributionItem > > | GetItems () const override |
int | GetSize () |
SmartPointer< IContributionManagerOverrides > | GetOverrides () override |
int | IndexOf (const QString &id) |
void | Insert (int index, const SmartPointer< IContributionItem > &item) |
void | InsertAfter (const QString &ID, const SmartPointer< IContributionItem > &item) override |
void | InsertBefore (const QString &ID, const SmartPointer< IContributionItem > &item) override |
bool | IsDirty () const override |
bool | IsEmpty () const override |
void | MarkDirty () override |
void | PrependToGroup (const QString &groupName, const SmartPointer< IContributionItem > &item) override |
SmartPointer< IContributionItem > | Remove (const QString &ID) override |
SmartPointer< IContributionItem > | Remove (const SmartPointer< IContributionItem > &item) override |
void | RemoveAll () override |
bool | ReplaceItem (const QString &identifier, const SmartPointer< IContributionItem > &replacementItem) |
void | SetOverrides (const SmartPointer< IContributionManagerOverrides > &newOverrides) |
Public Member Functions inherited from berry::IContributionManager | |
berryObjectMacro (berry::IContributionManager) virtual void Add(QAction *action | |
virtual void | Update (bool force)=0 |
Public Member Functions inherited from berry::Object | |
virtual QString | GetClassName () const |
virtual Reflection::TypeInfo | GetTypeInfo () const |
virtual QList< Reflection::TypeInfo > | GetSuperclasses () const |
virtual void | Delete () |
QDebug | Print (QDebug os, Indent Indent=0) const |
virtual QString | ToString () const |
virtual uint | HashCode () const |
virtual bool | operator< (const Object *) const |
void | Register () const |
void | UnRegister (bool del=true) const |
int | GetReferenceCount () const |
void | SetReferenceCount (int) |
void | AddDestroyListener (const MessageAbstractDelegate<> &delegate) const |
void | RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const |
virtual bool | operator== (const Object *) const |
Protected Member Functions | |
ContributionManager () | |
virtual bool | AllowItem (IContributionItem *itemToAdd) |
void | DumpStatistics () |
bool | HasDynamicItems () const |
int | IndexOf (const SmartPointer< IContributionItem > &item) const |
void | ItemAdded (const SmartPointer< IContributionItem > &item) |
void | ItemRemoved (const SmartPointer< IContributionItem > &item) |
void | SetDirty (bool dirty) |
void | InternalSetItems (const QList< SmartPointer< IContributionItem > > &items) |
Protected Member Functions inherited from berry::Object | |
Object () | |
virtual | ~Object () |
virtual QDebug | PrintSelf (QDebug os, Indent indent) const |
virtual QDebug | PrintHeader (QDebug os, Indent indent) const |
virtual QDebug | PrintTrailer (QDebug os, Indent indent) const |
Additional Inherited Members | |
Public Types inherited from berry::Object | |
typedef Object | Self |
typedef berry::SmartPointer< Self > | Pointer |
typedef berry::SmartPointer< const Self > | ConstPointer |
typedef berry::WeakPointer< Self > | WeakPtr |
typedef berry::WeakPointer< const Self > | ConstWeakPtr |
Static Public Member Functions inherited from berry::Object | |
static const char * | GetStaticClassName () |
static Reflection::TypeInfo | GetStaticTypeInfo () |
static QList< Reflection::TypeInfo > | GetStaticSuperclasses () |
Public Attributes inherited from berry::IContributionManager | |
const QString & | id |
Protected Attributes inherited from berry::Object | |
QAtomicInt | m_ReferenceCount |
QMutex | m_ReferenceCountLock |
Abstract base class for all contribution managers, and standard implementation of IContributionManager
. This class provides functionality common across the specific managers defined by this framework.
This class maintains a list of contribution items and a dirty flag, both as internal state. In addition to providing implementations of most IContributionManager
methods, this class automatically coalesces adjacent separators, hides beginning and ending separators, and deals with dynamically changing sets of contributions. When the set of contributions does change dynamically, the changes are propagated to the control via the update
method, which subclasses must implement.
Note: A ContributionItem
cannot be shared between different ContributionManager
s.
Definition at line 46 of file berryContributionManager.h.
|
protected |
Creates a new contribution manager.
Definition at line 281 of file berryContributionManager.cpp.
|
override |
Definition at line 32 of file berryContributionManager.cpp.
|
overridevirtual |
Adds a contribution item to this manager.
item | the contribution item, this cannot be null |
Implements berry::IContributionManager.
Definition at line 38 of file berryContributionManager.cpp.
References AllowItem(), berry::SmartPointer< TObjectType >::GetPointer(), and ItemAdded().
|
protectedvirtual |
This method allows subclasses of ContributionManager
to prevent certain items in the contributions list. ContributionManager
will either block or allow an addition based on the result of this method call. This can be used to prevent duplication, for example.
itemToAdd | The contribution item to be added; may be null . |
true
if the addition should be allowed; false
otherwise. The default implementation allows all items. Definition at line 287 of file berryContributionManager.cpp.
Referenced by Add(), Insert(), InsertAfter(), InsertBefore(), and InternalSetItems().
|
overridevirtual |
Adds a contribution item for the given action at the end of the group with the given name. Equivalent to AppendToGroup(groupName,IContributionItem::Pointer(new QActionContributionItem(action, id)))
.
groupName | the name of the group |
action | the action |
id | the unique action id |
ctkInvalidArgumentException | if there is no group with the given name |
Implements berry::IContributionManager.
Definition at line 48 of file berryContributionManager.cpp.
|
overridevirtual |
Adds a contribution item to this manager at the end of the group with the given name.
groupName | the name of the group |
item | the contribution item |
ctkInvalidArgumentException | if there is no group with the given name |
Implements berry::IContributionManager.
Definition at line 53 of file berryContributionManager.cpp.
berry::ContributionManager::berryObjectMacro | ( | berry::ContributionManager | ) |
|
protected |
Internal debug method for printing statistics about this manager to cout
.
Definition at line 292 of file berryContributionManager.cpp.
References BERRY_INFO, IsDirty(), and berry::Object::ToString().
|
overridevirtual |
Finds the contribution item with the given id.
id | the contribution item id |
null
if no item with the given id can be found Implements berry::IContributionManager.
Definition at line 58 of file berryContributionManager.cpp.
Referenced by berry::MenuManager::FindUsingPath(), InsertAfter(), InsertBefore(), and Remove().
|
overridevirtual |
Returns all contribution items known to this manager.
Implements berry::IContributionManager.
Definition at line 73 of file berryContributionManager.cpp.
Referenced by berry::MenuManager::IsVisible(), RemoveAll(), and berry::MenuManager::Update().
|
overridevirtual |
The ContributionManager
implementation of this method declared on IContributionManager
returns the current overrides. If there is no overrides it lazily creates one which overrides no item state.
Implements berry::IContributionManager.
Reimplemented in berry::MenuManager.
Definition at line 83 of file berryContributionManager.cpp.
int berry::ContributionManager::GetSize | ( | ) |
Return the number of contributions in this manager.
Definition at line 78 of file berryContributionManager.cpp.
|
protected |
Returns whether this contribution manager contains dynamic items. A dynamic contribution item contributes items conditionally, dependent on some internal state.
true
if this manager contains dynamic items, and false
otherwise Definition at line 310 of file berryContributionManager.cpp.
Referenced by IsDirty().
int berry::ContributionManager::IndexOf | ( | const QString & | id | ) |
Returns the index of the item with the given id.
id | The id of the item whose index is requested. |
int
the index or -1 if the item is not found Definition at line 101 of file berryContributionManager.cpp.
Referenced by ReplaceItem().
|
protected |
Returns the index of the object in the internal structure. This is different from indexOf(String id)
since some contribution items may not have an id.
item | The contribution item |
Definition at line 315 of file berryContributionManager.cpp.
void berry::ContributionManager::Insert | ( | int | index, |
const SmartPointer< IContributionItem > & | item | ||
) |
Insert the item at the given index.
index | The index to be used for insertion |
item | The item to be inserted |
Definition at line 116 of file berryContributionManager.cpp.
References AllowItem(), berry::SmartPointer< TObjectType >::GetPointer(), and ItemAdded().
|
overridevirtual |
Inserts a contribution item after the item with the given id.
id | the contribution item id |
item | the contribution item to insert |
IllegalArgumentException | if there is no item with the given id |
Implements berry::IContributionManager.
Definition at line 130 of file berryContributionManager.cpp.
References AllowItem(), Find(), berry::SmartPointer< TObjectType >::GetPointer(), berry::SmartPointer< TObjectType >::IsNull(), and ItemAdded().
|
overridevirtual |
Inserts a contribution item before the item with the given id.
id | the contribution item id |
item | the contribution item to insert |
IllegalArgumentException | if there is no item with the given id |
Implements berry::IContributionManager.
Definition at line 149 of file berryContributionManager.cpp.
References AllowItem(), Find(), berry::SmartPointer< TObjectType >::GetPointer(), berry::SmartPointer< TObjectType >::IsNull(), and ItemAdded().
|
protected |
An internal method for setting the order of the contribution items.
items | the contribution items in the specified order |
Definition at line 345 of file berryContributionManager.cpp.
References AllowItem().
|
overridevirtual |
Returns whether the list of contributions has recently changed and has yet to be reflected in the corresponding widgets.
true
if this manager is dirty, and false
if it is up-to-date Implements berry::IContributionManager.
Reimplemented in berry::MenuManager.
Definition at line 168 of file berryContributionManager.cpp.
References HasDynamicItems().
Referenced by DumpStatistics(), berry::MenuManager::IsDirty(), and berry::MenuManager::Update().
|
overridevirtual |
Returns whether this manager has any contribution items.
true
if there are no items, and false
otherwise Implements berry::IContributionManager.
Definition at line 187 of file berryContributionManager.cpp.
|
protected |
The given item was added to the list of contributions. Marks the manager as dirty and updates the number of dynamic items, and the memento.
item | the item to be added |
Definition at line 320 of file berryContributionManager.cpp.
References MarkDirty().
Referenced by Add(), Insert(), InsertAfter(), InsertBefore(), and ReplaceItem().
|
protected |
The given item was removed from the list of contributions. Marks the manager as dirty and updates the number of dynamic items.
item | remove given parent from list of contributions |
Definition at line 330 of file berryContributionManager.cpp.
References MarkDirty().
Referenced by Remove(), RemoveAll(), and ReplaceItem().
|
overridevirtual |
Marks this contribution manager as dirty.
Implements berry::IContributionManager.
Reimplemented in berry::MenuManager.
Definition at line 192 of file berryContributionManager.cpp.
References SetDirty().
Referenced by ItemAdded(), ItemRemoved(), berry::MenuManager::MarkDirty(), and RemoveAll().
|
overridevirtual |
Adds a contribution item to this manager at the beginning of the group with the given name.
groupName | the name of the group |
item | the contribution item |
IllegalArgumentException | if there is no group with the given name |
Implements berry::IContributionManager.
Definition at line 197 of file berryContributionManager.cpp.
|
overridevirtual |
Removes and returns the contribution item with the given id from this manager. Returns null
if this manager has no contribution items with the given id.
id | the contribution item id |
null
if none Implements berry::IContributionManager.
Definition at line 202 of file berryContributionManager.cpp.
References Find(), and berry::SmartPointer< TObjectType >::IsNull().
|
overridevirtual |
Removes the given contribution item from the contribution items known to this manager.
item | the contribution item |
item
parameter if the item was removed, and null
if it was not found Implements berry::IContributionManager.
Definition at line 212 of file berryContributionManager.cpp.
References ItemRemoved().
|
overridevirtual |
Removes all contribution items from this manager.
Implements berry::IContributionManager.
Definition at line 222 of file berryContributionManager.cpp.
References GetItems(), ItemRemoved(), and MarkDirty().
bool berry::ContributionManager::ReplaceItem | ( | const QString & | identifier, |
const SmartPointer< IContributionItem > & | replacementItem | ||
) |
Replaces the item of the given identifier with another contribution item. This can be used, for example, to replace large contribution items with placeholders to avoid memory leaks. If the identifier cannot be found in the current list of items, then this does nothing. If multiple occurrences are found, then the replacement items is put in the first position and the other positions are removed.
identifier | The identifier to look for in the list of contributions; should not be null . |
replacementItem | The contribution item to replace the old item; must not be null . Use remove if that is what you want to do. |
true
if the given identifier can be;
Definition at line 234 of file berryContributionManager.cpp.
References IndexOf(), berry::SmartPointer< TObjectType >::IsNotNull(), ItemAdded(), and ItemRemoved().
|
protected |
Sets whether this manager is dirty. When dirty, the list of contributions is not accurately reflected in the corresponding widgets.
dirty | true if this manager is dirty, and false if it is up-to-date |
Definition at line 340 of file berryContributionManager.cpp.
Referenced by MarkDirty(), and berry::MenuManager::Update().
void berry::ContributionManager::SetOverrides | ( | const SmartPointer< IContributionManagerOverrides > & | newOverrides | ) |
Sets the overrides for this contribution manager
newOverrides | the overrides for the items of this manager |
Definition at line 276 of file berryContributionManager.cpp.
Referenced by berry::MenuManager::GetOverrides(), and berry::MenuManager::SetOverrides().