15 #include "fwGui/layoutManager/CardinalLayoutManagerBase.hpp" 17 #include <fwCore/base.hpp> 19 #include <boost/assign/list_of.hpp> 20 #include <boost/lexical_cast.hpp> 25 namespace layoutManager
29 const CardinalLayoutManagerBase::RegistryKeyType CardinalLayoutManagerBase::REGISTRY_KEY =
30 "::fwGui::CardinalLayoutManager";
34 const std::map<std::string, CardinalLayoutManagerBase::Align> CardinalLayoutManagerBase::STRING_TO_ALIGN =
35 ::boost::assign::map_list_of(
"center",CENTER)
57 OSLM_ASSERT(
"Bad configuration name "<<configuration->getName()<<
", must be layout",
58 configuration->getName() ==
"layout");
60 std::vector < ConfigurationType > vectViews = configuration->find(
"view");
63 for (ConfigurationType view : vectViews)
66 if( view->hasAttribute(
"align") )
68 std::string align = view->getExistingAttributeValue(
"align");
69 OSLM_ASSERT(
"Align "<<align<<
" unknown", STRING_TO_ALIGN.find(align) != STRING_TO_ALIGN.end() );
70 vi.m_align = STRING_TO_ALIGN.find(align)->second;
73 if( view->hasAttribute(
"minWidth") )
75 std::string width = view->getExistingAttributeValue(
"minWidth");
76 vi.m_minSize.first = ::boost::lexical_cast<
int >(width);
79 if( view->hasAttribute(
"minHeight") )
81 std::string height = view->getExistingAttributeValue(
"minHeight");
82 vi.m_minSize.second = ::boost::lexical_cast<
int >(height);
85 if( view->hasAttribute(
"resizable") )
87 std::string resizable = view->getExistingAttributeValue(
"resizable");
88 OSLM_ASSERT(
"Incorrect value for \"resizable\" attribute "<<resizable,
89 (resizable ==
"yes") || (resizable ==
"no"));
90 vi.m_isResizable = (resizable==
"yes");
93 if( view->hasAttribute(
"position") )
95 std::string position = view->getExistingAttributeValue(
"position");
96 vi.m_position = ::boost::lexical_cast<
int >(position);
99 if( view->hasAttribute(
"layer") )
101 std::string layer = view->getExistingAttributeValue(
"layer");
102 vi.m_layer = ::boost::lexical_cast<
int >(layer);
105 if( view->hasAttribute(
"row") )
107 std::string row = view->getExistingAttributeValue(
"row");
108 vi.m_row = ::boost::lexical_cast<
int >(row);
111 if( view->hasAttribute(
"visible") )
113 std::string visible = view->getExistingAttributeValue(
"visible");
114 OSLM_ASSERT(
"Incorrect value for \"visible\" attribute "<<visible,
115 (visible ==
"true") || (visible ==
"false") ||
116 (visible ==
"yes") || (visible ==
"no"));
117 vi.m_visible = ((visible ==
"true") || (visible ==
"yes"));
120 if( view->hasAttribute(
"caption") )
122 vi.m_caption.first =
true;
123 vi.m_caption.second = view->getExistingAttributeValue(
"caption");
126 if( view->hasAttribute(
"useScrollBar") )
128 std::string useScrollBar = view->getExistingAttributeValue(
"useScrollBar");
129 OSLM_ASSERT(
"Incorrect value for \"useScrollBar\" attribute "<<useScrollBar,
130 (useScrollBar ==
"yes") || (useScrollBar ==
"no"));
131 vi.m_useScrollBar = (useScrollBar==
"yes");
134 m_views.push_back(vi);
#define SLM_TRACE_IF(message, cond)
virtual FWGUI_API void initialize(ConfigurationType configuration) override
Initialize cardinal layout manager before the creation of layout.
#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 CardinalLayoutManagerBase()
Constructor. Do nothing.
virtual FWGUI_API ~CardinalLayoutManagerBase()
Destructor. Do nothing.