5 #ifndef XGUI_ACTIONSMGR_H_
6 #define XGUI_ACTIONSMGR_H_
12 #include <QStringList>
16 class XGUI_OperationMgr;
19 class XGUI_EXPORT XGUI_ActionsMgr: public QObject
24 XGUI_ActionsMgr(XGUI_Workshop* theWorkshop);
25 virtual ~XGUI_ActionsMgr();
27 //! Add a command in the manager.
28 //! Please note that nested commands in the Salome mode (No XGUI_Command, pure QActions)
29 //! won't be extracted and should be added manually using the addNestedCommands method.
30 void addCommand(QAction* theCmd);
31 //! Sets relation between the command (with given Id) and it's nested actions.
32 void addNestedCommands(const QString& theId, const QStringList& theCommands);
34 QStringList nestedCommands(const QString& theId) const;
36 bool isNested(const QString& theId) const;
39 //! Update workbench actions according to OperationMgr state:
40 //! No active operations: all actions but nested are available
41 //! There is active operation: current operation + it's nested
42 //! are enabled, all the rest is disabled. All active commands is checked.
44 //! Sets all commands checked if it's operation is active.
45 void updateCheckState();
48 //! Sets all actions to isEnabled state.
49 void setAllEnabled(bool isEnabled);
50 //! Sets all nested actions to isEnabled state for the command with given ID.
51 //! If ID is empty - all nested actions will be affected.
52 void setNestedCommandsEnabled(bool isEnabled, const QString& theParent = QString());
53 //! Sets the action with theId to theChecked state.
54 void setActionChecked(const QString& theId, const bool theChecked);
55 //! Sets the action with theId to theEnabled state.
56 void setActionEnabled(const QString& theId, const bool theEnabled);
59 QMap<QString, QAction*> myActions;
60 QMap<QString, QStringList> myNestedActions;
62 XGUI_OperationMgr* myOperationMgr;
65 #endif /* XGUI_ACTIONSMGR_H_ */