13 #include <boost/lexical_cast.hpp> 15 #include <fwCore/base.hpp> 17 #include "fwGui/layoutManager/LineLayoutManagerBase.hpp" 22 namespace layoutManager
26 const LineLayoutManagerBase::RegistryKeyType LineLayoutManagerBase::REGISTRY_KEY =
"::fwGui::LineLayoutManager";
44 OSLM_ASSERT(
"Bad configuration name "<<configuration->getName()<<
", must be layout",
45 configuration->getName() ==
"layout");
47 std::vector < ConfigurationType > vectOrientation = configuration->find(
"orientation");
49 SLM_FATAL_IF(
"missing orientation configuration", vectOrientation.empty() );
50 SLM_ASSERT(
"<orientation> tag must have value attribute", vectOrientation.at(0)->hasAttribute(
"value"));
51 std::string orientation = vectOrientation.at(0)->getExistingAttributeValue(
"value");
52 SLM_ASSERT(
"Wrong value '"<< orientation <<
"' for 'orientation' attribute (require vertical or horizontal)",
53 orientation ==
"vertical" || orientation ==
"horizontal");
54 m_orientation = (orientation ==
"vertical") ? VERTICAL : HORIZONTAL;
57 for (ConfigurationType view : configuration->getElements())
59 if( view->getName() ==
"spacer" )
63 m_views.push_back(vi);
65 else if( view->getName() ==
"view" )
68 if( view->hasAttribute(
"proportion") )
70 std::string proportion = view->getExistingAttributeValue(
"proportion");
71 vi.m_proportion = ::boost::lexical_cast<
int >(proportion);
73 if( view->hasAttribute(
"border") )
75 std::string border = view->getExistingAttributeValue(
"border");
76 vi.m_border = ::boost::lexical_cast<
int >(border);
78 if( view->hasAttribute(
"caption") )
80 vi.m_caption.first =
true;
81 vi.m_caption.second = view->getExistingAttributeValue(
"caption");
83 if( view->hasAttribute(
"minWidth") )
85 std::string width = view->getExistingAttributeValue(
"minWidth");
86 vi.m_minSize.first = ::boost::lexical_cast<
int >(width);
88 if( view->hasAttribute(
"minHeight") )
90 std::string height = view->getExistingAttributeValue(
"minHeight");
91 vi.m_minSize.second = ::boost::lexical_cast<
int >(height);
93 if( view->hasAttribute(
"visible") )
95 std::string visible = view->getExistingAttributeValue(
"visible");
96 OSLM_ASSERT(
"Incorrect value for \"visible\" attribute "<<visible,
97 (visible ==
"true") || (visible ==
"false") ||
98 (visible ==
"yes") || (visible ==
"no"));
99 vi.m_visible = ((visible ==
"true") || (visible ==
"yes"));
101 if( view->hasAttribute(
"useScrollBar") )
103 std::string useScrollBar = view->getExistingAttributeValue(
"useScrollBar");
104 OSLM_ASSERT(
"Incorrect value for \"useScrollBar\" attribute "<<useScrollBar,
105 (useScrollBar ==
"yes") || (useScrollBar ==
"no"));
106 vi.m_useScrollBar = (useScrollBar==
"yes");
108 m_views.push_back(vi);
virtual FWGUI_API ~LineLayoutManagerBase()
Destructor. Do nothing.
#define OSLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
The namespace fwGui contains the base interface for IHM services.
FWGUI_API LineLayoutManagerBase()
Constructor. Do nothing.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
#define SLM_FATAL_IF(message, cond)
virtual FWGUI_API void initialize(ConfigurationType configuration) override
Initialize Line layout manager before the creation of layout.