9 #include <fwRuntime/operations.hpp> 13 namespace layoutManager
16 const IMenuLayoutManager::RegistryKeyType IMenuLayoutManager::REGISTRY_KEY =
"::fwGui::MenuLayoutManager";
34 OSLM_ASSERT(
"Bad configuration name "<<configuration->getName()<<
", must be layout",
35 configuration->getName() ==
"layout");
38 for( iter = configuration->begin(); iter != configuration->end(); ++iter )
40 if( (*iter)->getName() ==
"menuItem" )
42 ConfigurationType menuItem = *iter;
45 SLM_ASSERT(
"Depreciated tag <state>", !menuItem->hasAttribute(
"state"));
46 SLM_ASSERT(
"Depreciated tag <enable>", !menuItem->hasAttribute(
"enable"));
48 SLM_ASSERT(
"missing <name> attribute", menuItem->hasAttribute(
"name"));
49 if( menuItem->hasAttribute(
"name") )
51 info.m_name = menuItem->getExistingAttributeValue(
"name");
54 if( menuItem->hasAttribute(
"shortcut") )
56 info.m_shortcut = menuItem->getExistingAttributeValue(
"shortcut");
59 if( menuItem->hasAttribute(
"icon") )
61 info.m_icon = ::fwRuntime::getBundleResourceFilePath(menuItem->getAttributeValue(
"icon"));
64 if( menuItem->hasAttribute(
"style") )
66 std::string style = menuItem->getExistingAttributeValue(
"style");
67 info.m_isCheckable = (style ==
"check");
68 info.m_isRadio = (style ==
"radio");
71 if( menuItem->hasAttribute(
"specialAction") )
73 std::string specialActionName = menuItem->getExistingAttributeValue(
"specialAction");
74 if (specialActionName ==
"DEFAULT")
76 info.m_type = DEFAULT;
78 else if (specialActionName ==
"QUIT")
82 else if (specialActionName ==
"ABOUT")
86 else if (specialActionName ==
"HELP")
90 else if (specialActionName ==
"NEW")
96 OSLM_FATAL(
"specialAction " << specialActionName <<
" is unknown." );
102 if( (*iter)->getName() ==
"separator" )
105 info.m_isSeparator =
true;
106 info.m_type = SEPARATOR;
110 if( (*iter)->getName() ==
"menu" )
113 info.m_isMenu =
true;
114 if( (*iter)->hasAttribute(
"name") )
116 info.m_name = (*iter)->getExistingAttributeValue(
"name");
127 for( ::fwGui::container::fwMenuItem::sptr menuItem :
m_menuItems)
129 menuItem->destroyContainer();
132 for( ::fwGui::container::fwMenu::sptr menu :
m_menus)
134 menu->destroyContainer();
#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) ...
#define OSLM_FATAL(message)
Container::iterator Iterator
Defines the configuration element container type.