fw4spl
MenuRegistrar.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2016.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWGUI_REGISTRAR_MENUREGISTRAR_HPP__
8 #define __FWGUI_REGISTRAR_MENUREGISTRAR_HPP__
9 
10 #include <fwRuntime/ConfigurationElement.hpp>
11 
12 #include "fwGui/GuiBaseObject.hpp"
13 #include "fwGui/container/fwMenu.hpp"
14 #include "fwGui/container/fwMenuItem.hpp"
15 #include "fwGui/ActionCallbackBase.hpp"
16 #include "fwGui/config.hpp"
17 
18 
19 namespace fwGui
20 {
21 namespace registrar
22 {
23 
31 class FWGUI_CLASS_API MenuRegistrar : public ::fwGui::GuiBaseObject
32 {
33 
34 public:
35 
38  typedef std::vector< ::fwGui::IMenuItemCallback::sptr > CallbacksType;
39 
41  FWGUI_API MenuRegistrar( const std::string &sid);
42 
44  FWGUI_API virtual ~MenuRegistrar();
45 
47  FWGUI_API virtual ::fwGui::container::fwMenu::sptr getParent();
48 
54  FWGUI_API virtual ::fwGui::container::fwMenuItem::sptr getFwMenuItem(std::string actionSid,
55  std::vector< ::fwGui::container::fwMenuItem::sptr > menuItems);
56 
89  FWGUI_API virtual void initialize( ::fwRuntime::ConfigurationElement::sptr configuration);
90 
109  FWGUI_API virtual void manage(std::vector< ::fwGui::container::fwMenuItem::sptr > menuItems );
110 
120  FWGUI_API virtual void manage(std::vector< ::fwGui::container::fwMenu::sptr > menus );
121 
126  FWGUI_API virtual void unmanage();
127 
131  FWGUI_API virtual void onItemAction();
132 
136  virtual CallbacksType getCallbacks()
137  {
138  return m_callbacks;
139  }
140 
141 protected:
142 
143  typedef ::fwRuntime::ConfigurationElement::sptr ConfigurationType;
144  typedef std::map< std::string, std::pair<unsigned int, bool> > SIDMenuMapType;
145 
150  SIDMenuMapType m_actionSids;
151 
156  SIDMenuMapType m_menuSids;
157 
159  std::string m_sid;
160 
162  CallbacksType m_callbacks;
163 };
164 
165 } // namespace registrar
166 } // namespace fwGui
167 
168 #endif /*__FWGUI_REGISTRAR_MENUREGISTRAR_HPP__*/
169 
170 
The namespace fwGui contains the base interface for IHM services.
Definition: SJobBar.hpp:23
Defines the menu registrar for IHM.
SIDMenuMapType m_actionSids
All menu services ID (sid) managed is associated with pair containing: an action&#39;s position in the me...
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
std::string m_sid
Main service ID associate with this MenuRegistrar.
SIDMenuMapType m_menuSids
All toolBar services ID managed and associated with pair containing: menu&#39;s index vector and boolean ...
Base class for all fwGui&#39;s classes.
virtual CallbacksType getCallbacks()
Returns callbacks associate with menu items.
CallbacksType m_callbacks
Callback associate with menu items.