Salome HOME
Issue 1303 Re-ordering of Sketcher menus: additional structure for feature info to...
[modules/shaper.git] / src / XGUI / XGUI_MenuWorkbench.cpp
index 297d643e66fa18a118930d71304d4457aefb37ce..8107893fc21877e6fb71b4cac8c140c1674166c7 100755 (executable)
@@ -6,6 +6,31 @@
 
 #include <XGUI_MenuWorkbench.h>
 
-XGUI_MenuWorkbench::XGUI_MenuWorkbench()
+#include <XGUI_MenuGroup.h>
+
+XGUI_MenuWorkbench::XGUI_MenuWorkbench(const std::string& theName)
+: myName(theName)
+{
+}
+
+std::shared_ptr<XGUI_MenuGroup> XGUI_MenuWorkbench::findGroup(const std::string& theGroupName)
+{
+  std::list< std::shared_ptr<XGUI_MenuGroup> >::const_iterator anIt = myGroups.begin(),
+                                                              aLast = myGroups.end();
+  std::shared_ptr<XGUI_MenuGroup> aResultGroup = 0;
+  for (; anIt != aLast && !aResultGroup; anIt++) {
+    std::shared_ptr<XGUI_MenuGroup> aGroup = *anIt;
+    if (aGroup->getName() == theGroupName)
+      aResultGroup = aGroup;
+  }
+  if (!aResultGroup) {
+    aResultGroup = std::shared_ptr<XGUI_MenuGroup>(new XGUI_MenuGroup(theGroupName));
+    myGroups.push_back(aResultGroup);
+  }
+  return aResultGroup;
+}
+
+const std::list<std::shared_ptr<XGUI_MenuGroup> >& XGUI_MenuWorkbench::groups() const
 {
+  return myGroups;
 }