5 #ifndef XGUI_ACTIONSMGR_H_
6 #define XGUI_ACTIONSMGR_H_
13 #include <QStringList>
14 #include <QKeySequence>
18 class XGUI_OperationMgr;
19 class ModuleBase_Operation;
22 class XGUI_EXPORT XGUI_ActionsMgr : public QObject
27 XGUI_ActionsMgr(XGUI_Workshop* theWorkshop);
28 virtual ~XGUI_ActionsMgr();
30 //! Add a command in the manager.
31 //! Please note that nested commands in the Salome mode (No XGUI_Command, pure QActions)
32 //! won't be extracted and should be added manually using the addNestedCommands method.
33 void addCommand(QAction* theCmd);
34 //! Sets relation between the command (with given Id) and it's nested actions.
35 void addNestedCommands(const QString& theId, const QStringList& theCommands);
37 QStringList nestedCommands(const QString& theId) const;
39 bool isNested(const QString& theId) const;
41 QKeySequence registerShortcut(const QString& theKeySequence);
43 void updateByDocumentKind();
46 //! Update workbench actions according to OperationMgr state:
47 //! No active operations: all actions but nested are available
48 //! There is active operation: current operation + it's nested
49 //! are enabled, all the rest is disabled. All active commands is checked.
51 //! Sets all commands checked if it's operation is active.
52 void updateCheckState();
55 //! Sets all actions to isEnabled state.
56 void setAllEnabled(bool isEnabled);
57 //! Sets to isEnabled state all siblings of the given operation and it's parents recursively
58 void setNestedStackEnabled(ModuleBase_Operation* theOperation);
59 //! Sets all nested actions to isEnabled state for the command with given ID.
60 //! If ID is empty - all nested actions will be affected.
61 void setNestedCommandsEnabled(bool isEnabled, const QString& theParent = QString());
62 //! Sets the action with theId to theChecked state.
63 void setActionChecked(const QString& theId, const bool theChecked);
64 //! Sets the action with theId to theEnabled state.
65 void setActionEnabled(const QString& theId, const bool theEnabled);
68 QMap<QString, QAction*> myActions;
69 QMap<QString, QStringList> myNestedActions;
70 QList<QKeySequence> myShortcuts;
72 XGUI_Workshop* myWorkshop;
73 XGUI_OperationMgr* myOperationMgr;
76 #endif /* XGUI_ACTIONSMGR_H_ */