fw4spl
fwGui::registrar::ToolBarRegistrar Class Reference

Defines the toolBar registrar for IHM. More...

#include <ToolBarRegistrar.hpp>

+ Inheritance diagram for fwGui::registrar::ToolBarRegistrar:
+ Collaboration diagram for fwGui::registrar::ToolBarRegistrar:

Public Types

typedef std::vector< ::fwGui::IMenuItemCallback::sptr > CallbacksType
 
- Public Types inherited from fwGui::GuiBaseObject
typedef ::fwGui::factory::Key Key
 

Public Member Functions

virtual bool isA (const std::string &type) const override
 
FWGUI_API ToolBarRegistrar (const std::string &sid)
 Constructor.
 
virtual FWGUI_API ~ToolBarRegistrar ()
 Destructor. Do nothing.
 
virtual FWGUI_API::fwGui::container::fwToolBar::sptr getParent ()
 Return the parent container.
 
virtual FWGUI_API::fwGui::container::fwMenuItem::sptr getFwMenuItem (std::string actionSid, std::vector< ::fwGui::container::fwMenuItem::sptr > menuItems)
 Return the fwMenuItem associated with the actionSid. More...
 
virtual FWGUI_API void initialize (::fwRuntime::ConfigurationElement::sptr configuration)
 Initialize registry managers. More...
 
virtual FWGUI_API void manage (std::vector< ::fwGui::container::fwMenuItem::sptr > toolBarItems)
 manages action service associated with menuItem of toolbar. More...
 
virtual FWGUI_API void manage (std::vector< ::fwGui::container::fwMenu::sptr > toolBarItems)
 manages menu service associated with item of toolbar. More...
 
virtual FWGUI_API void manage (std::vector< ::fwGui::container::fwContainer::sptr > toolBarItems)
 manages editor service associated with item of toolbar. More...
 
virtual FWGUI_API void unmanage ()
 Stopping toolBar items manager. All services managed in local toolBar items will be stopped.
 
virtual FWGUI_API void onItemAction ()
 This method is called when an action is clicked.
 
virtual CallbacksType getCallbacks ()
 Returns callbacks associate with toolBar items.
 
- Public Member Functions inherited from fwGui::GuiBaseObject
- Public Member Functions inherited from fwCore::BaseObject

Static Public Member Functions

static bool isTypeOf (const std::string &type)
 
- Static Public Member Functions inherited from fwGui::GuiBaseObject
static bool isTypeOf (const std::string &type)
 
static const std::string & classname ()
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
- Static Public Member Functions inherited from fwCore::BaseObject
static bool isTypeOf (const std::string &type)
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Protected Types

typedef ::fwRuntime::ConfigurationElement::sptr ConfigurationType
 
typedef std::map< std::string, std::pair< unsigned int, bool > > SIDToolBarMapType
 
typedef std::map< std::string, unsigned int > WIDToolBarMapType
 

Protected Attributes

SIDToolBarMapType m_actionSids
 All toolBar services ID managed and associated with pair containing: action's index vector and boolean describing if is started by the manager.
 
SIDToolBarMapType m_menuSids
 All toolBar services ID managed and associated with pair containing: menus index vector and boolean describing if is started by the manager.
 
SIDToolBarMapType m_editorSids
 All toolBar services ID managed and associated with pair containing: editors index vector and boolean describing if is started by the manager.
 
WIDToolBarMapType m_editorWids
 All toolBar servicesID managed (and associated with subViews index vector).
 
std::string m_sid
 Main service ID associate with this ToolBarRegistrar.
 
CallbacksType m_callbacks
 Callback associate with toolBar items.
 

Friends

template<class , class , class >
class ::fwTools::ClassFactory
 
class ::fwTools::Factory
 

Demangling methods

virtual const std::string & getLeafClassname () const override
 return object's classname without its namespace, i.e. BaseObject
 
virtual const std::string & getClassname () const override
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Additional Inherited Members

- Protected Member Functions inherited from fwGui::GuiBaseObject
 GuiBaseObject ()
 
virtual ~GuiBaseObject ()
 

Detailed Description

Defines the toolBar registrar for IHM.

Definition at line 28 of file ToolBarRegistrar.hpp.

Member Function Documentation

fwGui::container::fwMenuItem::sptr fwGui::registrar::ToolBarRegistrar::getFwMenuItem ( std::string  actionSid,
std::vector< ::fwGui::container::fwMenuItem::sptr >  menuItems 
)
virtual

Return the fwMenuItem associated with the actionSid.

Parameters
actionSidsid of the action service
menuItemsvector containing the fwMenuItem manages by this registrar.

Definition at line 46 of file ToolBarRegistrar.cpp.

References m_actionSids, and SLM_ASSERT.

