Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
#include <berryMenuManager.h>
Public Member Functions | |
Q_SIGNAL void | AboutToShow (IMenuManager *mm) |
Q_SIGNAL void | AboutToHide (IMenuManager *mm) |
MenuManager (const QString &text=QString(), const QString &id=QString()) | |
~MenuManager () | |
MenuManager (const QString &text, const QIcon &image, const QString &id) | |
bool | IsDirty () const override |
QMenu * | CreateContextMenu (QWidget *parent) |
QMenuBar * | CreateMenuBar (QWidget *parent) |
void | AddMenuListener (QObject *listener) override |
void | RemoveMenuListener (QObject *listener) override |
void | Fill (QStatusBar *parent) override |
void | Fill (QToolBar *parent, QAction *index) override |
void | Fill (QMenu *parent, QAction *before) override |
void | Fill (QMenuBar *parent, QAction *before) override |
IMenuManager::Pointer | FindMenuUsingPath (const QString &path) const override |
IContributionItem::Pointer | FindUsingPath (const QString &path) const override |
QString | GetId () const override |
QMenu * | GetMenu () const |
QString | GetMenuText () const |
QIcon | GetImage () const |
SmartPointer< IContributionManagerOverrides > | GetOverrides () override |
IContributionManager * | GetParent () const |
bool | GetRemoveAllWhenShown () const override |
bool | IsDynamic () const override |
bool | IsEnabled () const override |
bool | IsGroupMarker () const override |
bool | IsSeparator () const override |
bool | IsVisible () const override |
void | MarkDirty () override |
void | SaveWidgetState () override |
void | SetOverrides (SmartPointer< IContributionManagerOverrides > newOverrides) |
void | SetParent (IContributionManager *manager) override |
void | SetRemoveAllWhenShown (bool removeAll) override |
void | SetVisible (bool visible) override |
void | SetCommandId (const QString &definitionId) |
void | Update () override |
void | Update (const QString &property) override |
void | Update (bool force) override |
void | UpdateAll (bool force) override |
Public Member Functions inherited from berry::ContributionManager | |
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 () |
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 | IsEmpty () const 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 | |
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 |
Public Member Functions inherited from berry::IMenuManager | |
berryObjectMacro (berry::IMenuManager) virtual void AddMenuListener(QObject *listener)=0 | |
Public Member Functions inherited from berry::IContributionItem | |
berryObjectMacro (berry::IContributionItem) virtual void Fill(QStatusBar *parent)=0 | |
Public Attributes | |
berryObjectMacro(MenuManager) private QMenuProxy * | menu |
QAction * | menuItem |
QString | menuText |
QIcon | image |
SmartPointer< IContributionManagerOverrides > | overrides |
IContributionManager * | parent |
bool | removeAllWhenShown |
QString | definitionId |
Public Attributes inherited from berry::IContributionManager | |
const QString & | id |
Protected Member Functions | |
void | DoItemFill (IContributionItem::Pointer ci, QAction *before) |
void | Update (bool force, bool recursive) |
Protected Member Functions inherited from berry::ContributionManager | |
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 |
Protected Attributes | |
bool | visible |
Protected Attributes inherited from berry::Object | |
QAtomicInt | m_ReferenceCount |
QMutex | m_ReferenceCountLock |
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 () |
A menu manager is a contribution manager which realizes itself and its items in a menu control; either as a menu bar, a sub-menu, or a context menu.
This class may be instantiated; it may also be subclassed.
Definition at line 41 of file berryMenuManager.h.
berry::MenuManager::MenuManager | ( | const QString & | text = QString() , |
const QString & | id = QString() |
||
) |
Creates a menu manager with the given text and id. Typically no text is given when creating a context menu. Supply a text and id for creating a sub-menu, where it needs to be referred to by the id.
text | the text for the menu, or "" if none |
id | the menu id, or "" if it is to have no id |
Definition at line 127 of file berryMenuManager.cpp.
berry::MenuManager::~MenuManager | ( | ) |
Definition at line 148 of file berryMenuManager.cpp.
References menu.
berry::MenuManager::MenuManager | ( | const QString & | text, |
const QIcon & | image, | ||
const QString & | id | ||
) |
Creates a menu manager with the given text, image, and id. Typically used for creating a sub-menu, where it needs to be referred to by id.
text | the text for the menu, or "" if none |
image | the image for the menu, or ImageDescriptor::Pointer(0) if none |
id | the menu id, or "" if it is to have no id |
Definition at line 135 of file berryMenuManager.cpp.
Q_SIGNAL void berry::MenuManager::AboutToHide | ( | IMenuManager * | mm | ) |
Referenced by AddMenuListener().
Q_SIGNAL void berry::MenuManager::AboutToShow | ( | IMenuManager * | mm | ) |
Referenced by AddMenuListener().
|
override |
Definition at line 173 of file berryMenuManager.cpp.
References AboutToHide(), and AboutToShow().
QMenu * berry::MenuManager::CreateContextMenu | ( | QWidget * | parent | ) |
Creates and returns a Qt menu control for this menu, and installs all registered contributions. Does not create a new control if one already exists.
Note that the menu is not expected to be dynamic.
parent | the parent control |
Definition at line 153 of file berryMenuManager.cpp.
QMenuBar * berry::MenuManager::CreateMenuBar | ( | QWidget * | parent | ) |
Creates and returns a Qt menu bar control for this menu, for use in the given QWidget
, and installs all registered contributions. Does not create a new control if one already exists.
parent | the parent decorations |
Definition at line 163 of file berryMenuManager.cpp.
References Update().
|
protected |
Call an IContributionItem
's fill method with the implementation's widget. The default is to use the Menu
widget.
fill(Menu menu, int index)
ci | An IContributionItem whose fill() method should be called. |
index | The position the fill() method should start inserting at. |
Definition at line 486 of file berryMenuManager.cpp.
Referenced by Update().
|
override |
Definition at line 184 of file berryMenuManager.cpp.
|
overridevirtual |
Fills the given tool bar with controls representing this contribution item. Used by ToolBarManager
.
parent | the parent tool bar |
index | the index where the controls are inserted, or -1 to insert at the end |
Implements berry::IContributionItem.
Definition at line 188 of file berryMenuManager.cpp.
|
overridevirtual |
Fills the given menu with controls representing this contribution item. Used by MenuManager
.
parent | the parent menu |
index | the index where the controls are inserted, or -1 to insert at the end |
Implements berry::IContributionItem.
Definition at line 192 of file berryMenuManager.cpp.
|
overridevirtual |
Fills the given menu bar with controls representing this contribution item. Used by MenuBarManager
.
parent | the parent menu |
index | the index where the controls are inserted, or -1 to insert at the end |
Implements berry::IContributionItem.
Definition at line 197 of file berryMenuManager.cpp.
|
overridevirtual |
Finds the manager for the menu at the given path. A path consists of contribution item ids separated by the separator character. The path separator character is '/'
.
Convenience for findUsingPath(path)
which extracts an IMenuManager
if possible.
path | the path string |
null
if there is no such contribution item or if the item does not have an associated menu manager Implements berry::IMenuManager.
Definition at line 229 of file berryMenuManager.cpp.
References berry::SmartPointer< TObjectType >::Cast(), and FindUsingPath().
|
overridevirtual |
Finds the contribution item at the given path. A path consists of contribution item ids separated by the separator character. The path separator character is '/'
.
path | the path string |
null
if there is no such contribution item Implements berry::IMenuManager.
Definition at line 239 of file berryMenuManager.cpp.
References berry::SmartPointer< TObjectType >::Cast(), berry::ContributionManager::Find(), and berry::IContributionManager::id.
Referenced by FindMenuUsingPath().
|
overridevirtual |
Returns the menu id. The menu id is used when creating a contribution item for adding this menu as a sub menu of another.
Implements berry::IContributionItem.
Definition at line 262 of file berryMenuManager.cpp.
References berry::IContributionManager::id.
QIcon berry::MenuManager::GetImage | ( | void | ) | const |
Returns the image for this menu as an image descriptor.
null
if this menu has no image Definition at line 292 of file berryMenuManager.cpp.
References image.
QMenu * berry::MenuManager::GetMenu | ( | ) | const |
Returns the SWT menu control for this menu manager.
Definition at line 267 of file berryMenuManager.cpp.
QString berry::MenuManager::GetMenuText | ( | ) | const |
Returns the text shown in the menu, potentially with a shortcut appended.
Definition at line 272 of file berryMenuManager.cpp.
References definitionId, and menuText.
Referenced by 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.
Reimplemented from berry::ContributionManager.
Definition at line 297 of file berryMenuManager.cpp.
References overrides, and berry::ContributionManager::SetOverrides().
IContributionManager * berry::MenuManager::GetParent | ( | ) | const |
Returns the parent contribution manager of this manger.
Definition at line 314 of file berryMenuManager.cpp.
References parent.
Referenced by MarkDirty().
|
overridevirtual |
Returns whether all items should be removed when the menu is about to show, but before notifying menu listeners. The default is false
.
true
if all items should be removed when shown, false
if not Implements berry::IMenuManager.
Definition at line 319 of file berryMenuManager.cpp.
References removeAllWhenShown.
|
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 Reimplemented from berry::ContributionManager.
Definition at line 143 of file berryMenuManager.cpp.
References berry::ContributionManager::IsDirty().
|
overridevirtual |
Returns whether this contribution item is dynamic. A dynamic contribution item contributes items conditionally, dependent on some internal state.
true
if this item is dynamic, and false
for normal items Implements berry::IContributionItem.
Definition at line 324 of file berryMenuManager.cpp.
|
overridevirtual |
Returns whether this menu should be enabled or not. Used to enable the menu item containing this menu when it is realized as a sub-menu.
The default implementation of this framework method returns true
. Subclasses may reimplement.
true
if enabled, and false
if disabled Implements berry::IMenuManager.
Definition at line 329 of file berryMenuManager.cpp.
|
overridevirtual |
Returns whether this contribution item is a group marker. This information is used when adding items to a group.
true
if this item is a group marker, and false
for normal itemsImplements berry::IContributionItem.
Definition at line 334 of file berryMenuManager.cpp.
|
overridevirtual |
Returns whether this contribution item is a separator. This information is used to enable hiding of unnecessary separators.
true
if this item is a separator, and false
for normal items Implements berry::IContributionItem.
Definition at line 339 of file berryMenuManager.cpp.
|
overridevirtual |
Returns whether this contribution item is visibile within its manager.
true
if this item is visible, and false
otherwise Implements berry::IContributionItem.
Definition at line 344 of file berryMenuManager.cpp.
References berry::ContributionManager::GetItems(), removeAllWhenShown, and visible.
|
overridevirtual |
The MenuManager
implementation of this ContributionManager
method also propagates the dirty flag up the parent chain.
Reimplemented from berry::ContributionManager.
Definition at line 371 of file berryMenuManager.cpp.
References GetParent(), berry::ContributionManager::MarkDirty(), and berry::IContributionManager::MarkDirty().
|
overridevirtual |
Removes the given menu listener from this menu. Has no effect if an identical listener is not registered.
listener | the menu listener |
Implements berry::IMenuManager.
Definition at line 179 of file berryMenuManager.cpp.
|
overridevirtual |
Saves any state information of the control(s) owned by this contribution item. The contribution manager calls this method before disposing of the controls.
Implements berry::IContributionItem.
Definition at line 388 of file berryMenuManager.cpp.
void berry::MenuManager::SetCommandId | ( | const QString & | definitionId | ) |
Sets the command id of this action. This simply allows the menu item text to include a short cut if available. It can be used to notify a user of a key combination that will open a quick menu.
definitionId | the command definition id |
Definition at line 413 of file berryMenuManager.cpp.
References definitionId.
void berry::MenuManager::SetOverrides | ( | SmartPointer< IContributionManagerOverrides > | newOverrides | ) |
Sets the overrides for this contribution manager
newOverrides | the overrides for the items of this manager |
Definition at line 392 of file berryMenuManager.cpp.
References overrides, and berry::ContributionManager::SetOverrides().
|
overridevirtual |
Sets the parent manager of this item
parent | the parent contribution manager |
Implements berry::IContributionItem.
Definition at line 398 of file berryMenuManager.cpp.
|
overridevirtual |
Sets whether all items should be removed when the menu is about to show, but before notifying menu listeners.
removeAll | true if all items should be removed when shown, false if not |
Implements berry::IMenuManager.
Definition at line 403 of file berryMenuManager.cpp.
References removeAllWhenShown.
|
overridevirtual |
Sets whether this contribution item is visibile within its manager.
visible | true if this item should be visible, and false otherwise |
Implements berry::IContributionItem.
Definition at line 408 of file berryMenuManager.cpp.
References visible.
|
overridevirtual |
Updates any controls cached by this contribution item with any changes which have been made to this contribution item since the last update. Called by contribution manager update methods.
Implements berry::IContributionItem.
Definition at line 418 of file berryMenuManager.cpp.
Referenced by CreateMenuBar(), Update(), and UpdateAll().
|
overridevirtual |
Updates any controls cached by this contribution item with changes for the the given property.
id | the id of the changed property |
Implements berry::IContributionItem.
Definition at line 423 of file berryMenuManager.cpp.
References berry::ContributionManager::GetItems(), GetMenuText(), berry::QActionProperties::IMAGE, image, and berry::QActionProperties::TEXT.
|
overridevirtual |
The MenuManager
implementation of this IContributionManager
updates this menu, but not any of its submenus.
Implements berry::IContributionManager.
Definition at line 449 of file berryMenuManager.cpp.
References Update().
|
protected |
Incrementally builds the menu from the contribution items. This method leaves out double separators and separators in the first or last position.
force | true means update even if not dirty, and false for normal incremental updating |
recursive | true means recursively update all submenus, and false means just this menu |
Definition at line 498 of file berryMenuManager.cpp.
References berry::SmartPointer< TObjectType >::Cast(), DoItemFill(), berry::ContributionManager::GetItems(), berry::ContributionManager::IsDirty(), and berry::ContributionManager::SetDirty().
|
overridevirtual |
Incrementally builds the menu from the contribution items, and does so recursively for all submenus.
force | true means update even if not dirty, and false for normal incremental updating |
Implements berry::IMenuManager.
Definition at line 454 of file berryMenuManager.cpp.
References Update().
QString berry::MenuManager::definitionId |
allows a submenu to display a shortcut key. This is often used with the QuickMenu command or action which can pop up a menu using the shortcut.
Definition at line 100 of file berryMenuManager.h.
Referenced by GetMenuText(), and SetCommandId().
QIcon berry::MenuManager::image |
The image for a sub-menu.
Definition at line 78 of file berryMenuManager.h.
Referenced by GetImage(), and Update().
berryObjectMacro (MenuManager) private QMenuProxy* berry::MenuManager::menu |
The menu id. The menu control; null
before creation and after disposal.
Definition at line 47 of file berryMenuManager.h.
Referenced by ~MenuManager().
QAction* berry::MenuManager::menuItem |
Definition at line 61 of file berryMenuManager.h.
QString berry::MenuManager::menuText |
The menu item widget; null
before creation and after disposal. This field is used when this menu manager is a sub-menu. The text for a sub-menu.
Definition at line 73 of file berryMenuManager.h.
Referenced by GetMenuText().
SmartPointer<IContributionManagerOverrides> berry::MenuManager::overrides |
The overrides for items of this manager
Definition at line 83 of file berryMenuManager.h.
Referenced by GetOverrides(), and SetOverrides().
IContributionManager* berry::MenuManager::parent |
The parent contribution manager.
Definition at line 88 of file berryMenuManager.h.
Referenced by GetParent().
bool berry::MenuManager::removeAllWhenShown |
Indicates whether removeAll
should be called just before the menu is displayed.
Definition at line 94 of file berryMenuManager.h.
Referenced by GetRemoveAllWhenShown(), IsVisible(), and SetRemoveAllWhenShown().
|
protected |
Indicates this item is visible in its manager; true
by default.
Definition at line 113 of file berryMenuManager.h.
Referenced by IsVisible(), and SetVisible().