]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
Salome HOME
Issue #2340: Provide list of accessible Undo/Redo commands for widgets
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetMultiSelector.cpp
index 15be27427a803b0a94c54e306b9a0c07220982c7..53350edaf448a4e28caa7a58cf895ddba6dbed18 100755 (executable)
@@ -505,6 +505,7 @@ void ModuleBase_WidgetMultiSelector::appendSelectionInHistory()
   QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
   myCurrentHistoryIndex++;
   mySelectedHistoryValues.append(aSelected);
+  int aNb = mySelectedHistoryValues.count();
   myWorkshop->updateCommandStatus();
 
 #ifdef DEBUG_UNDO_REDO
@@ -882,3 +883,32 @@ bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject,
   }
   return aFound;
 }
+
+QList<ActionInfo> ModuleBase_WidgetMultiSelector::actionsList(ModuleBase_ActionType theActionType) const
+{
+  QList<ActionInfo> aList;
+  if (myCurrentHistoryIndex > -1) {
+    int i = 0;
+    QString aTitle("Selection %1 items");
+    QIcon aIcon(":pictures/selection.png");
+    switch (theActionType) {
+    case ActionUndo:
+      i = 1;
+      while (i <= myCurrentHistoryIndex) {
+        ActionInfo aInfo(aIcon, aTitle.arg(mySelectedHistoryValues.at(i).count()));
+        aList.append(aInfo);
+        i++;
+      }
+      break;
+    case ActionRedo:
+      i = mySelectedHistoryValues.length() - 1;
+      while (i > myCurrentHistoryIndex) {
+        ActionInfo aInfo(aIcon, aTitle.arg(mySelectedHistoryValues.at(i).count()));
+        aList.append(aInfo);
+        i--;
+      }
+      break;
+    }
+  }
+  return aList;
+}
\ No newline at end of file