9 #include <fwRuntime/operations.hpp> 11 #include <boost/lexical_cast.hpp> 15 namespace layoutManager
18 const IToolBarLayoutManager::RegistryKeyType IToolBarLayoutManager::REGISTRY_KEY =
"::fwGui::ToolBarLayoutManager";
36 OSLM_ASSERT(
"Bad configuration name "<<configuration->getName()<<
", must be layout",
37 configuration->getName() ==
"layout");
40 for( iter = configuration->begin(); iter != configuration->end(); ++iter )
42 if( (*iter)->getName() ==
"menuItem" )
44 ConfigurationType toolBarItem = *iter;
46 SLM_ASSERT(
"Depreciated tag <state>", !toolBarItem->hasAttribute(
"state"));
47 SLM_ASSERT(
"Depreciated tag <enable>", !toolBarItem->hasAttribute(
"enable"));
49 SLM_ASSERT(
"missing <name> attribute", toolBarItem->hasAttribute(
"name"));
50 if( toolBarItem->hasAttribute(
"name") )
52 info.m_name = toolBarItem->getExistingAttributeValue(
"name");
55 if( toolBarItem->hasAttribute(
"icon") )
57 info.m_icon = ::fwRuntime::getBundleResourceFilePath(toolBarItem->getAttributeValue(
"icon"));
60 if( toolBarItem->hasAttribute(
"icon2") )
62 SLM_ASSERT(
"'icon' attribute must be defined before 'icon2'", !info.m_icon.empty());
63 info.m_icon2 = ::fwRuntime::getBundleResourceFilePath(toolBarItem->getAttributeValue(
"icon2"));
66 if( toolBarItem->hasAttribute(
"style") )
68 std::string style = toolBarItem->getExistingAttributeValue(
"style");
69 info.m_isCheckable = (style ==
"check");
70 info.m_isRadio = (style ==
"radio");
73 if( toolBarItem->hasAttribute(
"shortcut") )
75 info.m_shortcut = toolBarItem->getExistingAttributeValue(
"shortcut");
79 else if( (*iter)->getName() ==
"separator" )
82 info.m_isSeparator =
true;
84 if( (*iter)->hasAttribute(
"size") )
86 info.m_size = ::boost::lexical_cast<
int > ((*iter)->getExistingAttributeValue(
"size"));
91 else if( (*iter)->getName() ==
"spacer" )
94 info.m_isSpacer =
true;
97 else if( (*iter)->getName() ==
"menu" )
100 info.m_isMenu =
true;
101 if( (*iter)->hasAttribute(
"name") )
103 info.m_name = (*iter)->getExistingAttributeValue(
"name");
106 if( (*iter)->hasAttribute(
"icon") )
108 info.m_icon = ::fwRuntime::getBundleResourceFilePath((*iter)->getExistingAttributeValue(
"icon" ));
112 else if( (*iter)->getName() ==
"editor" )
115 info.m_isEditor =
true;
126 for( ::fwGui::container::fwMenuItem::sptr menuItem :
m_menuItems)
128 menuItem->destroyContainer();
131 for( ::fwGui::container::fwMenu::sptr menu :
m_menus)
133 menu->destroyContainer();
136 for( ::fwGui::container::fwContainer::sptr container :
m_containers)
138 container->destroyContainer();
140 m_containers.clear();
#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.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
Container::iterator Iterator
Defines the configuration element container type.