fw4spl
IToolBarBuilder.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 
15 #include "fwGui/builder/IToolBarBuilder.hpp"
16 
17 #include <boost/lexical_cast.hpp>
18 
19 namespace fwGui
20 {
21 namespace builder
22 {
23 
24 const IToolBarBuilder::RegistryKeyType IToolBarBuilder::REGISTRY_KEY = "::fwGui::ToolBarBuilder";
25 
26 //-----------------------------------------------------------------------------
27 
29 {
30  m_toolBitmapSize = std::make_pair(32, 32);
31 }
32 
33 //-----------------------------------------------------------------------------
34 
36 {
37 }
38 
39 //-----------------------------------------------------------------------------
40 
41 void IToolBarBuilder::initialize( ::fwRuntime::ConfigurationElement::sptr configuration)
42 {
43  OSLM_ASSERT("Bad configuration name "<<configuration->getName()<< ", must be toolBar",
44  configuration->getName() == "toolBar");
45 
46 
47  if (configuration->hasAttribute("align"))
48  {
49  std::string aligment = configuration->getExistingAttributeValue("align");
50  if (aligment == "top")
51  {
52  m_aligment = TOP;
53  }
54  else if (aligment == "bottom")
55  {
56  m_aligment = BOTTOM;
57  }
58  else if (aligment == "right")
59  {
60  m_aligment = RIGHT;
61  }
62  else if (aligment == "left")
63  {
64  m_aligment = LEFT;
65  }
66  else
67  {
68  OSLM_FATAL("Wrong value '"<< aligment <<"' for 'align' attribute (require top, bottom, right or left)");
69  }
70  }
71 
73  for( iter = configuration->begin(); iter != configuration->end(); ++iter )
74  {
75  if( (*iter)->getName() == "toolBitmapSize" )
76  {
77  if((*iter)->hasAttribute("height"))
78  {
79  m_toolBitmapSize.second = ::boost::lexical_cast< int > ((*iter)->getExistingAttributeValue("height"));
80  }
81  if((*iter)->hasAttribute("width"))
82  {
83  m_toolBitmapSize.first = ::boost::lexical_cast< int > ((*iter)->getExistingAttributeValue("width"));
84  }
85  }
86  }
87 }
88 
89 //-----------------------------------------------------------------------------
90 
91 ::fwGui::container::fwToolBar::sptr IToolBarBuilder::getToolBar()
92 {
93  return this->m_toolBar;
94 }
95 
96 //-----------------------------------------------------------------------------
97 
98 } // namespace builder
99 } // namespace fwGui
100 
101 
102 
::fwGui::container::fwToolBar::sptr m_toolBar
ToolBar.
#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
FWGUI_API IToolBarBuilder()
Constructor. Do nothing.
virtual FWGUI_API void initialize(::fwRuntime::ConfigurationElement::sptr configuration)
Initialize the tool bar.
#define OSLM_FATAL(message)
Definition: spyLog.hpp:285
virtual FWGUI_API ~IToolBarBuilder()
Destructor. Do nothing.
Container::iterator Iterator
Defines the configuration element container type.
virtual FWGUI_API::fwGui::container::fwToolBar::sptr getToolBar()
Returns the builded tool bar.