fw4spl
IToolBarLayoutManager.hpp
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
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 
12 #ifndef __FWGUI_LAYOUTMANAGER_ITOOLBARLAYOUTMANAGER_HPP__
13 #define __FWGUI_LAYOUTMANAGER_ITOOLBARLAYOUTMANAGER_HPP__
14 
15 #include "fwGui/config.hpp"
16 #include "fwGui/container/fwContainer.hpp"
17 #include "fwGui/container/fwMenu.hpp"
18 #include "fwGui/container/fwMenuItem.hpp"
19 #include "fwGui/container/fwToolBar.hpp"
20 #include "fwGui/GuiBaseObject.hpp"
21 #include "fwGui/IMenuItemCallback.hpp"
22 
23 #include <fwRuntime/ConfigurationElement.hpp>
24 
25 #include <boost/filesystem/path.hpp>
26 
27 namespace fwGui
28 {
29 namespace layoutManager
30 {
31 
35 class FWGUI_CLASS_API IToolBarLayoutManager : public ::fwGui::GuiBaseObject
36 {
37 public:
39 
40  typedef ::fwRuntime::ConfigurationElement::sptr ConfigurationType;
41  typedef std::string RegistryKeyType;
42  typedef std::vector< ::fwGui::IMenuItemCallback::sptr > CallbacksType;
43 
44  class ActionInfo
45  {
46  public:
47 
48  ActionInfo() :
49  m_name(""),
50  m_shortcut(""),
51  m_icon(""),
52  m_icon2(""),
53  m_isCheckable(false),
54  m_isRadio(false),
55  m_isSeparator(false),
56  m_isSpacer(false),
57  m_isMenu(false),
58  m_isEditor(false),
59  m_size(0)
60  {
61  }
62 
63  std::string m_name;
64  std::string m_shortcut;
65  ::boost::filesystem::path m_icon;
66  ::boost::filesystem::path m_icon2;
67  bool m_isCheckable;
68  bool m_isRadio;
69  bool m_isSeparator;
70  bool m_isSpacer;
71  bool m_isMenu;
72  bool m_isEditor;
73  int m_size;
74  };
75 
76  FWGUI_API const static RegistryKeyType REGISTRY_KEY;
77 
79  FWGUI_API IToolBarLayoutManager();
80 
82  FWGUI_API virtual ~IToolBarLayoutManager();
83 
87  FWGUI_API virtual std::vector< ::fwGui::container::fwMenuItem::sptr > getMenuItems();
88 
92  FWGUI_API virtual std::vector< ::fwGui::container::fwMenu::sptr > getMenus();
93 
97  FWGUI_API virtual std::vector< ::fwGui::container::fwContainer::sptr > getContainers();
98 
143  FWGUI_API virtual void initialize( ConfigurationType configuration);
144 
148  FWGUI_API virtual void createLayout( ::fwGui::container::fwToolBar::sptr parent ) = 0;
149 
154  FWGUI_API virtual void destroyLayout() = 0;
155 
159  FWGUI_API virtual void menuItemSetVisible(::fwGui::container::fwMenuItem::sptr, bool isVisible) = 0;
160 
164  FWGUI_API virtual void menuItemSetEnabled(::fwGui::container::fwMenuItem::sptr, bool isEnabled) = 0;
165 
169  FWGUI_API virtual void menuItemSetChecked(::fwGui::container::fwMenuItem::sptr, bool isChecked) = 0;
170 
174  virtual void setCallbacks(CallbacksType callbacks)
175  {
176  m_callbacks = callbacks;
177  }
178 
179 protected:
180 
184  FWGUI_API virtual void destroyActions();
185 
187  std::vector< ::fwGui::container::fwMenuItem::sptr > m_menuItems;
188 
190  std::vector< ::fwGui::container::fwMenu::sptr > m_menus;
191 
193  std::vector< ::fwGui::container::fwContainer::sptr > m_containers;
194 
196  std::vector< ActionInfo > m_actionInfo;
197 
199  CallbacksType m_callbacks;
200 };
201 
202 } // namespace layoutManager
203 } // namespace fwGui
204 
205 #endif /*__FWGUI_LAYOUTMANAGER_ITOOLBARLAYOUTMANAGER_HPP__*/
206 
std::vector< ::fwGui::container::fwMenu::sptr > m_menus
All menus managed by this layout.
#define fwCoreNonInstanciableClassDefinitionsMacro(_classinfo_)
Generate common code for Non Instanciable classes (Interfaces, Abstract classes, ...)
Defines the menu item callback.
The namespace fwGui contains the base interface for IHM services.
Definition: SJobBar.hpp:23
std::vector< ::fwGui::container::fwMenuItem::sptr > m_menuItems
All actions managed by this layout.
STL namespace.
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
Defines the toolBar layout manager for IHM.
std::vector< ::fwGui::container::fwContainer::sptr > m_containers
All editors managed by this layout.
Base class for all fwGui&#39;s classes.
std::vector< ActionInfo > m_actionInfo
Save action informations from configuration.
CallbacksType m_callbacks
Callbacks associate with toolBar items.
virtual void setCallbacks(CallbacksType callbacks)
Sets callbacks associate with toolBar items.