fw4spl
IMenuBarLayoutManager.cpp
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
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 
14 
15 namespace fwGui
16 {
17 namespace layoutManager
18 {
19 
20 const IMenuBarLayoutManager::RegistryKeyType IMenuBarLayoutManager::REGISTRY_KEY = "::fwGui::MenuBarLayoutManager";
21 
22 //-----------------------------------------------------------------------------
23 
25 {
26 }
27 
28 //-----------------------------------------------------------------------------
29 
31 {
32 }
33 
34 //-----------------------------------------------------------------------------
35 
36 void IMenuBarLayoutManager::initialize( ConfigurationType configuration)
37 {
38  OSLM_ASSERT("Bad configuration name "<<configuration->getName()<< ", must be layout",
39  configuration->getName() == "layout");
40 
41  std::vector < ConfigurationType > vectMenus = configuration->find("menu");
42  SLM_TRACE_IF("No menu define.", vectMenus.empty() );
43  m_menus.clear();
44  for (ConfigurationType menu : vectMenus)
45  {
46  SLM_ASSERT("missing <name> attribute", menu->hasAttribute("name"));
47  if( menu->hasAttribute("name") )
48  {
49  std::string name = menu->getExistingAttributeValue("name");
50  m_menuNames.push_back(name);
51  }
52  }
53 }
54 
55 //-----------------------------------------------------------------------------
56 
58 {
59  for( ::fwGui::container::fwMenu::sptr menu : m_menus)
60  {
61  menu->destroyContainer();
62  }
63  m_menus.clear();
64 }
65 
66 //-----------------------------------------------------------------------------
67 
68 std::vector< ::fwGui::container::fwMenu::sptr > IMenuBarLayoutManager::getMenus()
69 {
70  return this->m_menus;
71 }
72 
73 //-----------------------------------------------------------------------------
74 
75 } // namespace layoutManager
76 } // namespace fwGui
77 
78 
79 
#define SLM_TRACE_IF(message, cond)
Definition: spyLog.hpp:232
#define OSLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:310
The namespace fwGui contains the base interface for IHM services.
Definition: SJobBar.hpp:23
virtual FWGUI_API void initialize(ConfigurationType configuration)
Initialize layout managers.
FWGUI_API IMenuBarLayoutManager()
Constructor. Do nothing.
virtual FWGUI_API void destroyMenus()
Helper to destroy local sub views.
std::vector< std::string > m_menuNames
Save menu name from configuration.
#define SLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:308
std::vector< ::fwGui::container::fwMenu::sptr > m_menus
All sub containers managed by this layout.
virtual FWGUI_API std::vector< ::fwGui::container::fwMenu::sptr > getMenus()
Returns the vector of fwMenu managed by this layout.
This file defines the interface of the base class for managing a menubar.
virtual FWGUI_API ~IMenuBarLayoutManager()
Destructor. Do nothing.