Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
berry::ActionBarAdvisor Class Reference

#include <berryActionBarAdvisor.h>

Inheritance diagram for berry::ActionBarAdvisor:
Collaboration diagram for berry::ActionBarAdvisor:

Public Types

enum  FillType { FILL_PROXY, FILL_MENU_BAR, FILL_TOOL_BAR, FILL_STATUS_LINE }
 
- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 

Public Member Functions

 berryObjectMacro (berry::ActionBarAdvisor)
 
 ~ActionBarAdvisor () override
 
 ActionBarAdvisor (const SmartPointer< IActionBarConfigurer > &configurer)
 
virtual void FillActionBars (FillFlags flags)
 
virtual bool SaveState (SmartPointer< IMemento > memento)
 
virtual bool RestoreState (SmartPointer< IMemento > memento)
 
void Register () const
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () 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

virtual SmartPointer< IActionBarConfigurerGetActionBarConfigurer () const
 
virtual void MakeActions (IWorkbenchWindow *window)
 
virtual void Register (QAction *action, const QString &id)
 
virtual QAction * GetAction (const QString &id) const
 
virtual void FillMenuBar (IMenuManager *menuBar)
 
virtual void FillToolBar (IToolBarManager *toolBar)
 
virtual void FillStatusLine (IStatusLineManager *statusLine)
 
- 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

- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

Public base class for configuring the action bars of a workbench window.

An application should declare a subclass of ActionBarAdvisor and override methods to configure a window's action bars to suit the needs of the particular application.

The following advisor methods are called at strategic points in the workbench's lifecycle (all occur within the dynamic scope of the call to berry::PlatformUI::CreateAndRunWorkbench()):

See also
berry::WorkbenchWindowAdvisor::CreateActionBarAdvisor()

Definition at line 51 of file berryActionBarAdvisor.h.

Member Enumeration Documentation

◆ FillType

Enumerator
FILL_PROXY 

Bit flag for FillActionBars() indicating that the operation is not filling the action bars of an actual workbench window, but rather a proxy (used for perspective customization).

FILL_MENU_BAR 

Bit flag for FillActionBars() indicating that the operation is supposed to fill (or describe) the workbench window's menu bar.

FILL_TOOL_BAR 

Bit flag for FillActionBars() indicating that the operation is supposed to fill (or describe) the workbench window's cool bar.

FILL_STATUS_LINE 

Bit flag for FillActionBars() indicating that the operation is supposed to fill (or describe) the workbench window's status line.

Definition at line 58 of file berryActionBarAdvisor.h.

Constructor & Destructor Documentation

◆ ~ActionBarAdvisor()

berry::ActionBarAdvisor::~ActionBarAdvisor ( )
override

◆ ActionBarAdvisor()

berry::ActionBarAdvisor::ActionBarAdvisor ( const SmartPointer< IActionBarConfigurer > &  configurer)

Creates a new action bar advisor to configure a workbench window's action bars via the given action bar configurer.

Parameters
configurerthe action bar configurer

Member Function Documentation

◆ berryObjectMacro()

berry::ActionBarAdvisor::berryObjectMacro ( berry::ActionBarAdvisor  )

◆ FillActionBars()

virtual void berry::ActionBarAdvisor::FillActionBars ( FillFlags  flags)
virtual

Configures the action bars using the given action bar configurer. Under normal circumstances, flags does not include FILL_PROXY, meaning this is a request to fill the action bars of the corresponding workbench window; the remaining flags indicate which combination of the menu bar (FILL_MENU_BAR), the tool bar (FILL_TOOL_BAR), and the status line (FILL_STATUS_LINE) are to be filled.

If flags does include FILL_PROXY, then this is a request to describe the actions bars of the given workbench window (which will already have been filled); again, the remaining flags indicate which combination of the menu bar, the tool bar, and the status line are to be described. The actions included in the proxy action bars can be the same instances as in the actual window's action bars.

This method is called just after berry::WorkbenchWindowAdvisor::PreWindowOpen(). Clients must not call this method directly (although super calls are okay). The default implementation calls MakeActions() if FILL_PROXY is specified, then calls FillMenuBar(), FillToolBar(), and FillStatusLine() if the corresponding flags are specified.

Subclasses may override, but it is recommended that they override the methods mentioned above instead.

Parameters
flagsbit mask composed from the constants FILL_MENU_BAR, FILL_TOOL_BAR, FILL_STATUS_LINE, and FILL_PROXY

◆ FillMenuBar()

virtual void berry::ActionBarAdvisor::FillMenuBar ( IMenuManager menuBar)
protectedvirtual

Fills the menu bar with the main menus for the window.

The default implementation does nothing. Subclasses may override.

Parameters
menuBarthe menu manager for the menu bar

Reimplemented in QmitkExtActionBarAdvisor.

◆ FillStatusLine()

virtual void berry::ActionBarAdvisor::FillStatusLine ( IStatusLineManager *  statusLine)
protectedvirtual

Fills the status line with the main status line contributions for the window.

The default implementation does nothing. Subclasses may override.

Parameters
statusLinethe status line manager

◆ FillToolBar()

virtual void berry::ActionBarAdvisor::FillToolBar ( IToolBarManager *  toolBar)
protectedvirtual

Fills the tool bar with the main toolbars for the window.

The default implementation does nothing. Subclasses may override.

Parameters
toolBarthe bar manager

◆ GetAction()

virtual QAction* berry::ActionBarAdvisor::GetAction ( const QString &  id) const
protectedvirtual

Returns the action with the given id, or null if not found.

Parameters
idthe action id
Returns
the action with the given id, or null if not found

◆ GetActionBarConfigurer()

virtual SmartPointer<IActionBarConfigurer> berry::ActionBarAdvisor::GetActionBarConfigurer ( ) const
protectedvirtual

Returns the action bar configurer.

Returns
the action bar configurer

◆ MakeActions()

virtual void berry::ActionBarAdvisor::MakeActions ( IWorkbenchWindow window)
protectedvirtual

Instantiates the actions used in the fill methods. Use Register() to add it to the list of actions to be disposed when the window is closed.

Parameters
windowthe window containing the action bars

Reimplemented in QmitkExtActionBarAdvisor.

◆ Register() [1/2]

void berry::Object::Register

Increase the reference count (mark as used by another object).

◆ Register() [2/2]

virtual void berry::ActionBarAdvisor::Register ( QAction *  action,
const QString &  id 
)
protectedvirtual

Adds the given action to the list of actions to be disposed when the window is closed.

Parameters
actionthe action to register, this cannot be null
idthe unique action id

◆ RestoreState()

virtual bool berry::ActionBarAdvisor::RestoreState ( SmartPointer< IMemento memento)
virtual

Restores arbitrary application-specific state information for this action bar advisor.

The default implementation simply returns an OK status. Subclasses may extend or override.

Parameters
mementothe memento from which to restore the advisor's state
Returns
a status object indicating whether the restore was successful

◆ SaveState()

virtual bool berry::ActionBarAdvisor::SaveState ( SmartPointer< IMemento memento)
virtual

Saves arbitrary application-specific state information for this action bar advisor.

The default implementation simply returns an OK status. Subclasses may extend or override.

Parameters
mementothe memento in which to save the advisor's state
Returns
a status object indicating whether the save was successful

The documentation for this class was generated from the following file: