fw4spl
TabLayoutManagerBase.cpp
Go to the documentation of this file.
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 
15 #include "fwGui/layoutManager/TabLayoutManagerBase.hpp"
16 
17 #include <fwCore/base.hpp>
18 
19 #include <boost/lexical_cast.hpp>
20 #include <boost/assign/list_of.hpp>
21 
22 namespace fwGui
23 {
24 
25 namespace layoutManager
26 {
27 //-----------------------------------------------------------------------------
28 
29 const TabLayoutManagerBase::RegistryKeyType TabLayoutManagerBase::REGISTRY_KEY = "::fwGui::TabLayoutManager";
30 
31 //-----------------------------------------------------------------------------
32 
34 {
35 }
36 
37 //-----------------------------------------------------------------------------
38 
40 {
41 }
42 
43 //-----------------------------------------------------------------------------
44 
45 void TabLayoutManagerBase::initialize( ConfigurationType configuration)
46 {
47  OSLM_ASSERT("Bad configuration name "<<configuration->getName()<< ", must be layout",
48  configuration->getName() == "layout");
49 
50  std::vector < ConfigurationType > vectViews = configuration->find("view");
51  SLM_TRACE_IF("No view define.", vectViews.empty() );
52  m_views.clear();
53  for (ConfigurationType view : vectViews)
54  {
55  ViewInfo vi;
56  if( view->hasAttribute("caption") )
57  {
58  vi.m_caption = view->getExistingAttributeValue("caption");
59  }
60  if( view->hasAttribute("selected") )
61  {
62  std::string isSelected = view->getExistingAttributeValue("selected");
63  OSLM_ASSERT("The value "<<isSelected<<" it's incorrect, it should either be yes or no.",
64  isSelected == "yes" || isSelected == "no");
65  vi.m_isSelect = (isSelected == "yes");
66  }
67 
68  if( view->hasAttribute("useScrollBar") )
69  {
70  std::string useScrollBar = view->getExistingAttributeValue("useScrollBar");
71  OSLM_ASSERT("Incorrect value for \"useScrollBar\" attribute "<<useScrollBar,
72  (useScrollBar == "yes") || (useScrollBar == "no"));
73  vi.m_useScrollBar = (useScrollBar=="yes");
74  }
75 
76  m_views.push_back(vi);
77  }
78 }
79 
80 //-----------------------------------------------------------------------------
81 
82 } // namespace layoutManager
83 } // namespace fwGui
84 
85 
86 
#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) override
Initialize tab layout manager before the creation of layout.
virtual FWGUI_API ~TabLayoutManagerBase()
Destructor. Do nothing.
FWGUI_API TabLayoutManagerBase()
Constructor. Do nothing.