fw4spl
IMenuLayoutManager.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_IMENULAYOUTMANAGER_HPP__
13 #define __FWGUI_LAYOUTMANAGER_IMENULAYOUTMANAGER_HPP__
14 
15 #include "fwGui/config.hpp"
16 #include "fwGui/container/fwMenu.hpp"
17 #include "fwGui/container/fwMenuItem.hpp"
18 #include "fwGui/GuiBaseObject.hpp"
19 #include "fwGui/IMenuItemCallback.hpp"
20 
21 #include <fwRuntime/ConfigurationElement.hpp>
22 
23 #include <boost/filesystem/path.hpp>
24 
25 namespace fwGui
26 {
27 namespace layoutManager
28 {
29 
33 class FWGUI_CLASS_API IMenuLayoutManager : public ::fwGui::GuiBaseObject
34 {
35 public:
37 
38  typedef ::fwRuntime::ConfigurationElement::sptr ConfigurationType;
39  typedef std::string RegistryKeyType;
40  typedef std::vector< ::fwGui::IMenuItemCallback::sptr > CallbacksType;
41 
42  typedef enum
43  {
44  DEFAULT,
45  QUIT,
46  ABOUT,
47  HELP,
48  NEW,
49  SEPARATOR
50  }ActionType;
51 
52  class ActionInfo
53  {
54  public:
55 
56  ActionInfo() :
57  m_name(""),
58  m_shortcut(""),
59  m_icon(""),
60  m_isCheckable(false),
61  m_isRadio(false),
62  m_type(DEFAULT),
63  m_isSeparator(false),
64  m_isMenu(false)
65  {
66  }
67 
68  std::string m_name;
69  std::string m_shortcut;
70  ::boost::filesystem::path m_icon;
71  bool m_isCheckable;
72  bool m_isRadio;
73  ActionType m_type;
74  bool m_isSeparator;
75  bool m_isMenu;
76  };
77 
78  FWGUI_API const static RegistryKeyType REGISTRY_KEY;
79 
81  FWGUI_API IMenuLayoutManager();
82 
84  FWGUI_API virtual ~IMenuLayoutManager();
85 
89  FWGUI_API virtual std::vector< ::fwGui::container::fwMenuItem::sptr > getMenuItems();
90 
94  FWGUI_API virtual std::vector< ::fwGui::container::fwMenu::sptr > getMenus();
95 
136  FWGUI_API virtual void initialize( ConfigurationType configuration);
137 
141  FWGUI_API virtual void createLayout( ::fwGui::container::fwMenu::sptr parent ) = 0;
142 
147  FWGUI_API virtual void destroyLayout() = 0;
148 
152  FWGUI_API virtual void menuItemSetVisible(::fwGui::container::fwMenuItem::sptr, bool isVisible) = 0;
153 
157  FWGUI_API virtual void menuItemSetEnabled(::fwGui::container::fwMenuItem::sptr, bool isEnabled) = 0;
158 
162  FWGUI_API virtual void menuItemSetChecked(::fwGui::container::fwMenuItem::sptr, bool isChecked) = 0;
163 
167  virtual void setCallbacks(CallbacksType callbacks)
168  {
169  m_callbacks = callbacks;
170  }
171 
172 protected:
173 
177  FWGUI_API virtual void destroyActions();
178 
180  std::vector< ::fwGui::container::fwMenuItem::sptr > m_menuItems;
181 
183  std::vector< ::fwGui::container::fwMenu::sptr > m_menus;
184 
186  std::vector< ActionInfo > m_actionInfo;
187 
189  CallbacksType m_callbacks;
190 };
191 
192 } // namespace layoutManager
193 } // namespace fwGui
194 
195 #endif /*__FWGUI_LAYOUTMANAGER_IMENULAYOUTMANAGER_HPP__*/
196 
#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
STL namespace.
std::vector< ::fwGui::container::fwMenu::sptr > m_menus
All menus managed by this layout.
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
std::vector< ActionInfo > m_actionInfo
Save action informations from configuration.
std::vector< ::fwGui::container::fwMenuItem::sptr > m_menuItems
All actions managed by this layout.
Defines the menu layout manager for IHM.
CallbacksType m_callbacks
Callbacks associate with menu items.
Base class for all fwGui&#39;s classes.
virtual void setCallbacks(CallbacksType callbacks)
Sets callbacks associate with menu items.