void fwGui::registrar::ToolBarRegistrar::initialize ( ::fwRuntime::ConfigurationElement::sptr  configuration)
virtual

Initialize registry managers.

Example of configuration

1 <service uid="toolbar2" type="::fwGui::IToolBarSrv" impl="::gui::aspect::SDefaultToolBar" autoConnect="no" >
2  <gui>
3  <layout>
4  <menuItem name="My item 2" style="radio" icon="TutoGui-0.1/icons/system.png"/>
5  <menuItem name="My item 3" style="radio" icon="TutoGui-0.1/icons/system.png"/>
6  <separator />
7  <menuItem name="My item A" style="radio" icon="TutoGui-0.1/icons/monkey.png"/>
8  <menuItem name="My item B" style="radio" icon="TutoGui-0.1/icons/monkey.png"/>
9  <separator />
10  <menu name="My menu" />
11  <separator />
12  <editor />
13  <editor />
14  </layout>
15  </gui>
16  <registry>
17  <menuItem sid="item2" />
18  <menuItem sid="item3" />
19  <menuItem sid="item4" />
20  <menuItem sid="item5" />
21  <menu sid="menu" />
22  <editor sid="editor" start="yes"/>
23  <editor wid="editorWindow" />
24  </registry>
25 </service>

This method analyzes the registry section of the configuration.

  • <menuItem sid="item2" start="no" /> : define the service of the menuItem to add in the toolbar.
    • sid (mandatory): the service identifier.
    • start = {yes| no} (default value no): indicate if the service must be started by the toolbar service.
  • <editor sid="editor" start="yes" /> : define the service of the editor to add in the toolbar.
    • sid (mandatory): the service identifier.
    • start = {yes| no} (default value no): indicate if the editor service must be started by the service.
  • <editor wid="editorWindow" /> : reserve a sub container for the editor in the toolbar with the name "editorWindow". The service which want to use this sub container will have to define a parent with <parent wid="editorWindow" />.
    • wid (mandatory): the window identifier.

Definition at line 56 of file ToolBarRegistrar.cpp.

References m_actionSids, m_callbacks, m_editorSids, m_editorWids, m_menuSids, OSLM_ASSERT, and SLM_ASSERT.

void fwGui::registrar::ToolBarRegistrar::manage ( std::vector< ::fwGui::container::fwMenuItem::sptr >  toolBarItems)
virtual

manages action service associated with menuItem of toolbar.

Register the menuItem containers for the associated services. Start the services if start=yes.

If a menuItem has attribut start="no", the associated action won't be started and the menuItem will be disabled. If a menuItem has attribut start="yes", two possibilities:

  • the associated action has attribut executable="false" then the menuItem will be disabled.
  • the associated action has attribut executable="true" then the menuItem will be enabled.
    Warning
    If the action is present in a toolbar and a menu it must be started only one time.
    See also
    fwGui::registrar::MenuRegistrar for more information on interaction between menubar and toolbar.
    Precondition
    ToolBarRegistrar must be initialized before.
    sub toolBar items must be instanced before.

Definition at line 150 of file ToolBarRegistrar.cpp.

References fwGui::GuiRegistry::actionServiceStarting(), fwGui::GuiRegistry::actionServiceStopping(), fwTools::fwID::exist(), fwServices::get(), m_actionSids, m_sid, OSLM_ASSERT, and fwGui::GuiRegistry::registerActionSIDToParentSID().

+ Here is the call graph for this function:

void fwGui::registrar::ToolBarRegistrar::manage ( std::vector< ::fwGui::container::fwMenu::sptr >  toolBarItems)
virtual

manages menu service associated with item of toolbar.

Register the menu containers for the associated services. Start the services if start=yes.

Precondition
ToolBarRegistrar must be initialized before.
sub toolBar items must be instanced before.

Definition at line 183 of file ToolBarRegistrar.cpp.

References fwTools::fwID::exist(), m_menuSids, OSLM_ASSERT, and fwGui::GuiRegistry::registerSIDMenu().

+ Here is the call graph for this function:

void fwGui::registrar::ToolBarRegistrar::manage ( std::vector< ::fwGui::container::fwContainer::sptr >  toolBarItems)
virtual

manages editor service associated with item of toolbar.

Register the containers for the associated services. Start the services if start=yes.

Precondition
ToolBarRegistrar must be initialized before.
sub toolBar items must be instanced before.

Definition at line 204 of file ToolBarRegistrar.cpp.

References fwTools::fwID::exist(), m_editorSids, m_editorWids, OSLM_ASSERT, fwGui::GuiRegistry::registerSIDContainer(), and fwGui::GuiRegistry::registerWIDContainer().

+ Here is the call graph for this function:


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